From 17826467234813f79c25c123af268624e0533673 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Tue, 10 Jan 2017 06:26:45 -0800 Subject: [PATCH 1/8] Update aspect ratio documentation to match changes recently made Summary: Fixes #313 https://github.com/facebook/yoga/issues/313 Reviewed By: gkassabli Differential Revision: D4397691 fbshipit-source-id: 29daabe9a4bbde3f330e952ca5e644c7cfdbcccf --- docs/_docs/yoga/aspect-ratio.md | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/docs/_docs/yoga/aspect-ratio.md b/docs/_docs/yoga/aspect-ratio.md index 4aa23e71..8b9ea662 100644 --- a/docs/_docs/yoga/aspect-ratio.md +++ b/docs/_docs/yoga/aspect-ratio.md @@ -5,32 +5,30 @@ layout: docs permalink: /docs/aspect-ratio/ --- -`AspectRatio` is a property introduced by Yoga. `AspectRatio` solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. `AspectRatio` accepts any floating point value > 0, the default is undefined. `AspectRatio` can apply to either the width or the height of an item, it depends on which dimension is fixed. `AspectRatio` Also respects the `Min` and `Max` dimensions of an item. +`AspectRatio` is a property introduced by Yoga. `AspectRatio` solves the problem of knowing one dimension of an element and an aspect ratio, this is very common when it comes to videos, images, and other media types. `AspectRatio` accepts any floating point value > 0, the default is undefined. -- If an item has a `Width` set then `AspectRatio` controls the item's height. -- If an item has a `Height` set then `AspectRatio` controls the item's width. -- If an item has a `FlexBasis` set then `AspectRatio` controls the item's cross axis dimension. -- If an item's alignment is `Stretch` and its main axis is undefined then `AspectRatio` controls the item's main axis dimension. -- If an item has `FlexGrow` or `FlexShrink` set then `AspectRatio` controls the item's cross axis dimension if it is undefined. -- If both dimensions of an item are fixed then `AspectRatio` is ignored. +- `AspectRatio` is defined as the ratio between the width and the height of a node e.g. if a node has an aspect ratio of 2 then its width is twice the size of its height. +- `AspectRatio` respects the `Min` and `Max` dimensions of an item. +- `AspectRatio` has higher priority than `FlexGrow` +- If `AspectRatio`, `Width`, and `Height` are set then the cross dimension is overridden. #### Width = 100; AspectRatio = 2; -
-
-
-
-
- -#### Width = 100; AspectRatio = 0.5; -
-#### FlexDirection = Row; FlexGrow = 1; AspectRatio = 0.5; +#### Width = 100; AspectRatio = 0.5; + +
+
+
+
+
+ +#### FlexDirection = Row; FlexGrow = 1; AspectRatio = 2;
From c04604dbc09e4faf1c58e0b4581d07f6fecd1928 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Tue, 10 Jan 2017 07:03:56 -0800 Subject: [PATCH 2/8] Implement java bindings for custom baseline function Summary: Implement java bindings for custom baseline function Differential Revision: D4392516 fbshipit-source-id: 39cf6066f8e5982268becd87e54c9ab51fbf7a90 --- .../facebook/yoga/YogaBaselineFunction.java | 22 ++++++++++++++ java/com/facebook/yoga/YogaNode.java | 13 +++++++++ java/com/facebook/yoga/YogaNodeAPI.java | 1 + java/jni/YGJNI.cpp | 13 +++++++++ .../tests/com/facebook/yoga/YogaNodeTest.java | 29 +++++++++++++++++++ 5 files changed, 78 insertions(+) create mode 100644 java/com/facebook/yoga/YogaBaselineFunction.java diff --git a/java/com/facebook/yoga/YogaBaselineFunction.java b/java/com/facebook/yoga/YogaBaselineFunction.java new file mode 100644 index 00000000..1bfb52a7 --- /dev/null +++ b/java/com/facebook/yoga/YogaBaselineFunction.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.yoga; + +import com.facebook.proguard.annotations.DoNotStrip; + +@DoNotStrip +public interface YogaBaselineFunction { + /** + * Return the baseline of the node in pixels. When no baseline function is set the baseline + * default to the computed height of the node. + */ + @DoNotStrip + float baseline(YogaNodeAPI node, float width, float height); +} diff --git a/java/com/facebook/yoga/YogaNode.java b/java/com/facebook/yoga/YogaNode.java index 87b22985..432c2040 100644 --- a/java/com/facebook/yoga/YogaNode.java +++ b/java/com/facebook/yoga/YogaNode.java @@ -52,6 +52,7 @@ public class YogaNode implements YogaNodeAPI { private YogaNode mParent; private List mChildren; private YogaMeasureFunction mMeasureFunction; + private YogaBaselineFunction mBaselineFunction; private long mNativePointer; private Object mData; @@ -623,6 +624,18 @@ public class YogaNode implements YogaNodeAPI { YogaMeasureMode.values()[heightMode]); } + private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc); + @Override + public void setBaselineFunction(YogaBaselineFunction baselineFunction) { + mBaselineFunction = baselineFunction; + jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null); + } + + @DoNotStrip + public final float baseline(float width, float height) { + return mBaselineFunction.baseline(this, width, height); + } + @Override public boolean isMeasureDefined() { return mMeasureFunction != null; diff --git a/java/com/facebook/yoga/YogaNodeAPI.java b/java/com/facebook/yoga/YogaNodeAPI.java index 98742d34..6d782c45 100644 --- a/java/com/facebook/yoga/YogaNodeAPI.java +++ b/java/com/facebook/yoga/YogaNodeAPI.java @@ -18,6 +18,7 @@ public interface YogaNodeAPI { YogaNodeType getParent(); int indexOf(YogaNodeType child); void setMeasureFunction(YogaMeasureFunction measureFunction); + void setBaselineFunction(YogaBaselineFunction measureFunction); boolean isMeasureDefined(); void calculateLayout(); boolean isDirty(); diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index 46aaecfb..54610dba 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -63,6 +63,14 @@ static void YGPrint(YGNodeRef node) { } } +static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) { + if (auto obj = YGNodeJobject(node)->lockLocal()) { + return findClassLocal("com/facebook/yoga/YogaNode")->getMethod("baseline")(obj, width, height); + } else { + return height; + } +} + static YGSize YGJNIMeasureFunc(YGNodeRef node, float width, YGMeasureMode widthMode, @@ -203,6 +211,10 @@ void jni_YGNodeSetHasMeasureFunc(alias_ref, jlong nativePointer, jboole YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL); } +void jni_YGNodeSetHasBaselineFunc(alias_ref, jlong nativePointer, jboolean hasBaselineFunc) { + YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer), hasBaselineFunc ? YGJNIBaselineFunc : NULL); +} + jboolean jni_YGNodeHasNewLayout(alias_ref, jlong nativePointer) { return (jboolean) YGNodeGetHasNewLayout(_jlong2YGNodeRef(nativePointer)); } @@ -332,6 +344,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) { YGMakeNativeMethod(jni_YGNodeIsDirty), YGMakeNativeMethod(jni_YGNodeMarkLayoutSeen), YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc), + YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc), YGMakeNativeMethod(jni_YGNodeCopyStyle), YGMakeNativeMethod(jni_YGNodeStyleGetDirection), YGMakeNativeMethod(jni_YGNodeStyleSetDirection), diff --git a/java/tests/com/facebook/yoga/YogaNodeTest.java b/java/tests/com/facebook/yoga/YogaNodeTest.java index ddec8cff..53104dfb 100644 --- a/java/tests/com/facebook/yoga/YogaNodeTest.java +++ b/java/tests/com/facebook/yoga/YogaNodeTest.java @@ -23,6 +23,35 @@ public class YogaNodeTest { assertEquals(refCount + 1, YogaNode.jni_YGNodeGetInstanceCount()); } + @Test + public void testBaseline() { + final YogaNode root = new YogaNode(); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setAlignItems(YogaAlign.BASELINE); + root.setWidth(100); + root.setHeight(100); + + final YogaNode child1 = new YogaNode(); + child1.setWidth(40); + child1.setHeight(40); + root.addChildAt(child1, 0); + + final YogaNode child2 = new YogaNode(); + child2.setWidth(40); + child2.setHeight(40); + child2.setBaselineFunction(new YogaBaselineFunction() { + public float baseline(YogaNodeAPI node, float width, float height) { + return 0; + } + }); + root.addChildAt(child2, 1); + + root.calculateLayout(); + + assertEquals(0, (int) child1.getLayoutY()); + assertEquals(40, (int) child2.getLayoutY()); + } + @Test public void testMeasure() { final YogaNode node = new YogaNode(); From e39f13a8ea9e6b3a81284874f75c3255fcdcec8f Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Tue, 10 Jan 2017 08:26:50 -0800 Subject: [PATCH 3/8] Allow aspect ratio to expand beyond bounds of parent Summary: Allow aspect ratio to expand beyond bounds of parent as is generally accepted in css Reviewed By: passy Differential Revision: D4397547 fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f --- tests/YGAspectRatioTest.cpp | 21 +++++++++++++++++++++ yoga/Yoga.c | 14 ++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/YGAspectRatioTest.cpp b/tests/YGAspectRatioTest.cpp index b6e32de2..cc9626ad 100644 --- a/tests/YGAspectRatioTest.cpp +++ b/tests/YGAspectRatioTest.cpp @@ -676,3 +676,24 @@ TEST(YogaTest, aspect_ratio_height_overrides_align_stretch_column) { YGNodeFreeRecursive(root); } + +TEST(YogaTest, aspect_ratio_allow_child_overflow_parent_size) { + const YGNodeRef root = YGNodeNew(); + YGNodeStyleSetAlignItems(root, YGAlignFlexStart); + YGNodeStyleSetWidth(root, 100); + + const YGNodeRef root_child0 = YGNodeNew(); + YGNodeStyleSetHeight(root_child0, 50); + YGNodeStyleSetAspectRatio(root_child0, 4); + YGNodeInsertChild(root, root_child0, 0); + + YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_EQ(100, YGNodeLayoutGetWidth(root)); + ASSERT_EQ(50, YGNodeLayoutGetHeight(root)); + + ASSERT_EQ(200, YGNodeLayoutGetWidth(root_child0)); + ASSERT_EQ(50, YGNodeLayoutGetHeight(root_child0)); + + YGNodeFreeRecursive(root); +} diff --git a/yoga/Yoga.c b/yoga/Yoga.c index d5e4917b..0e7bec47 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -2239,8 +2239,11 @@ static void YGNodelayoutImpl(const YGNodeRef node, availableInnerWidth)); childHeightMeasureMode = YGMeasureModeExactly; - childHeight = fminf(childHeight, availableInnerHeight); - childWidth = childHeight * currentRelativeChild->style.aspectRatio; + // Parent size constraint should have higher priority than flex + if (YGNodeIsFlex(currentRelativeChild)) { + childHeight = fminf(childHeight, availableInnerHeight); + childWidth = childHeight * currentRelativeChild->style.aspectRatio; + } } else { childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio, YGNodePaddingAndBorderForAxis(currentRelativeChild, @@ -2248,8 +2251,11 @@ static void YGNodelayoutImpl(const YGNodeRef node, availableInnerWidth)); childWidthMeasureMode = YGMeasureModeExactly; - childWidth = fminf(childWidth, availableInnerWidth); - childHeight = childWidth / currentRelativeChild->style.aspectRatio; + // Parent size constraint should have higher priority than flex + if (YGNodeIsFlex(currentRelativeChild)) { + childWidth = fminf(childWidth, availableInnerWidth); + childHeight = childWidth / currentRelativeChild->style.aspectRatio; + } } } From 47266b9ae84ed5eed6fc6d25ba0d892ca18611d5 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Wed, 11 Jan 2017 03:58:03 -0800 Subject: [PATCH 4/8] Add percentage support to react native Summary: @public Adds support for percentage value in react native. syntax: property: 100 | property | '100%' supported properties: padding margin width height minWidth minHeight maxWidth maxHeight flexBasis ``` class Playground extends React.Component { render() { return ( If you want to quickly test out something, open the Playground.js file and start coding. ); } } ``` Reviewed By: astreet Differential Revision: D4376549 fbshipit-source-id: c41d68a7555396f95d063a7527ee081773ac56dc --- java/com/facebook/yoga/YogaValue.java | 2 +- yoga/Yoga.c | 2 -- yoga/Yoga.h | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/com/facebook/yoga/YogaValue.java b/java/com/facebook/yoga/YogaValue.java index c2d257fc..1110eded 100644 --- a/java/com/facebook/yoga/YogaValue.java +++ b/java/com/facebook/yoga/YogaValue.java @@ -19,7 +19,7 @@ public class YogaValue { public final float value; public final YogaUnit unit; - YogaValue(float value, YogaUnit unit) { + public YogaValue(float value, YogaUnit unit) { this.value = value; this.unit = unit; } diff --git a/yoga/Yoga.c b/yoga/Yoga.c index 0e7bec47..598f273c 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -181,8 +181,6 @@ YGCalloc gYGCalloc = &calloc; YGRealloc gYGRealloc = &realloc; YGFree gYGFree = &free; -static YGValue YGValueUndefined = YG_UNDEFINED_VALUES; - static YGValue YGValueZero = {.value = 0, .unit = YGUnitPixel}; #ifdef ANDROID diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 34a90f57..cb21910d 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -43,6 +43,8 @@ typedef struct YGValue { YGUnit unit; } YGValue; +static const YGValue YGValueUndefined = { YGUndefined, YGUnitUndefined }; + typedef struct YGNode *YGNodeRef; typedef YGSize (*YGMeasureFunc)(YGNodeRef node, float width, From a3d7d72421d4b50688707bae342af41e1b46875b Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Wed, 11 Jan 2017 07:42:41 -0800 Subject: [PATCH 5/8] Xamarin iOS Support Summary: Since there's a couple of changes after last month pr of #280 , here's a new pr for Xamarin support #276 , the idea is to add Xamarin iOS, Mac and Android support. - Add Xamarin iOS support for Yoga, by providing a wrapper for the native lib. - Add Xamarin iOS Unit testing project ~~- Adds a YogaKit shared implementation in c#.~~ ~~- Adds a YogaKIt iOS implementation.~~ ~~- Adds Yoga/YogaKit iOS sample application~~ Facebook.Yoga.iOS.Tests.exe : 169 ms Tests run: 114 Passed: 114 Inconclusive: 0 Failed: 0 Ignored: 0 ![simulator screen shot 6 jan 2017 02 05 15](https://cloud.githubusercontent.com/assets/1235097/21705017/f851e9d8-d3b4-11e6-9c44-646dab559643.png) Closes https://github.com/facebook/yoga/pull/324 Reviewed By: emilsjolander Differential Revision: D4401408 Pulled By: splhack fbshipit-source-id: ecdae7967060361bef2bc25a5ef759cb9a957322 --- csharp/Facebook.Yoga/Native.cs | 4 - csharp/iOS/.gitignore | 2 + .../Entitlements.plist | 6 + .../Facebook.Yoga.iOS.Tests.csproj | 114 ++++++++++++++++++ csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist | 36 ++++++ .../LaunchScreen.storyboard | 27 +++++ csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs | 28 +++++ .../UnitTestAppDelegate.cs | 53 ++++++++ csharp/iOS/Facebook.Yoga.iOS.sln | 81 +++++++++++++ csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs | 20 +++ .../CustomBuildAction.targets | 10 ++ .../Facebook.Yoga.iOS.csproj | 50 ++++++++ .../Facebook.Yoga.Shared.Tests.projitems | 4 +- 13 files changed, 429 insertions(+), 6 deletions(-) create mode 100644 csharp/iOS/.gitignore create mode 100644 csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist create mode 100644 csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj create mode 100644 csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist create mode 100644 csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard create mode 100644 csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs create mode 100644 csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs create mode 100644 csharp/iOS/Facebook.Yoga.iOS.sln create mode 100644 csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs create mode 100644 csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets create mode 100644 csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj diff --git a/csharp/Facebook.Yoga/Native.cs b/csharp/Facebook.Yoga/Native.cs index 248fc17f..9a233a3c 100644 --- a/csharp/Facebook.Yoga/Native.cs +++ b/csharp/Facebook.Yoga/Native.cs @@ -89,10 +89,6 @@ namespace Facebook.Yoga [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options); - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] - [return: MarshalAs(UnmanagedType.I1)] - public static extern bool YGValueIsUndefined(float value); - [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] public static extern void YGNodeCopyStyle(YGNodeHandle dstNode, YGNodeHandle srcNode); diff --git a/csharp/iOS/.gitignore b/csharp/iOS/.gitignore new file mode 100644 index 00000000..a5b96ed6 --- /dev/null +++ b/csharp/iOS/.gitignore @@ -0,0 +1,2 @@ +libyoga.a +*.userprefs diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist b/csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist new file mode 100644 index 00000000..9ae59937 --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.Tests/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj b/csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj new file mode 100644 index 00000000..697a7be8 --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.Tests/Facebook.Yoga.iOS.Tests.csproj @@ -0,0 +1,114 @@ + + + + Debug + iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + Facebook.Yoga.iOS.Tests + Facebook.Yoga.iOS.Tests + Resources + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG; + prompt + 4 + iPhone Developer + true + true + true + true + true + 28871 + None + x86_64 + HttpClientHandler + Default + false + + + pdbonly + true + bin\iPhone\Release + + prompt + 4 + iPhone Developer + true + true + true + Entitlements.plist + SdkOnly + ARMv7, ARM64 + HttpClientHandler + Default + + + pdbonly + true + bin\iPhoneSimulator\Release + + prompt + 4 + iPhone Developer + true + true + None + x86_64 + HttpClientHandler + Default + + + true + full + false + bin\iPhone\Debug + DEBUG; + prompt + 4 + iPhone Developer + true + true + true + true + true + true + true + Entitlements.plist + SdkOnly + ARMv7, ARM64 + HttpClientHandler + Default + + + + + + + + + + + + + + + + + + + + + + {128FB32A-C4A1-4363-BF06-0A36E700B7FA} + Facebook.Yoga.iOS + + + + + \ No newline at end of file diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist b/csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist new file mode 100644 index 00000000..18ec8367 --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.Tests/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleName + Facebook.Yoga.iOS.Tests + CFBundleIdentifier + com.xamarin.facebook-yoga-ios-tests + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 9.0 + UIDeviceFamily + + 1 + 2 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UILaunchStoryboardName + LaunchScreen + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + + diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard b/csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard new file mode 100644 index 00000000..5d2e905a --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.Tests/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs b/csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs new file mode 100644 index 00000000..4dfd9416 --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.Tests/Main.cs @@ -0,0 +1,28 @@ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the license found in the + * LICENSE-examples file in the root directory of this source tree. + */ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Foundation; +using UIKit; + +namespace Facebook.Yoga.iOS.Tests +{ + public class Application + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "UnitTestAppDelegate" + // you can specify it here. + UIApplication.Main(args, null, "UnitTestAppDelegate"); + } + } +} diff --git a/csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs b/csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs new file mode 100644 index 00000000..683901cf --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.Tests/UnitTestAppDelegate.cs @@ -0,0 +1,53 @@ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the license found in the + * LICENSE-examples file in the root directory of this source tree. + */ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Foundation; +using UIKit; +using MonoTouch.NUnit.UI; + +namespace Facebook.Yoga.iOS.Tests +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register("UnitTestAppDelegate")] + public partial class UnitTestAppDelegate : UIApplicationDelegate + { + // class-level declarations + UIWindow window; + TouchRunner runner; + + // + // This method is invoked when the application has loaded and is ready to run. In this + // method you should instantiate the window, load the UI into it and then make the window + // visible. + // + // You have 17 seconds to return from this method, or iOS will terminate your application. + // + public override bool FinishedLaunching(UIApplication app, NSDictionary options) + { + // create a new window instance based on the screen size + window = new UIWindow(UIScreen.MainScreen.Bounds); + runner = new TouchRunner(window); + + // register every tests included in the main application/assembly + runner.Add(System.Reflection.Assembly.GetExecutingAssembly()); + + window.RootViewController = new UINavigationController(runner.GetViewController()); + + // make the window visible + window.MakeKeyAndVisible(); + + return true; + } + } +} diff --git a/csharp/iOS/Facebook.Yoga.iOS.sln b/csharp/iOS/Facebook.Yoga.iOS.sln new file mode 100644 index 00000000..a58ae0b4 --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS.sln @@ -0,0 +1,81 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{89A39C6B-6A7B-4458-872B-A0456550CAA6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS.Tests", "Facebook.Yoga.iOS.Tests\Facebook.Yoga.iOS.Tests.csproj", "{FCF0BE59-AE56-4D4F-8524-94532B2DFC71}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.ActiveCfg = Release|iPhone + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|Any CPU.Build.0 = Release|iPhone + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.ActiveCfg = Release|iPhone + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhone.Build.0 = Release|iPhone + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.ActiveCfg = Debug|iPhone + {FCF0BE59-AE56-4D4F-8524-94532B2DFC71}.Debug|iPhone.Build.0 = Debug|iPhone + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {91C42D32-291D-4B72-90B4-551663D60B8B} = {89A39C6B-6A7B-4458-872B-A0456550CAA6} + {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {89A39C6B-6A7B-4458-872B-A0456550CAA6} + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + Policies = $0 + $0.TextStylePolicy = $1 + $1.inheritsSet = VisualStudio + $1.inheritsScope = text/plain + $1.scope = text/x-csharp + $0.CSharpFormattingPolicy = $2 + $2.IndentSwitchSection = True + $2.NewLinesForBracesInProperties = True + $2.NewLinesForBracesInAccessors = True + $2.NewLinesForBracesInAnonymousMethods = True + $2.NewLinesForBracesInControlBlocks = True + $2.NewLinesForBracesInAnonymousTypes = True + $2.NewLinesForBracesInObjectCollectionArrayInitializers = True + $2.NewLinesForBracesInLambdaExpressionBody = True + $2.NewLineForElse = True + $2.NewLineForCatch = True + $2.NewLineForFinally = True + $2.NewLineForMembersInObjectInit = True + $2.NewLineForMembersInAnonymousTypes = True + $2.NewLineForClausesInQuery = True + $2.SpacingAfterMethodDeclarationName = False + $2.SpaceAfterMethodCallName = False + $2.SpaceBeforeOpenSquareBracket = False + $2.inheritsSet = Mono + $2.inheritsScope = text/x-csharp + $2.scope = text/x-csharp + EndGlobalSection +EndGlobal diff --git a/csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs b/csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs new file mode 100644 index 00000000..9a160ca2 --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS/ApiDefinition.cs @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +using System; + +using UIKit; +using Foundation; +using ObjCRuntime; +using CoreGraphics; + +namespace Facebook.Yoga.iOS +{ + //this is needed +} diff --git a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets new file mode 100644 index 00000000..2d5538bd --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets @@ -0,0 +1,10 @@ + + + + CopyInNativeLib;$(CompileDependsOn) + + + + + + diff --git a/csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj b/csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj new file mode 100644 index 00000000..479efbff --- /dev/null +++ b/csharp/iOS/Facebook.Yoga.iOS/Facebook.Yoga.iOS.csproj @@ -0,0 +1,50 @@ + + + + Debug + AnyCPU + {128FB32A-C4A1-4363-BF06-0A36E700B7FA} + {8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Facebook.Yoga.iOS + Facebook.Yoga.iOS + Resources + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + true + bin\Release + prompt + 4 + true + + + + + + + + + + + + + + + Static + False + + + + + + diff --git a/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems b/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems index e593c942..0afe5e63 100644 --- a/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems +++ b/csharp/tests/Facebook.Yoga/Facebook.Yoga.Shared.Tests.projitems @@ -22,7 +22,7 @@ - + - \ No newline at end of file + From c4a3e12addd17e4f3d3522ba18ad9395d12a42b9 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Wed, 11 Jan 2017 07:42:42 -0800 Subject: [PATCH 6/8] Launch buck from Visual Studio (Xamarin Studio) for Mac and iOS Summary: Launch buck from Visual Studio before `CopyInNativeLib` in `CompileDependsOn` - Mac `buck build //csharp:yoganet#default,shared` - iOS `buck build //csharp:yoganet-ios` Reviewed By: emilsjolander Differential Revision: D4403163 fbshipit-source-id: 2e5fd3fd154ef53574129ac9cb834ae3a58f2466 --- csharp/Mac/CustomBuildAction.targets | 6 +++++- csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/csharp/Mac/CustomBuildAction.targets b/csharp/Mac/CustomBuildAction.targets index e20e70b8..2ac58ff0 100644 --- a/csharp/Mac/CustomBuildAction.targets +++ b/csharp/Mac/CustomBuildAction.targets @@ -1,9 +1,13 @@ - CopyInNativeLib;$(CompileDependsOn) + Buck;CopyInNativeLib;$(CompileDependsOn) + + + + diff --git a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets index 2d5538bd..06e8be25 100644 --- a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets +++ b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets @@ -1,8 +1,11 @@  - CopyInNativeLib;$(CompileDependsOn) + Buck;CopyInNativeLib;$(CompileDependsOn) + + + From adb81e2a1e062045fc88c12d53f013398ee5d03d Mon Sep 17 00:00:00 2001 From: Dustin Shahidehpour Date: Thu, 12 Jan 2017 10:16:12 -0800 Subject: [PATCH 7/8] Update docs to show new API. Summary: Need API needs some new docs. I also removed the repo's `.hgignore` and added everything to fbobjc `.hgignore` via `./Tools/generate_hgignore.py` which uses Yoga's `.gitignore`. Reviewed By: emilsjolander Differential Revision: D4403967 fbshipit-source-id: f2158e4feb27953d1d9e21c775926e6207220c4a --- .gitignore | 4 +++ .hgignore | 58 --------------------------------------- docs/_data/nav_docs.yml | 2 +- docs/_docs/api/objc.md | 38 ------------------------- docs/_docs/api/yogakit.md | 27 ++++++++++++++++++ docs/index.md | 2 +- 6 files changed, 33 insertions(+), 98 deletions(-) delete mode 100644 .hgignore delete mode 100644 docs/_docs/api/objc.md create mode 100644 docs/_docs/api/yogakit.md diff --git a/.gitignore b/.gitignore index 88667ae7..bfedb9c3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,10 @@ /gentest/test.html .buckversion +# Jekyll +/.sass-cache/ +/_site/ + # Visual studio code .vscode *.pdb diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 88667ae7..00000000 --- a/.hgignore +++ /dev/null @@ -1,58 +0,0 @@ -.DS_STORE - -/buck-cache/ -/buck-out/ -/.buckconfig.local -/.buckd -/gentest/test.html -.buckversion - -# Visual studio code -.vscode -*.pdb -*.tlog -*.obj -*.pch -*.log -*.orig - -# Xcode -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xcuserstate - -## Obj-C/Swift specific -*.hmap -*.ipa -*.dSYM.zip -*.dSYM - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build diff --git a/docs/_data/nav_docs.yml b/docs/_data/nav_docs.yml index 92cfe6a5..63be4d0b 100644 --- a/docs/_data/nav_docs.yml +++ b/docs/_data/nav_docs.yml @@ -19,7 +19,7 @@ - title: API items: - id: c - - id: objc + - id: yogakit - id: java - id: csharp - id: javascript diff --git a/docs/_docs/api/objc.md b/docs/_docs/api/objc.md deleted file mode 100644 index a403bdba..00000000 --- a/docs/_docs/api/objc.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -docid: objc -title: Objective-C -layout: docs -permalink: /docs/api/objc/ ---- - -> The Objective-C API is very new and still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues). We hope to stabilize the API over the next couple weeks / months. - -Yoga for Objective-C is implemented as a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview). We try to rely on the existing `UIView` properties and initializers where possible, making the Yoga API smaller for Objective-C than for other languages. - -### Lifecycle - -As with any `UIView` instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. With Yoga for Objective-C the frame is actually how you set the width and the height of the Yoga node, just like any other `UIView`. - -Because Yoga is implemented as a category we need some way to mark the view as using Yoga as you might not want Yoga to control layout of your whole app, this is especially important if you are migrating an existing app to use Yoga. The property decides during layout/sizing whether or not `yg_*` properties should be applied. Defaults to `NO`. - - - -### Children - -Yoga relies on `UIView` subviews to build up its internal layout tree. However using properties such as `yg_includeInLayout` a View can exclude itself from layout. Therefor we provide the following method to query the number of children which are laid out using Yoga. - - - -### Style setters - -The large part of Yoga's API consists of setters for styles. These all follow the same general structure. Bellow are the function and enums used to control the various styles. For an in depth guide to how each style works see the getting started guide. - - - -### Layout -- `yg_includeInLayout` decides if we should include this view when calculating layout. Defaults to `YES`. -- `yg_intrinsicSize` returns the size of the view if no constraints were given. This is equivalent to calling `[view sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]`. -- `yg_applyLayout` performs layout calculation and update the frames of the views in the hierarchy with the results. -- `yg_resolvedDirection` returns the resolved layout direction of this view. Either `YGDirectionRTL` or `YGDirectionLTR`. - - diff --git a/docs/_docs/api/yogakit.md b/docs/_docs/api/yogakit.md new file mode 100644 index 00000000..9ba7b4bf --- /dev/null +++ b/docs/_docs/api/yogakit.md @@ -0,0 +1,27 @@ +--- +docid: yogakit +title: YogaKit +layout: docs +permalink: /docs/api/yogakit/ +--- + +> The YogaKit API is still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues). + +YogaKit is a Objective-C (and Swift-compatible) wrapper for Yoga. It allows iOS Developers to manage the layout of their views using the power of Yoga. + +Layout configuration is done via the [YGLayout](https://github.com/facebook/yoga/blob/master/YogaKit/YGLayout.h) object. YogaKit exposes `YGLayout` via a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview). + +### Lifecycle + +As with any `UIView`, instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. YogaKit uses the frame of the parent view to determine the space that is available for children in layout. + +### Children + +Yoga relies on `UIView` subviews to build up its internal layout tree. However, a subview can exclude itself from layout by setting the `isIncludedInLayout` property on `YGLayout` to `NO`. + +It is also possible to query the number of children **included** in layout via `numberOfChildren`. + +### Layout +To apply a layout to a view (and its' subviews) you need to call `[view.yoga applyLayout]`. This will do a layout calculation (if needed) and apply the calculated frames to every view included in the layout. + +In the event that you need to another layout pass on a view you can mark it dirty via `[view.yoga markDirty]`. diff --git a/docs/index.md b/docs/index.md index f5527d46..66037545 100644 --- a/docs/index.md +++ b/docs/index.md @@ -29,7 +29,7 @@ id: home
- +
From c536ab214d2291fab7442c1ef473d2ea64282495 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Thu, 12 Jan 2017 10:23:41 -0800 Subject: [PATCH 8/8] Update buck build in Visual Studio Summary: - Always launch buck build for Build, but copy native library when it was changed - Rename Facebook.Yoga.Mac.Test to Facebook.Yoga.Mac.Sample - Add Facebook.Yoga.Mac.Tests for NUnit test. - "Run Unit Tests" menu item was activated for the target, but Mono still can't find libyoga.dylib Closes https://github.com/facebook/yoga/pull/332 Reviewed By: emilsjolander Differential Revision: D4408799 Pulled By: splhack fbshipit-source-id: b3f5f9ebd8265cc152ca859176afbf54efa8f170 --- csharp/Mac/CustomBuildAction.targets | 15 ++-- .../AppDelegate.cs | 2 +- .../Entitlements.plist | 0 .../Facebook.Yoga.Mac.Sample.csproj} | 4 +- .../Info.plist | 4 +- .../Main.cs | 2 +- .../Main.storyboard | 12 +-- .../ViewController.cs | 2 +- .../ViewController.designer.cs | 2 +- .../Entitlements.plist | 6 ++ .../Facebook.Yoga.Mac.Tests.csproj | 78 +++++++++++++++++++ csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist | 30 +++++++ csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs | 20 +++++ .../Facebook.Yoga.Mac.Tests/packages.config | 4 + csharp/Mac/Facebook.Yoga.Mac.sln | 26 +++++-- csharp/Mac/buck-build.sh | 6 ++ .../CustomBuildAction.targets | 15 ++-- 17 files changed, 189 insertions(+), 39 deletions(-) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/AppDelegate.cs (94%) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/Entitlements.plist (100%) rename csharp/Mac/{Facebook.Yoga.Mac.Test/Facebook.Yoga.Mac.Test.csproj => Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj} (94%) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/Info.plist (89%) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/Main.cs (91%) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/Main.storyboard (98%) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/ViewController.cs (99%) rename csharp/Mac/{Facebook.Yoga.Mac.Test => Facebook.Yoga.Mac.Sample}/ViewController.designer.cs (91%) create mode 100644 csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist create mode 100644 csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj create mode 100644 csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist create mode 100644 csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs create mode 100644 csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config create mode 100755 csharp/Mac/buck-build.sh diff --git a/csharp/Mac/CustomBuildAction.targets b/csharp/Mac/CustomBuildAction.targets index 2ac58ff0..db3cbddf 100644 --- a/csharp/Mac/CustomBuildAction.targets +++ b/csharp/Mac/CustomBuildAction.targets @@ -1,15 +1,10 @@ + - - Buck;CopyInNativeLib;$(CompileDependsOn) + NativeLibrary;$(CompileDependsOn) - - - - - - - - + + + diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/AppDelegate.cs similarity index 94% rename from csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs rename to csharp/Mac/Facebook.Yoga.Mac.Sample/AppDelegate.cs index f6a46196..fa4bbf95 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/AppDelegate.cs @@ -9,7 +9,7 @@ using AppKit; using Foundation; -namespace Facebook.Yoga.Mac.Test +namespace Facebook.Yoga.Mac.Sample { [Register("AppDelegate")] public class AppDelegate : NSApplicationDelegate diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/Entitlements.plist b/csharp/Mac/Facebook.Yoga.Mac.Sample/Entitlements.plist similarity index 100% rename from csharp/Mac/Facebook.Yoga.Mac.Test/Entitlements.plist rename to csharp/Mac/Facebook.Yoga.Mac.Sample/Entitlements.plist diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/Facebook.Yoga.Mac.Test.csproj b/csharp/Mac/Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj similarity index 94% rename from csharp/Mac/Facebook.Yoga.Mac.Test/Facebook.Yoga.Mac.Test.csproj rename to csharp/Mac/Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj index 70535e37..4337f095 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/Facebook.Yoga.Mac.Test.csproj +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/Facebook.Yoga.Mac.Sample.csproj @@ -6,8 +6,8 @@ {64E0AB97-A904-4607-A535-EEA5A966C09E} {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Exe - Facebook.Yoga.Mac.Test - Facebook.Yoga.Mac.Test + Facebook.Yoga.Mac.Sample + Facebook.Yoga.Mac.Sample v2.0 Xamarin.Mac Resources diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/Info.plist b/csharp/Mac/Facebook.Yoga.Mac.Sample/Info.plist similarity index 89% rename from csharp/Mac/Facebook.Yoga.Mac.Test/Info.plist rename to csharp/Mac/Facebook.Yoga.Mac.Sample/Info.plist index 7e955671..3c1e9003 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/Info.plist +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/Info.plist @@ -3,9 +3,9 @@ CFBundleName - Facebook.Yoga.Mac.Test + Facebook.Yoga.Mac.Sample CFBundleIdentifier - com.companyname.facebook-yoga-mac-test + com.facebook.facebook-yoga-mac-sample CFBundleShortVersionString 1.0 CFBundleVersion diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.cs similarity index 91% rename from csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs rename to csharp/Mac/Facebook.Yoga.Mac.Sample/Main.cs index 97adb4db..17e74ec2 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.cs @@ -8,7 +8,7 @@ using AppKit; -namespace Facebook.Yoga.Mac.Test +namespace Facebook.Yoga.Mac.Sample { static class MainClass { diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/Main.storyboard b/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.storyboard similarity index 98% rename from csharp/Mac/Facebook.Yoga.Mac.Test/Main.storyboard rename to csharp/Mac/Facebook.Yoga.Mac.Sample/Main.storyboard index 1d8f728d..6b7fa93d 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/Main.storyboard +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/Main.storyboard @@ -10,11 +10,11 @@ - + - + - + @@ -28,7 +28,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -627,7 +627,7 @@ - + diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.cs similarity index 99% rename from csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs rename to csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.cs index e802aa4e..4fe8d75b 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.cs @@ -13,7 +13,7 @@ using AppKit; using Foundation; using CoreGraphics; -namespace Facebook.Yoga.Mac.Test +namespace Facebook.Yoga.Mac.Sample { public static class NSViewYogaExtensions { diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.designer.cs b/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.designer.cs similarity index 91% rename from csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.designer.cs rename to csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.designer.cs index 1cf1e327..1f97731d 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.designer.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Sample/ViewController.designer.cs @@ -6,7 +6,7 @@ // using Foundation; -namespace Facebook.Yoga.Mac.Test +namespace Facebook.Yoga.Mac.Sample { [Register("ViewController")] partial class ViewController diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist b/csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist new file mode 100644 index 00000000..9ae59937 --- /dev/null +++ b/csharp/Mac/Facebook.Yoga.Mac.Tests/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj b/csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj new file mode 100644 index 00000000..0c67b1cb --- /dev/null +++ b/csharp/Mac/Facebook.Yoga.Mac.Tests/Facebook.Yoga.Mac.Tests.csproj @@ -0,0 +1,78 @@ + + + + Debug + AnyCPU + {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77} + {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + Facebook.Yoga.Mac.Tests + Facebook.Yoga.Mac.Tests + v2.0 + Xamarin.Mac + Resources + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + Mac Developer + false + false + false + true + true + true + HttpClientHandler + Default + None + x86_64 + + + pdbonly + true + bin\Release + + prompt + 4 + false + true + false + true + true + true + SdkOnly + HttpClientHandler + Default + + + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + + + + + + + + + + + + + + {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71} + Facebook.Yoga.Mac + + + + + diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist b/csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist new file mode 100644 index 00000000..2671eb56 --- /dev/null +++ b/csharp/Mac/Facebook.Yoga.Mac.Tests/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleName + Facebook.Yoga.Mac.Tests + CFBundleIdentifier + com.facebook.facebook-yoga-mac-tests + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.11 + CFBundleDevelopmentRegion + en + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + NSHumanReadableCopyright + ${AuthorCopyright} + NSPrincipalClass + NSApplication + NSMainStoryboardFile + Main + + diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs b/csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs new file mode 100644 index 00000000..d3c588bc --- /dev/null +++ b/csharp/Mac/Facebook.Yoga.Mac.Tests/Main.cs @@ -0,0 +1,20 @@ +/** + * Copyright 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the license found in the + * LICENSE-examples file in the root directory of this source tree. + */ + +using System; +using System.Reflection; + +namespace Facebook.Yoga.Mac.Tests +{ + static class MainClass + { + static void Main(string[] args) + { + } + } +} diff --git a/csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config b/csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config new file mode 100644 index 00000000..a6115df1 --- /dev/null +++ b/csharp/Mac/Facebook.Yoga.Mac.Tests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/csharp/Mac/Facebook.Yoga.Mac.sln b/csharp/Mac/Facebook.Yoga.Mac.sln index c99766c6..b44f1bbf 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.sln +++ b/csharp/Mac/Facebook.Yoga.Mac.sln @@ -1,25 +1,39 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Test", "Facebook.Yoga.Mac.Test\Facebook.Yoga.Mac.Test.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac", "Facebook.Yoga.Mac.csproj", "{19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Sample", "Facebook.Yoga.Mac.Sample\Facebook.Yoga.Mac.Sample.csproj", "{64E0AB97-A904-4607-A535-EEA5A966C09E}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9352A9B6-F93B-45DD-8BCE-4696A62B3789}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Mac.Tests", "Facebook.Yoga.Mac.Tests\Facebook.Yoga.Mac.Tests.csproj", "{9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Debug|Any CPU.Build.0 = Debug|Any CPU {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.ActiveCfg = Release|Any CPU {19A1C7D7-C9CC-476A-B604-DF6A3DE1BA71}.Release|Any CPU.Build.0 = Release|Any CPU + {64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64E0AB97-A904-4607-A535-EEA5A966C09E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64E0AB97-A904-4607-A535-EEA5A966C09E}.Release|Any CPU.Build.0 = Release|Any CPU + {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FCB6149-DFA8-4EAA-B4DB-2E91A5D8FF77}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {91C42D32-291D-4B72-90B4-551663D60B8B} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789} + {4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {9352A9B6-F93B-45DD-8BCE-4696A62B3789} EndGlobalSection EndGlobal diff --git a/csharp/Mac/buck-build.sh b/csharp/Mac/buck-build.sh new file mode 100755 index 00000000..de1a32a2 --- /dev/null +++ b/csharp/Mac/buck-build.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if buck --version >/dev/null 2>&1; then true; else + echo "SKIP: Need to install buck https://buckbuild.com/setup/getting_started.html" + exit 0 +fi +buck build $1 diff --git a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets index 06e8be25..04a1b830 100644 --- a/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets +++ b/csharp/iOS/Facebook.Yoga.iOS/CustomBuildAction.targets @@ -1,13 +1,10 @@  - Buck;CopyInNativeLib;$(CompileDependsOn) - - - - - - - - + NativeLibrary;$(CompileDependsOn) + + + + +