Commit Graph

49 Commits

Author SHA1 Message Date
Nick Gerleman
d4247d65c0 Don't run test validation off main branch (#1644)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1644

Because Chrome behaviors can change

Reviewed By: cortinico

Differential Revision: D56088135

fbshipit-source-id: 7f760786dde061df9af034368e2184117e6e6846
2024-04-15 10:43:25 -07:00
Nick Gerleman
206b95aba5 Yoga Docs: Rename website-next to website (#1613)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1613

So that GitHub links to edit a page point to the right place.

This will fail in OSS build until I switch the directory used by Vercel instance, but I am waiting to do that until ready to land, since that would cause other in progress changes to fail when exported.

Reviewed By: joevilches

Differential Revision: D54837857

fbshipit-source-id: 9bec90232dbe3ec8638568685671185d597fcf2d
2024-03-13 17:25:39 -07:00
Nick Gerleman
108c2f30a2 Yoga Docs: Delete the Old website (#1612)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1612

Moving new website to `/website` before publishing, so that edit links point to the right eventual place in the GitHub repo.

Reviewed By: joevilches

Differential Revision: D54837808

fbshipit-source-id: 46de8a638ad9bce18558fd768ed8c080892b828e
2024-03-13 15:53:21 -07:00
Nick Gerleman
a5c49ebd7b Run CocoaPods Trunk Publish Job on macOS (#1588)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1588

This was previously running on Ubuntu, but just happened to work until the setup job assumed macOS. Run the job on macOS.

Reviewed By: cipolleschi

Differential Revision: D54563775

fbshipit-source-id: 2311029cf9b56527608e9cb000d5c09320607a99
2024-03-06 01:24:01 -08:00
Joe Vilches
cae7ef924a Convience script to run benchmark
Summary: You need to provide the benchmark binary with a path to the captures. This is annoying and there is not a great way to do this in c++ that is cross-plat. So I just made this bash script to ease it. It can do buck and cmake.

Reviewed By: NickGerleman

Differential Revision: D53632438

fbshipit-source-id: 98b0ad52f91f2581e09f787da24f2ec2fff58bf4
2024-02-13 17:22:08 -08:00
Joe Vilches
0ca15bdaaa Ability to recreate yoga trees from JSON captures (#1566)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1566

In the previous diffs we serialized the in-memory representation of a node into json. This diff exposes a `generateBenchmark` method that reads from that json executes the proper public Yoga API functions to recreate the same tree. It then calls calculate layout so that we can time that in the next diff.

This diff is really only focusing on the core aspects of a yoga tree like style, children, and calculating layout; there are still more things to add coming up:

* Support for configs, experiments, and errata
* Support for measure functions
* Support for general node state that is not style (like always forming a containing block)
* Actually running all of these benchmarks together
* Tests

Reviewed By: NickGerleman

Differential Revision: D52987588

fbshipit-source-id: 7f7c9ca9956f693be62bc5e3cebdf1aed6f58aec
2024-02-05 11:48:07 -08:00
Joe Vilches
19af9e6450 Move NodeToString.cpp to benchmark and remove interal usages (#1568)
Summary:
X-link: https://github.com/facebook/react-native/pull/42710

Pull Request resolved: https://github.com/facebook/yoga/pull/1568

This is no longer going to be built with normal yoga so we are going to switch to a public API

Reviewed By: NickGerleman

Differential Revision: D53141235

fbshipit-source-id: 259270a4cd91ef0dab91cefba9c41953b6340d78
2024-02-02 15:44:23 -08:00
Nathaniel Brough
1a8b80a3d5 Add simple fuzz-harness (#1537)
Summary:
> This PR is based on the proposal in https://github.com/facebook/yoga/issues/1538 inlined below, to integrate yoga with `oss-fuzz`

Hey yoga team,

I've recently become interested in yoga. I'd like to suggest and champion an effort to set up some basic fuzz-testing and combine it with google/oss-fuzz for continuous fuzzing. I'm fully aware that you are very busy people and I don't want to overload your review/maintenance capacity. Is this a bad time to discuss potential security/reliability improvements?

If you're not familiar with fuzzing or oss-fuzz I've included a few brief notes below.

#### **Benefits of Fuzz-Testing**

- **Dynamic Code Testing**: Fuzz-testing challenges systems with unexpected data, aiming to identify vulnerabilities or bugs. It’s akin to an exhaustive stress-test for the code.
- **Detecting Hidden Vulnerabilities**: It can uncover potential weaknesses that may not be evident in routine tests.
- **Continuous and Automated Testing**: With tools like Google’s OSS-Fuzz, fuzz-testing can be automated, running continuously on distributed systems, ensuring daily resilience checks.

#### **Google/oss-fuzz for Continuous Fuzzing**

- **Automated Fuzzing**: OSS-Fuzz undertakes comprehensive fuzz-testing daily on a distributed cluster.
- **Detailed Reporting**: OSS-Fuzz offers exhaustive reports in case of detected anomalies, enabling effective action.

I’d be more than happy to lead the effort in integrating fuzz testing with the yoga and assist in any way required.

#### Prior integrations
There have been a number of previous integrations completed with facebook repositories and google/oss-fuzz including;
- facebook/time
- facebook/zstd
- facebookexperimental/starlark-rust (this was me)
- facebook/proxygen
- facebook/hermes
- facebook/rocksdb

As a proof of concept I created a couple of super simple fuzz harnesses in https://github.com/facebook/yoga/issues/1537.

NOTE: Adding fuzz-testing and integrating with google/oss-fuzz was previously suggested here https://github.com/facebook/yoga/pull/1055 and was rejected. I think I've addressed the concerns raised in the first PR. While the original PR contained what was probably a higher performance fuzzer, the new fuzzer should be easier to integrate and doesn't introduce multiple sources of truth.

Pull Request resolved: https://github.com/facebook/yoga/pull/1537

Reviewed By: yungsters

Differential Revision: D52800366

Pulled By: NickGerleman

fbshipit-source-id: 4957282456f3263e600d13ae6f3e983681bebda6
2024-01-19 09:00:35 -08:00
Joe Vilches
43d09a3a94 GitHub workflow to ensure tests are up to date (#1505)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1505

This will ensure that all tests are not modified by hand and that gentest was run if needed (i.e. someone edited those files and forgot to update the tests). Not sure if this works right now, need to export to github and see what happens :)

Reviewed By: NickGerleman

Differential Revision: D52002920

fbshipit-source-id: 1ee033eda04eeba5d01885488bfe8078e7b2f386
2023-12-14 11:48:22 -08:00
Nick Gerleman
738d04fcb0 Fix OSS JS Build (#1512)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1512

Latest revision either never got exported, or didn't block land? Fix the typo.

Reviewed By: joevilches

Differential Revision: D52087122

fbshipit-source-id: 2dfcff4925902bdd1dd210a219a78707186fd28e
2023-12-12 13:11:01 -08:00
Nick Gerleman
0d03d8a06d Manage native build toolchain (#1506)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1506

In order to build the website, you must build a Yoga binary. This usually requires installing native toolchains.

We have warning messages for these right now, but an even better solution is to just manage the dependencies ourselves. This does that, bringing in specific CMake and Ninja binaries from NPM, and caching a local copy of Emscripten during the build.

A downside is that the CMake packages are chunky, so we add 130MB to node_modules (for a repo total around 350MB). This also delays acquiring Emscripten (which is even chunkier) in CI builds until it is needed, and I added some caching for it as well.

The upside of JS users being able to run and test (inc the website) without installing and managing their own versions of toolchains is a real time-saver though, and is probably worth it.

allow-large-files

Reviewed By: yungsters

Differential Revision: D52013026

fbshipit-source-id: 3d307f751463a21c5e5d5b98b8e9e63db9d3d52e
2023-12-12 09:06:58 -08:00
Nick Gerleman
a43754266a <bit> and <concepts> (#1497)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1497

The lowest common denominator we have had for Yoga has been Clang 12 + MSVC 2017 stdlib. This has allowed Yoga to use C++ 20 language features, but not library features. React Native for mobile has not been bound to this restriction.

Builds using that toolchain are being updated to latest MSVC 2019 stdlib (which has good C++ 20 library support), along with Clang 17 (or maybe a stop at 15) pending projects using `-fcoroutines-ts` being migrated to C++ 20.

This tests out some C++ 20 standard library usages against the current Clang 12 + MSVC 2019 stdlib toolchain that didn't work before, and adds a couple concepts for better constraints/compiler error messages if misused.

This bumps min-tested XCode (and minimum required) version to 14.3, matching a similar change for React Native. This should probably be bumped to 15 sometime before Apple starts requiring 15+ to go out to the iOS app store.

We are approaching a practical support range of:
1. XCode >= 14.3
2. NDK >= 26
3. Clang/libc++ >= 14
4. GCC/libstdc++ >= 11
5. MSVC >= 16.11 (VS 2019)

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D51604487

fbshipit-source-id: d394d0d86672b69781b8ae071d87adcf944ddc72
2023-12-12 08:52:11 -08:00
Nick Gerleman
ab37ed70ae Add concurrency group for website publish (#1510)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1510

Make each workflow acquire a shared mutex so that if two commits happen close to each other, the publish order must correspond to commit order.

Reviewed By: cortinico

Differential Revision: D52031970

fbshipit-source-id: 960cd8e8f79b26ab3d9c131e0637b795618d898e
2023-12-12 07:07:56 -08:00
Nick Gerleman
8c1a672f92 GitHub Actions Cleanup (#1467)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1467

1. Avoid reusing workflow names between validation and publish jobs, since they show up with the same UI when wanting to adhoc trigger a publish.
2. Merge SwiftPM checks into Validate Apple job
3. Merge remnants of website-next workflow into website workflow (and remove a redundant explicit build step already removed in one workflow)
4. Run more validation on push to release branch
5. Do not run website validation off of main, since it is only ever deployed from main branch

Reviewed By: cipolleschi

Differential Revision: D51236885

fbshipit-source-id: dd8165aa9871f173d8914f345569c6cde1edda72
2023-11-13 03:57:52 -08:00
Nick Gerleman
6f41a27e31 "yogalayout.com" to "yogalayout.dev" (#1465)
Summary:
X-link: https://github.com/facebook/react-native/pull/41420

Pull Request resolved: https://github.com/facebook/yoga/pull/1465

https://yogalayout.com now redirects to https://yogalayout.dev

This replaces references to "yogalayout.com" with "yogalayout.dev", the same website, with a new domain. This includes:
1. Code comments
2. Yoga website config (publish action CNAME, Docusaurus config)
3. Documentation URLs in Yoga packages

Changelog:
[General][Fixed] - "yogalayout.com" to "yogalayout.dev"

Reviewed By: christophpurrer

Differential Revision: D51229587

fbshipit-source-id: b1c336a52aab5e02565071b61430d5435381dc0a
2023-11-13 02:48:29 -08:00
Nick Gerleman
92860077f9 Port more content to website-next (#1435)
Summary:
This builds upon https://github.com/facebook/yoga/pull/1433 and starts porting over and fixing some of the code in website-next.

1. Create a hero similar to current https://yogalayout.com hero
2. Start moving from `antd` and harcoded colors to [Infima](https://infima.dev/docs/getting-started/introduction/) primitives provided by Docusaurus
3. Replaced some more stock docusaurus assets, links, and text with the ones for Yoga.

There is still a lot to do here (not the least, adding real content), but it's beginning to look like a website, and is already pretty snappy. Eventually I want to get SSR working correctly with Playground, which is still a little broken in the port.

Pull Request resolved: https://github.com/facebook/yoga/pull/1435

Test Plan:
**Gatsby Original**
<img width="1795" alt="image" src="https://github.com/facebook/yoga/assets/835219/7670d53a-00a8-4146-a100-e4a05dd77488">

**New (light mode)**
<img width="800" alt="image" src="https://github.com/facebook/yoga/assets/835219/ebe11d15-5f6f-445f-bcc8-9ec51ecfac62">

**New (dark mode)**
<img width="800" alt="image" src="https://github.com/facebook/yoga/assets/835219/ca44a492-46df-410a-8303-baec3029ec49">

Reviewed By: yungsters

Differential Revision: D50523462

Pulled By: NickGerleman

fbshipit-source-id: 61b4610104f695a4e38a7d4bb6a0c2488bd6f89e
2023-11-03 05:23:56 -07:00
Nick Gerleman
b19a07cff9 Use libc++ in Ubuntu Clang Build (#1440)
Summary:
An ubuntu-latest image update caused build failures, where GTest importing chrono headers caused an error inside of stdlib++ when being compiled by Clang.

This switches to explicitly asking for libc++ (LLVM stdlib) in the reference Ubuntu Clang build instead of stdlibc++ (GCC stdlib).

We don’t force this in CMake logic, to not force a specific stdlib for users compiling Yoga alongside other libraries. E.g. https://github.com/facebookexperimental/libunifex/issues/86

Pull Request resolved: https://github.com/facebook/yoga/pull/1440

Reviewed By: joevilches

Differential Revision: D50790965

Pulled By: NickGerleman

fbshipit-source-id: fe525cfb4385a9a5ae6a02fcbc6decad0e07ff6e
2023-10-30 14:52:45 -07:00
Nick Gerleman
95a7b4497e Enable GitHub Actions Yarn Caching (#1332)
Summary:
We sometimes see workflows fail due to network flakiness, almost always being Windows agents doing a `yarn install`. This change enables storing and reusing Yarn's package cache, and makes `yarn install` more permissive when it does hit the network. https://stackoverflow.com/questions/51508364/yarn-there-appears-to-be-trouble-with-your-network-connection-retrying

Pull Request resolved: https://github.com/facebook/yoga/pull/1332

Test Plan: Workflows succeed, and we see cache being restored before yarn install step.

Reviewed By: lunaleaps

Differential Revision: D48967590

Pulled By: NickGerleman

fbshipit-source-id: 55ce6f05496f014512e0153b6646a7ca0ab964d9
2023-09-05 10:27:27 -07:00
Lvv.me
ef5784aca6 Add SwiftPM support (#1339)
Summary:
Using yoga in Swift

```swift
import UIKit
import yoga

let YGUndefined = Float.nan

UIGraphicsBeginImageContextWithOptions(CGSize(width: 1, height: 1), true, 0)
let scale = UIGraphicsGetCurrentContext()?.ctm.a ?? 1
UIGraphicsEndImageContext()

let config = YGConfigNew()
YGConfigSetUseWebDefaults(config, true)
YGConfigSetPointScaleFactor(config, Float(scale))

let root = YGNodeNewWithConfig(config)
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow)
YGNodeStyleSetFlexWrap(root, YGWrapWrap)
YGNodeStyleSetWidth(root, 200)

for i in 0..<4 {
    let leaf = YGNodeNewWithConfig(config)
    YGNodeStyleSetAspectRatio(leaf, 1)
    YGNodeStyleSetWidthPercent(leaf, 50)
    YGNodeInsertChild(root, leaf, UInt32(i))
}

YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGNodeStyleGetDirection(root))

for i in 0..<4 {
    let leaf = YGNodeGetChild(root, UInt32(i))
    let left = YGNodeLayoutGetLeft(leaf)
    let top = YGNodeLayoutGetTop(leaf)
    let width = YGNodeLayoutGetWidth(leaf)
    let height = YGNodeLayoutGetHeight(leaf)

    print("leaf \(i): origin: \(left), \(top), size: \(width), \(height)")
}

let width = YGNodeLayoutGetWidth(root)
let height = YGNodeLayoutGetHeight(root)

print("root size: \(width), \(height)")

YGNodeFreeRecursive(root)
YGConfigFree(config)
```

Pull Request resolved: https://github.com/facebook/yoga/pull/1339

Reviewed By: cipolleschi

Differential Revision: D48166958

Pulled By: NickGerleman

fbshipit-source-id: 72fef99729d01c7ba291b11f047cf75fd39f7630
2023-08-10 17:40:10 -07:00
Nick Gerleman
44507ec62e Unify ESLint and Prettier across xplat/yoga (#1335)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1335

Reviewed By: christophpurrer

Differential Revision: D47459866

fbshipit-source-id: fd6b4e4e2518d91968ac7180b32129b3f70edf88
2023-07-17 14:27:32 -07:00
Nick Gerleman
05b2edfb85 Explicit C++ toolchain on ubuntu-latest (#1334)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1334

Last change made me discover CMake on Ubuntu defaults to GCC. This change makes it so that we explicitly configure whether to use Clang/LLVM or GCC when building on machines with the `ubuntu-latest` image.

Reviewed By: christophpurrer

Differential Revision: D47462132

fbshipit-source-id: e81fb6d4b1740ab2913d39b6e90c52d674e5a4f2
2023-07-14 20:54:41 -07:00
Nick Gerleman
aa6a5d8888 Docusarus: Build validation (#1329)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1329

Add build validation for `website-next`, also adding validation that `yoga-layout/sync` may be bundled by Webpack out-of-the-box.

Reviewed By: christophpurrer

Differential Revision: D47414176

fbshipit-source-id: 9adc4f9673333f4f79c91352f445489d6da05a07
2023-07-13 14:08:07 -07:00
Nick Gerleman
7097b12b92 Remove YogaKit
Summary: We deprecated this as part of the Yoga 2.0 release. The last version is still present as part of the release-v2.0 branch, and was still published, but we are not carrying the code forward. This removes it.

Reviewed By: mdvacca

Differential Revision: D47136781

fbshipit-source-id: ac60939efb2372db04e33ed26456bad2f3b5852b
2023-07-12 12:19:27 -07:00
Nick Gerleman
1b40f05b8c Fixes for publish workflows (#1319)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1319

This fixes a few issues encountered during publishing Yoga `2.0.0-beta.1`.

1. The tag trigger was missing quotes needed to be valid syntax
2. `pod trunk publish` must be run with `--synchronous` if we are publishing a package that relies on another just published package. There does not seem to be a way to just publish evertything at once.
3. `yarn publish` was not reading the NPM auth token from the environment, so we write it to a `.npmrc` before publishing.
4. The root `.gitignore` was not updated when moving to yarn workspaces to ignore `node_modules`, so the OSS Yoga repo (not internal) will, try to add its contents after `yarn install`.

Reviewed By: cortinico

Differential Revision: D47135994

fbshipit-source-id: d8c9b05176a98443be1ebc7cf74996f22520d20d
2023-06-30 11:44:15 -07:00
Nicola Corti
cdc3328ca5 Actually hit Maven Central when publishing tags
Summary:
Due to a copypasta error, the tags will keep on publishing to the snapshot repo.
I've updated the config to actually hit Maven Central.

Reviewed By: NickGerleman

Differential Revision: D47150549

fbshipit-source-id: 314b931c1c9203ef53e1433a88bcc00609abd3d0
2023-06-30 11:39:09 -07:00
Nick Gerleman
506027925d Add publish workflows for npmjs and CocoaPods (#1316)
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
2023-06-28 13:54:03 -07:00
Nick Gerleman
0294373929 Add yarn pack validation (#1315)
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
2023-06-28 02:21:05 -07:00
Nicola Corti
36e491754f Setup publishing for Yoga stables
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
2023-06-08 02:23:48 -07:00
Nicola Corti
a2832f4d55 Use the correct secrets for snapshot publishing
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
2023-06-08 01:51:30 -07:00
Nick Gerleman
4fc1657f2c Basic CocoaPods Validation (#1303)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1303

This gets `pod lib lint` and building the sample app with xcbuild passing (using https://github.com/facebook/yoga/pull/1105 as a template).

Reviewed By: cipolleschi

Differential Revision: D46470738

fbshipit-source-id: f66f6c6efc1b7cf1443fbca0815a24801c16a626
2023-06-06 14:56:44 -07:00
Nicola Corti
1ab0c7b493 Add a Github Action to publish SNAPSHOTS after every commit.
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
2023-05-31 15:22:21 -07:00
Nicola Corti
54d78926ce AGP to 8.0.1 (#1280)
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
2023-05-05 04:07:40 -07:00
Nick Gerleman
cac197f5a6 Colorize GTest Output in GitHub Actions (#1218)
Summary:
GitHub actions supports terminal colors, but most programs won't output color to a non-interactive terminal. We can control this via env variable, so that GTest output in GitHub actions is colorized.

Before:
{F847577544}

After:
{F847577610}

Pull Request resolved: https://github.com/facebook/yoga/pull/1218

Reviewed By: christophpurrer

Differential Revision: D42537630

Pulled By: NickGerleman

fbshipit-source-id: 28b22c061200026bf167c1a31d6a58445ba70214
2023-01-16 13:06:45 -08:00
Nick Gerleman
83c6997f29 Add Global CMake Build and OSS Tests (#1217)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1217

This updates the CMake build present for being able to share options, fixing up flags, etc. A GTest build is added as well, along with a script and VSCode debug target so that OSS contributors can very easily run and debug tests on any OS.

Note that this isn't completely done (need to revise Windows, Mac, documentation), but should be finished enough otherwise for review.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D42406686

fbshipit-source-id: 95e7ba5e4751c496a171785490e85cf0097fa839
2023-01-16 07:56:11 -08:00
Nick Gerleman
53872e2521 Update Gradle Setup (#1215)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1215

This updates:
1. The Gradle Wrapper and Gradle Version
2. AGP Version
3. Android SDK and NDK Versions
4. Java Version (to support newer AGP)
5. Required CMake Version

Versions are loosely aligned to RN. CMake 3.18.1 is the latest provided by the NDK but the Android build itself creates warnings on CMake < 3.19, so we add the "+" to prefer something newer if available (but we set an old required version to CMake policy will keep compatible).

This also removes the "yogacore" project, which packages libyoga.so without the jni bindings. Afaik it was never published, and we don't rely on it ourselves.

Reviewed By: cortinico

Differential Revision: D42406551

fbshipit-source-id: 5e127dffde69352269ecbddadbc2bdd82f7d50fa
2023-01-16 04:16:07 -08:00
Dmitry Ivakhnenko
1813748eaa Revive JavaScript Bindings (#1177)
Summary:
Yoga's JavaScript bindings do not work past Node 10, or on recent versions of Ubuntu even using it. This is due to a reliance on `nbind`, a library which is no longer maintained. `nbind` itself abstracts over `embind` running Emscripten to generate an asm.js build, along with building Node native modules. In the meantime, [yoga-layout-prebuilt](https://www.npmjs.com/package/yoga-layout-prebuilt) has been used by the community instead of the official package.

https://github.com/facebook/yoga/pull/1177 was contributed as a conversion of bindings created using `nbind` to instead use `embind` directly.

I continued building on this to add more:
1. WebAssembly support (required to be async in browsers)
2. CMake + Ninja Build for the 4 flavors
3. TypeScript typings (partially generated)
4. yarn scripts to build (working on macOS, Ubuntu, Windows)
5. A README with some usage and contribution instructions
6. Updated tests to work with Jest, and updated general infra
7. ESLint and clang-format scripts
8. More GitHub actions (and now testing Windows)
9. Probably more I kinda got carried away here lol

The plan is to eventually publish this to NPM, but there is a little bit of work after this before that happens.

Pull Request resolved: https://github.com/facebook/yoga/pull/1177

Test Plan: The bindings pass Jest tests (both manual and generated). GitHub actions added for the different yarn scripts. Did some manual checks on using the library as TS.

Reviewed By: christophpurrer

Differential Revision: D42207782

Pulled By: NickGerleman

fbshipit-source-id: 1dc5ce440f1c2b9705a005bbdcc86f952785d94e
2022-12-28 01:27:12 -08:00
Nick Gerleman
35f3335efc Fix yg_positionType ordinals (#1183)
Summary:
Fixes https://github.com/facebook/yoga/issues/1179

fc88b2f774 shifted ordinals for the position enum, but only updated a limited set of code for the new values. Binding generation has since been fixed, but https://github.com/facebook/yoga/issues/1179 seems to be another case where the ordinal offsetting means that `yg_positionType` of a `YogaLayout` view does not work correctly.

Update the ordinals in accordance with the ordering in YogaPositionType which the integer value is converted to.

Using "static" (the new position type) directly gives a compilation error due to it being a reserved keyword, so I added it as "position_static" along with aliases to other properties with the same naming scheme for consistency.

Pull Request resolved: https://github.com/facebook/yoga/pull/1183

Reviewed By: lunaleaps

Differential Revision: D41741955

Pulled By: NickGerleman

fbshipit-source-id: 2b035eb38d9efea19af652e5f05c02b0be402d54
2022-12-06 08:39:20 -08:00
Nick Gerleman
811b46ae63 Refine workflow push trigger (#1182)
Summary:
We run validation workflows on push, but we do this for every branch, so dependabot PRs run every validation twice. We only really want push validation for the main branch.

Pull Request resolved: https://github.com/facebook/yoga/pull/1182

Test Plan: PRs still run

Reviewed By: cortinico

Differential Revision: D41741459

Pulled By: NickGerleman

fbshipit-source-id: 51abe2cc0c8c5b9c3fc8c8a20a585c9d5e868a5e
2022-12-06 07:51:12 -08:00
Nick Gerleman
5498d3ad61 Pin website workflows to ubuntu-20.04 (#1181)
Summary:
The website build started failing with what looks like an incompatibility between nbind and a new libc++ version. GithHub is rolling out a new Ubuntu image, which is the likely culprit.

Pin to an older version of Ubuntu since nbind will never be updated, and we haven't replaced it yet.

Pull Request resolved: https://github.com/facebook/yoga/pull/1181

Test Plan: Website build works again in GitHub workflows

Reviewed By: cortinico

Differential Revision: D41741067

Pulled By: NickGerleman

fbshipit-source-id: 1171e3d7461568d1c76afab0c5a12899e3d5958e
2022-12-06 01:39:05 -08:00
Nick Gerleman
e9184c793e Start Adding GitHub Actions (#1165)
Summary:
This change starts adding more coverage to GitHub Actions. Existing workflows are split up to be per-platform, and stale scripts, etc are removed.

We are currently limited a bit by issues with the build itself, but this still adds a good bit of coverage that readily works, and adds places to inject more.

Another option would have been to move these to CircleCI where we have more credits, or used docker images instead of manual setup steps. etc, The Yoga build and number of changes is very light though, so we don't really need the complexity yet.

Some TODOs:
1. Fix the Apple Builds (pod lint and pod install return errors seen by the community)
2. Add working Android UTs
3. Add C++ UTs
4. Add Apple Publish
5. Add version stamping

Changelog:
[Internal][Added] - Start Adding Yoga GitHub Actions

Pull Request resolved: https://github.com/facebook/yoga/pull/1165

Reviewed By: cortinico

Differential Revision: D40386426

Pulled By: NickGerleman

fbshipit-source-id: c540dd25bfec6ac8c05e461c1236ef7fe6cb8598
2022-10-17 23:35:01 -07:00
Nick Gerleman
80c89a48a1 Move GitHub Actions from Node 8 to Node 12 (#1164)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1164

Yoga CI in GitHub is currently running using Node 8, released in 2017. It has long been out of support, and is not able to install many of the packages in the updated lockfile due to version restrictions in the new packages.

Node 12 is able to install the current lockfile. Although it is old enough that security support has ended for it 5 months ago, `yoga-layout` currently fails to install on Node 12+, because a dependency, `nbind`, was reliant on V8 internals that have changed between versions, and has not published a version supporting anything later than Node 10.

There are unpublished commits in the official repo which add Node 12 support. So, we use that version when developing against the website, to jump us to something more up to date, without rewriting or removing all of the JS bindings quite yet.

Reviewed By: yungsters

Differential Revision: D40036466

fbshipit-source-id: e1b775d87854250bd74fa17ca7ba939b32aa3bd8
2022-10-03 18:17:23 -07:00
Pascal Hartig
5c3837f5f3 Default branch renames (#1102)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1102

Test Plan: _eyes

Reviewed By: timur-valiev

Differential Revision: D30302214

Pulled By: passy

fbshipit-source-id: 5b232136c20553883e148d10c99f9e73b8f36757
2021-08-13 08:24:14 -07:00
Pascal Hartig
f03129728f Disable snapshot publishing (#1089)
Summary:
Currently broken. Will reenable this separately.

Pull Request resolved: https://github.com/facebook/yoga/pull/1089

Reviewed By: mweststrate

Differential Revision: D28609885

Pulled By: passy

fbshipit-source-id: 380359d09ee96d321d49c6440bde358c3e791c1a
2021-05-23 11:38:27 -07:00
Pascal Hartig
8a65d8b6dc Release GitHub actions workflow (#1088)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1088

Reviewed By: mweststrate

Differential Revision: D28604872

Pulled By: passy

fbshipit-source-id: e77578d44557420be9b782dc90f047af697b7cb9
2021-05-21 11:41:13 -07:00
Pascal Hartig
13e079e8f3 Upgrade Gradle setup (#1084)
Summary:
Trying to dust off the build setup and make it work again with a modern Android Studio / JVM.

Removing all JCenter setup, too, as this is no longer supported.

Pull Request resolved: https://github.com/facebook/yoga/pull/1084

Test Plan:
`./gradlew :yoga-layout:assembleDebug` works already.
Looking if CI here likes this.

Reviewed By: mweststrate

Differential Revision: D28602272

Pulled By: passy

fbshipit-source-id: 0cb86f548cc6366ccefcc92c185d6e7772e75547
2021-05-21 11:15:18 -07:00
Pascal Hartig
508f4eacdf Fix env setting and Android setup (#1085)
Summary:
*Context: The Yoga OSS build has not been given a lot of attention over the past couple of years and is in serious disrepair. I'll try to get the release pipeline going again to publish to Maven Central as JCenter is shutting down. A bunch of intermediate commits may still have broken builds but will be inching closer to a working one.*

The current way env variables are set is no longer supported for security reasons: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/. The manual Android setup is also quite tricky to maintain and can mostly be done through GitHub Actions itself.

Please note that the actual build is still failing but that's because we're so far behind with the setup here that the Gradle version no longer works on a modern JVM. I'll fix that in subsequent diffs.

Pull Request resolved: https://github.com/facebook/yoga/pull/1085

Test Plan: CI

Reviewed By: mweststrate

Differential Revision: D28602084

Pulled By: passy

fbshipit-source-id: e334ed92d16a9baa185a84b23bb62801399e5650
2021-05-21 10:11:37 -07:00
Jon Janzen
4135420cba Fix GitHub Actions secrets access (#1005)
Summary:
Ref: [Secrets documentation](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#using-encrypted-secrets-in-a-workflow)

In combination with setting the secrets in the GitHub settings, this should fully migrate yoga to GH actions.

Pull Request resolved: https://github.com/facebook/yoga/pull/1005

Test Plan: GitHub Actions CI on the PR attached to this diff

Reviewed By: SidharthGuglani

Differential Revision: D21574995

Pulled By: bigfootjon

fbshipit-source-id: e9ee6d7cf1ae131afdc3aa3778667f1e9b9de833
2020-05-14 12:21:28 -07:00
Jon Janzen
ac7c85c0a6 Migrate CI from TravisCI to GitHub Actions (#1004)
Summary:
Migrate from TravisCI to GitHub Actions. Facebook employees can read about this migration [here](https://fburl.com/rfp033ou).

CC: wittgenst
Pull Request resolved: https://github.com/facebook/yoga/pull/1004

Test Plan: GitHub Actions CI on my personal GitHub: https://github.com/bigfootjon/yoga/runs/653755729

Reviewed By: passy

Differential Revision: D21431309

Pulled By: bigfootjon

fbshipit-source-id: 490a8679bc0cfec26b13c8c584a928f03c6e26e7
2020-05-12 12:01:53 -07:00
Dustin Shahidehpour
7b36118df4 Add issue template.
Summary: When people file issues, they are (in-general) missing a lot of useful information. This template will now be included when people file issues. More info here: https://github.com/blog/2111-issue-and-pull-request-templates

Reviewed By: emilsjolander

Differential Revision: D4481713

fbshipit-source-id: 8c173e282438d5156d50fe40c581e18730d6a5af
2017-01-30 07:39:38 -08:00