Summary:
This adds workflows which run on tag, or manually, to publish packages to npmjs and cocoapods. These secrets should be set, but this is untested. We can fix manually and re-run though.
Pull Request resolved: https://github.com/facebook/yoga/pull/1316
Test Plan: no parse errors when adding to GitHub
Reviewed By: cortinico
Differential Revision: D47069617
Pulled By: NickGerleman
fbshipit-source-id: efe0664be7cd287c598515c9572daff1655cfc14
Summary:
Adds a step to validate the prepublish steps, and upload the resulting tarball.
Pull Request resolved: https://github.com/facebook/yoga/pull/1315
Test Plan: A tarball is uploaded as part of validation and looks decent.
Reviewed By: cortinico
Differential Revision: D47068368
Pulled By: NickGerleman
fbshipit-source-id: 62c8946a1bb542310634c8a7384a0e4890b35bdf
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1314
Replace some of the basic parts of the config with values for Yoga
Reviewed By: yungsters
Differential Revision: D46884432
fbshipit-source-id: ff729d93b4378925c9b526b50dd06f95f5e27b51
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1313
Use yarn workspaces to consolidate the lockfile, and to let the website use our local Yoga package. This was not possible with the old version of Gatsby we were previously using.
This does not yet sync the versions of different packages, or move config files to the root of the repo. That will happen later after removing the original website package.
Reviewed By: yungsters
Differential Revision: D46884433
fbshipit-source-id: dfa43bdaaad66bb4365922287a39d6a34fa9f464
Summary: Include error messages or other output for CMake generating the build for ninja
Reviewed By: yungsters
Differential Revision: D46884396
fbshipit-source-id: a31ae4dbdecd8833e62d8e3b8bf8dcaae9ba67e2
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1312
This starts us transitioning the Yoga website off of an ancient version of Gatsby by initializing a new Docusaurus project. This commit adds a new stock project, to be filled in later, then fixes license lint errors.
Note that this seems to have init'd using npm, but in the next diff I convert this to yarn workspaces anyway.
Reviewed By: yungsters
Differential Revision: D46884434
fbshipit-source-id: 7a0a4dddc144ad2d22cd18a02e8dcb9ff2184489
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1311
Adds some more output files to be ignored by prettier, eslint, tsconfig
Reviewed By: rozele
Differential Revision: D46884397
fbshipit-source-id: 69329f924cb3e949152a07d93514dc8cf8b3253a
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1310
Emscripten normally compiles a binary into a `.js` file and a `.wasm` file. The `.js` file contains a shim to load the WebAssembly file for the target platform, along with passing some environment information to the underlying assembly.
Under Node this would use APIs like `fs.readFile` and its WebAssembly APIs to load the binary. In a browser, APIs like `instantiateStreaming` are used to start downloading and compiling the binary at the same time.
This format creates many, many, headaches, and manual bundler configuration. E.g. we must tell Webpack to treat WASM files as auxilary files instead of WebAssembly, cannot use Emscripten's loader directly, and would need to add more variants of the binary, since (or Node polyfills in the browser) `-s ENVIRONMENT='web,node'` emits code that looks like `if (isNode) {require('fs')}`.
This change makes us instead pack the WebAssembly as base64 inline with the JS loader. This adds a size penalty, and means we cannot start async compilation until the entire file is present, but should work out of the box when using different bundlers and configurations, and the size is small enough where it likely makes sense to inline into the bundle anyway.
There is a [proposal for integration of WebAssembly and ES Modules](https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration) that Node has experimental support for, and bundlers are veering towards supporting. It is the eventual solution we should target, but does not seem mature enough yet. E.g. WebPack [does not support](https://github.com/webpack/webpack/issues/11893) WebAssembly import objects, and will instead try to import each of the named imports as modules.
Reviewed By: rozele
Differential Revision: D46884398
fbshipit-source-id: a1c93c122c255b913f426bfb6bdb38fd9f9dfd41
Summary: This is needed to make Webpack happy when bundling Yoga. Webpack assumes this is an ESModule after following it from the package.json export map. We are already importing this via default import.
Reviewed By: GijsWeterings
Differential Revision: D46811190
fbshipit-source-id: 7a074e5d2aa9c0cb4b59e506a0d910762a62dd58
Summary: I was not able to run `ruby gentest.rb` from Yoga. Updating watir seems to fix the issue.
Reviewed By: shwanton, NickGerleman
Differential Revision: D46687292
fbshipit-source-id: 9922996144aa23fc7fa2f0dcb372367121689598
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1307
This syncs up some of the descriptions, author names, etc between the different Yoga packages we are going to soon publish.
Reviewed By: cortinico
Differential Revision: D46664187
fbshipit-source-id: b15974efee31f349650e5d23f9fcaebaef6d6dd3
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1306
We are deprecating YogaKit as part of Yoga 2.0, with that version planned as the last release. Mark the podspec as deprecated.
We are also deprecating the Android ViewGroup in a similar way but from the googling I did there is not an equivalent way to do that for Maven artifacts.
Reviewed By: cortinico
Differential Revision: D46663201
fbshipit-source-id: 14e89df8f20470996b5c4b25f098d27cd3f49c7f
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1305
Made a quick script to set versions in manifests that currently exist. This should probably be stamped in more places, like the binary as well, but we don't do that right now. This does not update lockfiles for CocoaPods or JS, so those will need to be updated via an install after running this script.
A note on language: This repo already has too many toolchains, but I chose Python for this since it corresponds with the enum script, and we can run it with no dependencies on macOS/Linux distros.
Reviewed By: cortinico
Differential Revision: D46662378
fbshipit-source-id: 74ab99eef137511f8ed2fd7d81335a0fa633caf5
Summary:
This sets up publishing for stable of Yoga whenever a git tag gets published.
I also re-enabled Javadoc publishing as this is a requirement to hit Maven Central.
Reviewed By: NickGerleman
Differential Revision: D46522898
fbshipit-source-id: dc4b9139aed7aff27dce966bcee7b9b0cc4c6fe9
Summary:
I accidentally mixed the secret name for publishing to sonatype.
The correct values are `SONATYPE_USERNAME` and `SONATYPE_PASSWORD`.
After this snapshot publishing should be green.
Reviewed By: NickGerleman
Differential Revision: D46522897
fbshipit-source-id: 3ebb5bf5be32a7bbac1fefc9ed46c49be15bd56c
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1302
These C# bindings were contributed as part of ff8f17ac99. They have occasionally been refreshed, but has never really had validation it built continuously, or dedicated maintenance.
There has been a surge of work with https://github.com/facebook/yoga/pull/1207 to try to modernize the build for these, but checking with jkoritzinsky I'm not sure either of us have the time to commit to supporting these at the same level as other bindings.
Some well-known projects like Unity had already abandoned this set of bindings for their own. 016297e35c (diff-c85198aaac9095a5446ed00b0fba8025072d235b2b69dea8aad85abc64a83e1e)
So, as part of the work for an official OSS release, and really trying to define what is deprecated, and what we will try to support, I am removing the in-tree C# bindings from Yoga.
In the past, gaps in Yoga bindings we haven't supported have led to new bindings with dedicated maintainers e.g. [FlexLayout](https://github.com/layoutBox/FlexLayout), [yoga-rs](https://github.com/bschwind/yoga-rs), [yoga-wasm-web](https://github.com/shuding/yoga-wasm-web). My hope is that by removing the C# bindings that we are not supporting, we free up the opportunity for a new version to become the defacto.
Reviewed By: javache
Differential Revision: D46425886
fbshipit-source-id: df964c4d55adf93c4d1e82c104e74ca5ad181612
Summary: I'm adding this action which will setup publishing of `-SNAPSHOT` version after every commit to main.
Reviewed By: mdvacca
Differential Revision: D46330012
fbshipit-source-id: 8d9f32a357f157a8f2e05c88074befd8dd871c94
Summary:
This sets up publishing of -SNAPSHOT verison of Yoga using the
Gradle plugin `io.github.gradle-nexus.publish-plugin`
This plugin will take care of setting up the credentials for Sonatype and hitting the Maven repository.
I've cleaned up the setup and centralized it inside a script plugin in the `build-logic` folder so we can easily add more module and just use `id("publish")` to publish them as well.
Reviewed By: mdvacca
Differential Revision: D46330013
fbshipit-source-id: 7221b296b9955a257fc290a2d1ac1d9fedfb787d
Summary:
This project was still using the legacy Gradle's "apply:" syntax
to apply Gradle Plugins. I'm changing it here to use instead the
`plugins{}` block as it make easier to apply other plugins for publishing later.
Reviewed By: mdvacca
Differential Revision: D46330014
fbshipit-source-id: 5483a717a62d5ab76749026c5203dc96a35d73e7
Summary:
X-link: https://github.com/facebook/react-native/pull/37349
Pull Request resolved: https://github.com/facebook/yoga/pull/1288
Fixes https://github.com/facebook/yoga/issues/1283
New versions of CMake add "policies" which control how the build system acts wrt breaking changes. By default, CMake will emulate the behavior of the version specified in `cmake_minimum_required`.
Setting a policy to true (to opt into new behavior where `cmake_minimum_required` is lower than the current version) seems actually just error out on the old versions.
Googling around, apparently the way I should be doing this is to specify `<policy_max>` as part of `cmake_minimum_required `. https://gitlab.kitware.com/cmake/cmake/-/issues/20392
This should I think use new policies introduced up to 3.26 (what we test on right now), while letting 3.13 be the minimum.
Reviewed By: cortinico
Differential Revision: D45724864
fbshipit-source-id: 120cc2015a043605e7c07ef0459667643a4284b7
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1292
AGP 8.0 will now bring in a new enough CMake version to avoid internal warnings without extra configuration.
Reviewed By: cortinico
Differential Revision: D45766980
fbshipit-source-id: 7834f723c87ec76c450a94958cd36b4930a8961a
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1299
X-link: https://github.com/facebook/igl/pull/22
deletes semicolons and adds whitespace sometimes
moved the runtime ipc chages int a seperate diff
Reviewed By: KSRandom
Differential Revision: D45835378
fbshipit-source-id: 2890e93620af4cadd33b9c8c9149157d9078fa32
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1294
X-link: https://github.com/facebook/react-native/pull/37383
Add -Wextra to the build, and fixup some more instances of -Wunused-parameter that it sufaces which were not automatically fixable.
Reviewed By: javache
Differential Revision: D45772846
fbshipit-source-id: 29bf71006f63161521fe5869c3a7d8bf7aae9c81
Summary:
X-link: https://github.com/facebook/react-native/pull/37375
Adds internal helpers to YGConfig to make bit manipulation more readable. We also expose `hasErrata()` to YGNode beacuse checking that will be a common pattern. We intentionally don't add mutating functions to the node, since current model is to inval a node on commiting whole config.
This is not exposed via the C ABI.
Reviewed By: yungsters
Differential Revision: D45765971
fbshipit-source-id: eadaee4b9cf5204ac4984ecc52cc08650d144a30
Summary:
X-link: https://github.com/facebook/react-native/pull/37243
X-link: https://github.com/facebook/litho/pull/944
Pull Request resolved: https://github.com/facebook/yoga/pull/1279
Java bindings for Yoga rely solely on garbage collection for memory management. Each Java `YogaNode` has references to its children and parent Java Nodes. This means, for a node to be garbage collected, it cannot be reachable from any user accessible node. Each node then has single ownership of a `YGNodeRef`. When the `YogaNode` is garbage collected, a finalizer is run to call `YGNodeFree` and free the underlying native Yoga Node.
This may cause a use-after-free if finalizers are run from multiple threads. This is because `YGNodeFree` does more than just freeing, but instead also interacts with its parent and children nodes to detach itself, and remove any dangling pointers. If multiple threads run finalizers at once, one may traverse and try to mutate a node which another is freeing.
Because we know the entire connected tree is dead, there is no need to remove dangling pointers, so I want to expose a way to just free a Yoga Node, without it mutating the tree as a side effect.
This adds a currently private `YGNodeDeallocate` that frees without traversal. Ideally from naming this is what `YGNodeFree` would do, but we think changing the behavior of that might be too disruptive to OSS. At the same time there may be other memory safety related API changes we would like to eventually make, so this isn't made public beyond the JNI bindings to prevent needing to transition more APIs.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D45556206
fbshipit-source-id: 62a1394c6f6bdc2b437b388098ea362a0fbcd0f7
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1287
Outputs tests as TypeScript, along with using/testing the new form of enums imported directly from the package.
We need to change how we are telling Jest which variant to run, so that tests can import enums from "yoga-layout" and have it resolve to the entrypoint which has a binary which has already been built.
Reviewed By: yungsters
Differential Revision: D45723545
fbshipit-source-id: 887d929344a78cadec159a07c643b74b76b87c6c
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1286
This can be marked in fixtures to skip a test without commenting it out. We add one more usage of this.
The same functionality existed (unused) before for `experiments`, which I changed to `data-experiments`.
Formatting of JS tests changed to be closer to what Prettier would output, and to remove usage of `Yoga.UNDEFINED` which doesn't existi and just resolves to `undefined` (this is converted to NaN by the wrapper layer).
Reviewed By: yungsters
Differential Revision: D45723003
fbshipit-source-id: 337af319ab1c1c12047d6579da8c7e63b4f1537a
Summary:
`ts-node` does transformation using tsc. Do transformation with Babel instead so that the generation is consistent with Jest and the packed output.
We still need `ts-node` around since various systems rely on it being present to enable `.ts` config files.
This also enables transformation of any JS files.
Reviewed By: yungsters
Differential Revision: D45722106
fbshipit-source-id: 51b7a4f6a1532bea1133d59e626297d3b40f1762
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1284
This makes TypeScript resolution play nicely with export maps, and converts the entrypoints to TypeScript.
We remove the non-export-map fallbacks as well, so the export maps are always followed.
Tests are moved to load yoga from its external export, testing the entrypoints.
This moves the only untyped bit to the binary wrapper, which another diff will move.
Reviewed By: yungsters
Differential Revision: D45713689
fbshipit-source-id: 228e6f2c9d53520230707a81e76c3c35fcd46de5
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1285
Enums are currently exposed to the JS package as constants (e.g. `import {ERRATA_NONE} from 'yoga-layout'`).
This exports enums in the form of `import {Errata} from 'yoga-layout'` then `Errata.None`.
It would be more ergonomic for these to be string union based enums instead, but right now it is a pretty thin wrapper around the native API, we need ordinal values to do things with bit masks, and folks have wanted to serialize them before.
Reviewed By: yungsters
Differential Revision: D45570417
fbshipit-source-id: dbfd330e939051d0c16460a4d2a996f88f98875c
Summary:
This change restructures the package to try to remove the JS build step from the inner loop. Instead, we have a single `src` directory that we babel transform when using, then apply the same transform inline during prepublish.
At the end, we will be publishing a source directory with Babel transformed TS, JS, and TS declarations.
We do a little spring cleaning when doing this. Fixing up some of the folder/file conventions, and removing the non-export-map fallbacks.
We cannot remove the need for a native build.
Reviewed By: yungsters
Differential Revision: D45682153
fbshipit-source-id: ea2dd75c2dd6e3529b1ef6cf6ac6a64a270049a4
Summary:
Match Prettier config to match other Meta OSS projects
Didn't update the test generator to use this form yet.
Reviewed By: yungsters
Differential Revision: D45570415
fbshipit-source-id: d5fd791b047debf41c28aecac75fb8dde16da3e3
Summary: Converts the manually authored tests against the JavaScript bindings to TypeScript. This should make authoring UTs a bit more pleasent, but more importantly lets us run typechecking on sample usage of all of the various APIs.
Reviewed By: yungsters
Differential Revision: D45570416
fbshipit-source-id: 44586b4d31fbeae406b388ed336a8305c788b5dd
Summary:
The sample app is really old and has a lot of legacy code. Here I'm refreshing it a bit.
Will do another pass later (perhaps rewrite it in Kotlin?).
Reviewed By: mdvacca
Differential Revision: D45694414
fbshipit-source-id: 36a84609b0dcf5b4a5237da900f665e4eb7895a5
Summary: This adds the setup necessary to hook Yoga into a Gradle Enterprise instance
Reviewed By: mdvacca
Differential Revision: D45694413
fbshipit-source-id: 766ea7e05f99ae347853dbe3817521379b4e44ba
Summary:
X-link: https://github.com/facebook/react-native/pull/37316
In Fabric, a ShadowNode may re-initialize YGConfig several times throughout the lifetime of a perpetually cloned Yoga Node.
RN sets `pointScaleFactor` lazily, when laying out the rootview. So right now it initializes a config to `pointScaleFactor` of 1.0, sets it, sets a new `pointScaleFactor` on the config, then repeats. This cycles the config between two `pointScaleFactor` values and will excessively dirty the node now that `YGNodeSetConfig` dirties on config change (D45505089)
This change makes it so that we retain previously used `pointScaleFactor` when cloning the Yoga nodes.
Changelog: [Internal]
Reviewed By: rozele
Differential Revision: D45669878
fbshipit-source-id: bfd2e185d9264a1cda64e59132960060385e16f1
Summary:
X-link: https://github.com/facebook/react-native/pull/37207
Pull Request resolved: https://github.com/facebook/yoga/pull/1274
Yoga exposes public APIs for dirtying Nodes, but will itself perform dirty marking when changing bits which invalidate layout. E.g. changing the style of a Node will invalidate it along with every parent Node.
Because config setting is newly public to the C ABI, this makes a similar change so that replacing a Node's config will dirty the tree above the node if there is a layout impacting config change (I don't think children need to be invalidated since child output shouldn't change given the same owner dimensions).
One quirk of this is that configs may be changed independently of the node. So someone could attach a config to a Node, then change the live config after the fact. The config does not currently have a back pointer to the Node, so we do not invalidate in that case of live config edits. The future work to rectify this would be to make configs immutable once created.
There are also currently some experimental features here which should maybe be compared, but these should be moved to YGErrata anyway.
Reviewed By: javache
Differential Revision: D45505089
fbshipit-source-id: 72b2b84ba758679af081d92e7403750c9cc53cb5
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1280
I'm refreshing some of the dependencies of the project,
here doing AGP to 8.0.1.
I'm also removing the older publishing plugin as we're most likely going to use
Gradle's default publishing + another plugin to manage the nexus interactions (the same we use on React Native).
I'm also doing some changes on the JDK side:
- Bumps the JDK version to 17 as that's required by AGP
- Bumps the source/target version to JDK 8. JDK 7 is long deprecated and we're getting a lot of warnings for it on console. Users should be on JDK 11 already by now, but 8 is also good enough.
Reviewed By: passy
Differential Revision: D45564575
fbshipit-source-id: ffe1cc15892659923177a2cad609d5d30f8249ac
Summary:
When trying to open Yoga on Android studio, the local.properties file gets created and added
to the untracked files. This file should not be committed so I'm .gitignoring it.
Reviewed By: mdvacca
Differential Revision: D45564577
fbshipit-source-id: 62c8c8798b539cd6db6e341ee321e27239c25b87
Summary:
I'm refreshing some of the dependencies of the project,
starting with Gradle to 8.1
Reviewed By: mdvacca
Differential Revision: D45564578
fbshipit-source-id: 9570d0026a1c5c4e15921a411b80471f5c5e8ebd
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1277
Now that we have some TypeScript infra set up, move scripts (mainly the benchmarking one) and config files to TypeScript.
Starts to move away a bit from the magic globals used in the JS environment.
Reviewed By: yungsters
Differential Revision: D45511176
fbshipit-source-id: 09bb1117a1b331758ed9d210e82d5b250577df81
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1276
This change starts to enlighten linting and other repo configuration to TypeScript. This was previously special-cased out of linting, and meant we were not linting everything. It is also a precondition to do real typechecking and linting our definitions with type information.
1. Add TypeScript dependencies
1. Configure ESLint, Babel, tsc for TypeScript
1. Run tsc as part of linting (OSS only for now)
This is continued in another change with adding types to scripts and config files, but more importantly converting hand-written tests and test generation to TypeScript, so we get real-world usage to typecheck against for testing.
Reviewed By: yungsters
Differential Revision: D45508576
fbshipit-source-id: 6d2e48b9d25bb6b1788440ea3515ea5f5c64d346