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
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
da3d65e
Restructure the C# bindings for Yoga to be based on .NET Standard 2.0…
jkoritzinsky Dec 27, 2022
3311ec0
Remove usages of YogaNode.GetInstanceCount
jkoritzinsky Dec 29, 2022
e38554a
Merge branch 'main' of github.com:facebook/yoga into csharp-refresh
jkoritzinsky Dec 29, 2022
4a2d8a9
Update to v143 toolset and make library always compile as a DLL. Set …
jkoritzinsky Jan 3, 2023
3d4eed2
Create new sln file
jkoritzinsky Jan 5, 2023
9ec47c2
Move the C++ build for the .NET packages over to a rudimentary CMake …
jkoritzinsky Jan 5, 2023
7a2f5ad
Add GitHub workflow and enable linux-x64 build
jkoritzinsky Jan 5, 2023
763ebb2
Fix indentation
jkoritzinsky Jan 5, 2023
26150b5
Install workloads and fix Build Native Components to actually build o…
jkoritzinsky Jan 7, 2023
9d213ed
Apply suggestions from code review
jkoritzinsky Jan 7, 2023
6e57851
Refactor C# setup steps into separate action
jkoritzinsky Jan 7, 2023
33a7ab0
Apply suggestions from code review
jkoritzinsky Jan 7, 2023
fb1bd56
Specify package license expression
jkoritzinsky Jan 7, 2023
aa8be68
Update .github/actions/setup-cs/action.yml
NickGerleman Jan 7, 2023
5865969
Update csharp/Yoga/CMakeLists.txt
NickGerleman Jan 7, 2023
caa77f3
Apply suggestions from code review
NickGerleman Jan 7, 2023
7540adb
Fix path for Facebook.YogaKit.Tests.csproj reference to native tools
jkoritzinsky Jan 7, 2023
c04e454
Use primarily osx and windows as the build machines for C# as that's …
jkoritzinsky Jan 7, 2023
1ebb3c4
Remove net6.0-ios target for Facebook.Yoga.csproj and shift to using …
jkoritzinsky Jan 8, 2023
eaa081d
Add global.json to scope the .NET SDK discovery behavior to the SDK v…
jkoritzinsky Jan 8, 2023
bb3979c
Remove stale files
NickGerleman Jan 8, 2023
85a7ef2
Merge branch 'csharp-refresh' of https://github.com/jkoritzinsky/yoga…
NickGerleman Jan 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion csharp/Android/.gitignore

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions csharp/Android/Facebook.Yoga.Android.Tests/MainActivity.cs

This file was deleted.

This file was deleted.

Empty file.
33 changes: 0 additions & 33 deletions csharp/Android/Facebook.Yoga.Android.sln

This file was deleted.

20 changes: 0 additions & 20 deletions csharp/Android/Facebook.Yoga.Android/CustomBuildAction.targets

This file was deleted.

64 changes: 0 additions & 64 deletions csharp/Android/Facebook.Yoga.Android/Facebook.Yoga.Android.csproj

This file was deleted.

Empty file.
45 changes: 0 additions & 45 deletions csharp/Facebook.Yoga/Facebook.Yoga.Shared.projitems

This file was deleted.

13 changes: 0 additions & 13 deletions csharp/Facebook.Yoga/Facebook.Yoga.Shared.shproj

This file was deleted.

5 changes: 5 additions & 0 deletions csharp/Facebook.Yoga/Facebook.Yoga.csproj
@@ -0,0 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0-ios</TargetFrameworks>
</PropertyGroup>
</Project>
27 changes: 27 additions & 0 deletions csharp/Facebook.Yoga/MonoPInvokeCallbackAttribute.cs
@@ -0,0 +1,27 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
using System;

namespace Facebook.Yoga
{
// This attribute is recognized by the Mono AOT compiler by name
// and indicates that marshalling information must be generated for
// the attributed method as if it is marshalled with the provided delegate
// type to unmanaged code.
// We define our own copy to avoid having to conditionally build this project for
// iOS and Unity.
[System.AttributeUsage(System.AttributeTargets.Method)]
internal sealed class MonoPInvokeCallbackAttribute : System.Attribute
{
public MonoPInvokeCallbackAttribute(Type t)
{
DelegateType = t;
}

public Type DelegateType { get; set; }
}
}
4 changes: 3 additions & 1 deletion csharp/Facebook.Yoga/Native.cs
Expand Up @@ -12,7 +12,9 @@ namespace Facebook.Yoga
{
internal static class Native
{
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
// Unity package references work via embedded source with their custom package format,
// so these Unity-specific defines will work.
#if (UNITY_IOS && !UNITY_EDITOR) || IOS
private const string DllName = "__Internal";
#else
private const string DllName = "yoga";
Expand Down
9 changes: 0 additions & 9 deletions csharp/Facebook.Yoga/YogaConfig.cs
Expand Up @@ -8,13 +8,6 @@
using System;
using System.Runtime.InteropServices;

#if __IOS__
using ObjCRuntime;
#endif
#if ENABLE_IL2CPP
using AOT;
#endif

namespace Facebook.Yoga
{
public class YogaConfig
Expand Down Expand Up @@ -54,9 +47,7 @@ internal YGConfigHandle Handle
}
}

#if (UNITY_IOS && !UNITY_EDITOR) || ENABLE_IL2CPP || __IOS__
[MonoPInvokeCallback(typeof(YogaLogger))]
#endif
private static void LoggerInternal(
IntPtr unmanagedConfigPtr,
IntPtr unmanagedNodePtr,
Expand Down
11 changes: 0 additions & 11 deletions csharp/Facebook.Yoga/YogaNode.cs
Expand Up @@ -11,13 +11,6 @@
using System.Runtime.InteropServices;
using System.Text;

#if __IOS__
using ObjCRuntime;
#endif
#if ENABLE_IL2CPP
using AOT;
#endif

namespace Facebook.Yoga
{
public partial class YogaNode : IEnumerable<YogaNode>
Expand Down Expand Up @@ -656,9 +649,7 @@ public void SetBaselineFunction(BaselineFunction baselineFunction)
Native.YGNodeStyleGetDirection(_ygNode));
}

#if (UNITY_IOS && !UNITY_EDITOR) || ENABLE_IL2CPP || __IOS__
[MonoPInvokeCallback(typeof(YogaMeasureFunc))]
#endif
private static YogaSize MeasureInternal(
IntPtr unmanagedNodePtr,
float width,
Expand All @@ -674,9 +665,7 @@ public void SetBaselineFunction(BaselineFunction baselineFunction)
return node._measureFunction(node, width, widthMode, height, heightMode);
}

#if (UNITY_IOS && !UNITY_EDITOR) || ENABLE_IL2CPP || __IOS__
[MonoPInvokeCallback(typeof(YogaBaselineFunc))]
#endif
private static float BaselineInternal(
IntPtr unmanagedNodePtr,
float width,
Expand Down