Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure the C# bindings for Yoga to be based on .NET Standard 2.0 and the new .NET 6.0+ target platform work. #1207

Closed
wants to merge 22 commits into from

Conversation

jkoritzinsky
Copy link

Updated the C# bindings to build using the new simplified .NET SDK tooling. The C# projection now builds for .NET Standard 2.0 (to support Unity, .NET Framework, UWP, and modern .NET) and .NET 6.0 for iOS (to have the native calls correctly support calling into a statically-linked library).

The native changes were needed to get the C# tests passing on Windows x64 (tested locally).

This PR does not update any build, test, or package scripts. I can either add that to this PR or follow up with another PR.

@facebook-github-bot
Copy link
Contributor

Hi @jkoritzinsky!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Copy link
Contributor

@NickGerleman NickGerleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great stuff! Very excited to see the C# bindings work again.

Would be good to clean up some of the dead project configuration around here. E.g. looking at the new source tree, I can see a Xamarin sln referencing folders no longer present, along with a non-vcxproj build script that doesn't work/I'm guessing is no longer used.

I can see there is updated code for Mono binding to YogaKit on iOS. From what I can tell the previous iOS build used that build script instead of depending on the vcxproj. Will those non-Windows builds still work? If not I would reccomend removing as well (I'm okay losing parity if we get something presently working and maintainable in return).

I think we should add some Github workflows here to excersise any builds/NUnit tests which are working, for the matrix we want to support. My preference would be to do that as part of the change, so we can demonstrate everything is working. The recent "validate-js.yml" workflow should be relatively pattern matchable but I can also help with this, given the permutations we want to support.

csharp/Yoga/Yoga.vcxproj Outdated Show resolved Hide resolved
@NickGerleman
Copy link
Contributor

Also feel free to ignore the JavaScript linting failure. Made a change internally without realizing Prettier wasn't turned on for Yoga in internal validation. Working on fixing that up soon so it won't happen again.

@jkoritzinsky
Copy link
Author

I've added a build and test GitHub Action at the .github/workflows/validate-csharp.yml path. It will validate the build, package, and test steps for windows-x64 and linux-x64 on Ubuntu. The linux build should probably build against an older version of glibc to make it more usable across linux distributions, but at least for now my main goal was getting something working.

@jkoritzinsky
Copy link
Author

I haven't hooked up testing for iOS yet as I'm not familiar enough with GitHub actions to know the best way to run tests against an iOS simulator or device.

@NickGerleman
Copy link
Contributor

The linux build should probably build against an older version of glibc to make it more usable across linux distributions, but at least for now my main goal was getting something working.

I looked into that a bit for the CMake change I'm working on. Right now the repo is keeping things simple, with the GitHub hosted/managed runners. The oldest LTS Ubuntu supports is 18.04, with GCC 6. but GitHub only supports back to 20.04.

Ideas were:

  1. Select different toolchain versions on top of a current install
  2. Convert the setup-xxx.yaml files into a Dockerfile and start building our own images ala https://github.com/marketplace/actions/build-and-push-docker-images

There is lower hanging fruit though, so it's not worth thinking about too much yet.

.github/workflows/validate-csharp.yml Outdated Show resolved Hide resolved
.github/workflows/validate-csharp.yml Outdated Show resolved Hide resolved
.github/workflows/validate-csharp.yml Show resolved Hide resolved
csharp/Facebook.Yoga/Facebook.Yoga.csproj Outdated Show resolved Hide resolved
csharp/Yoga/CMakeLists.txt Outdated Show resolved Hide resolved
csharp/Yoga/CMakeLists.txt Outdated Show resolved Hide resolved
csharp/Yoga/CMakeLists.txt Outdated Show resolved Hide resolved
csharp/Yoga/CMakeLists.txt Show resolved Hide resolved
csharp/Facebook.Yoga/Facebook.Yoga.csproj Show resolved Hide resolved
jkoritzinsky and others added 4 commits January 6, 2023 21:24
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 26, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: D45297676

fbshipit-source-id: 77df49f7ffe17e177db8a39e8322124058353e23
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 26, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: 9e7bd1bcce979acb6bb7abb8dc9c46416c5c3725
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: c622865232689e7cda48ec5cd566ee906962444c
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 1ec7cb1f15773efdb46669db0ebf6fc5d6b759b6
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: aa03d1a31602051d3d2514f6fc8a7a3db5bea262
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 4a7ad17192ed8d4b779b10ad834644194111b96c
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: db461b0203200b9db425f4ddebcc1798477e9cde
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 5f20e0a9865d33ba4974e03d365f11fae816087c
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 63f7c3b7c2e7a97d7bba12f62d9e448c8aaee538
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: 4535de6ba97f8ea87141b3a8dcd6dbb174555ec2
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: fcbbe4e3a1cd6ed02fee25c169d892b68c95e667
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 171c6aa3699802e51e5e12025acce854e13c7402
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: d9b9949705c8654fe2705429442affd5fa4cb0c8
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: d8a455686c5a1063e7047a7a511fd70714f8b013
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 324ebfdd8ba82813aab4816236b33f6bce7b3c26
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: fb27513efa119065a7607ae7738b3060ba098ea3
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: 3b94a7f4ec663693d686e3321ec9aa06e7cd12ca
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 4a308833fc86b0fac8e2d8a04ca9fd08df4e35cd
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: cf9246f5c223096dcb587bd2537016ef1100b248
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: facebook#1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: 10cfb71a6220e4c7a6fc15032cd74033d4472f4b
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 07ca3b5c0509f18ad825029804b68ccb5c4e5522
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Apr 27, 2023
Summary: Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](facebook#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Differential Revision: https://internalfb.com/D45297676

fbshipit-source-id: 113377d2577360d53d9bc7594322fbbcf91cd55d
facebook-github-bot pushed a commit that referenced this pull request Apr 27, 2023
Summary:
Pull Request resolved: #1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](#1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: 408f84d74ebbc7698407e951e831627117cbc2ed
@NickGerleman
Copy link
Contributor

@jkoritzinsky what do you think about merging this as-is? I think it is going to be a better reference than what we have right now, and we can leave tests disabled in the meantime.

@jkoritzinsky
Copy link
Author

I'm fine merging this as-is. I haven't had time to investigate the test failures.

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Jun 4, 2023
Summary:
These C# bindings were contributed as part of facebook@ff8f17a. 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 facebook#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. Unity-Technologies/UnityCsReference@016297e#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.

Differential Revision: D46425886

fbshipit-source-id: 422abc0681bf02e1ebf1ba305efa3936e063c7e1
facebook-github-bot pushed a commit that referenced this pull request Jun 5, 2023
Summary:
Pull Request resolved: #1302

These C# bindings were contributed as part of ff8f17a. 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 #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. Unity-Technologies/UnityCsReference@016297e#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
@NickGerleman
Copy link
Contributor

Talking offline, we decided to go a separate route, of removing the bindings from being in tree. This was commited with 5e74e20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants