Compare commits

..

116 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
ddf748a99d Add Swift extension as a separate pod
Summary:
Adds swift extension file as a separate subspec, as it is not required for the objc projects.

Also this fixes the current issue where the flipper sample app fails to build on xcode 11, as it fails to link the Swift specific literals.

Fixes this too https://github.com/facebook/yoga/issues/565

Reviewed By: SidharthGuglani

Differential Revision: D18373993

fbshipit-source-id: 0c058886a837c7ceafcd0167f878b3e0f7763aa1
2019-11-07 10:51:42 -08:00
Sidharth Guglani
4d16ee4ed4 Use double for YGRoundValueToPixelGrid calculations
Summary:
Use double for YGRoundValueToPixelGrid calculations as we were losing some precision in float operations

#Changelog:
[Internal][Yoga] Use double for YGRoundValueToPixelGrid calculations

Reviewed By: astreet

Differential Revision: D18225999

fbshipit-source-id: 69c05f56a0e0f3433bf0bd958aa07d26dd83fe02
2019-11-05 17:26:00 -08:00
Dmytro Kasianchuk
b72efaaaca Added missing YOGA_EXPORT
Summary:
Added missing YOGA_EXPORT

#Changelog:
[Internal] [Fixed] - Added missing YOGA_EXPORT

Reviewed By: SidharthGuglani

Differential Revision: D18289071

fbshipit-source-id: a2e16a59427aa33b34b3d1fab9d1088904ee62f5
2019-11-02 20:43:17 -07:00
Sidharth Guglani
6327893b9b Use compiler flags -ffunction-sections, -fdata-sections and gc sections in both jni and core
Summary: Use compiler flags -ffunction-sections, -fdata-sections and  -Wl,--gc-sections  in both jni and yoga core

Reviewed By: amir-shalem

Differential Revision: D18029671

fbshipit-source-id: 5192fb6d682248b16781dead0d7b0a0377861fb6
2019-11-01 11:54:45 -07:00
Sidharth Guglani
8c3ee81d6e Use compiler flag -fvisibility=hidden
Summary:
Using compiler flag -fvisibility=hidden and explicitly setting visibility to default to public methods

#Changelog:
[Internal] [Yoga] Use compiler flag -fvisibility=hidden for reducing yoga binary size

Reviewed By: astreet

Differential Revision: D18029030

fbshipit-source-id: 545e73f9c25f3108fc9d9bb7f08c157dbc8da005
2019-11-01 11:54:45 -07:00
Scott Wolchok
fb07dcff40 Fix data race with gCurrentGenerationCount
Summary:
Yoga layout can be invoked on multiple threads, and gCurrentGenerationCount is a shared global without synchronization.

Changelog: [General] [Fixed] - Fix an internal thread safety issue in Yoga

Reviewed By: SidharthGuglani

Differential Revision: D18092734

fbshipit-source-id: 85753d139549b4e5507f97a56d589fb6854557fa
2019-10-28 12:54:52 -07:00
Sidharth Guglani
27f42c90db Remove setStyleInputs API
Summary:
setStyleInputs batching API was added to reduce the number of jni calls and although it improved performance in yoga world but was not impactful in litho and is not used anywhere.

Removing this saves around 500 bytes per architecture

#Changelog:
[Internal][Yoga] Removed unused code setStyleInputs batching API form Yoga

Reviewed By: amir-shalem

Differential Revision: D18036536

fbshipit-source-id: 7436b55dcd464dd9f9cc46406d4fd78d12babe55
2019-10-23 02:38:03 -07:00
Sidharth Guglani
688bd4ef72 Add exception handling in vanilla jni
Summary:
Exception handling in vanilla jni

## Changelog:
[Internal] [Added] Added exception handling for vanilla jni implementation in yoga

Reviewed By: amir-shalem

Differential Revision: D18036134

fbshipit-source-id: 965eaa2fddbc00b9ac0120b79678608e280d03db
2019-10-22 11:01:00 -07:00
Andres Suarez
42bba10894 Tidy up license headers
Summary: Changelog: Tidy up license headers

Reviewed By: SidharthGuglani

Differential Revision: D17919414

fbshipit-source-id: 0501b495dc0a42256ca6ba3284a873da1ab175c0
2019-10-15 10:36:38 -07:00
Sidharth Guglani
495d8da596 useVanilla flag for measure and baseline methods as well
Summary: UseVanillaJNI flag was missing for measure and baseline functions

Reviewed By: amir-shalem

Differential Revision: D17868201

fbshipit-source-id: 95d6843d643e90157a51550d6efbf059f0ca2c39
2019-10-11 02:04:02 -07:00
Sidharth Guglani
869a33eb13 no need to pass env to ref method , we can directly use getCurrentEnv()
Summary: We can use getCurrentEnv() instead of passing environment variable around

Reviewed By: amir-shalem

Differential Revision: D17842042

fbshipit-source-id: 185b174ae7c08e746bc76c0600c2e326b15c4993
2019-10-10 05:33:20 -07:00
Sidharth Guglani
050893f15a rename PtrJNodeMap to PtrJNodeMapVanilla in yoga vanilla jni files
Summary: Rename PtrJNodeMap in vanilla files top PtrJNodeMapVanilla , otherwise they conflict

Reviewed By: amir-shalem

Differential Revision: D17842001

fbshipit-source-id: eb164076ee2a68d79dc376826508a4143056ea31
2019-10-10 05:33:19 -07:00
Sidharth Guglani
8aa67abdb2 Fix YGNodeJobject method
Summary: We can use getCurrentEnv() , no need to pass env around methods

Reviewed By: amir-shalem

Differential Revision: D17841281

fbshipit-source-id: a4a58292e70ac05b0f0b9eb962a82a8501ad0226
2019-10-10 05:33:19 -07:00
Sidharth Guglani
2e321fc69f Move JNI_OnLoad to separate file which registers both fbjni and jni methods
Summary: Move JNI_ONLoad to a separate file so that both fbjni native methods and vanillla jni native methods can be initialized correctly

Reviewed By: amir-shalem

Differential Revision: D17840166

fbshipit-source-id: 045df0df7a95bc331cbbefb3a118a349f3029465
2019-10-10 05:33:18 -07:00
Amir Shalem
aa2610c2dd Set missing useVanillaJNI in constructor for YogaNode
Summary: set missing useVanillaJNI, it was causing part of the unit-tests to run in fbjni instead of vanillajni.

Reviewed By: SidharthGuglani

Differential Revision: D17852635

fbshipit-source-id: 5bc187d90fbdc430015be55a015a7d1e0ba0ebc6
2019-10-10 02:45:00 -07:00
Sidharth Guglani
293b657aef Use TestParametrization for testing both fbjni and vanillaJNI version
Summary: Use TestParametrization to test both fbjni and vanilla jni versions

Reviewed By: amir-shalem

Differential Revision: D17788718

fbshipit-source-id: 0f3317b7403cadca7b7ccd9140f1933d746bf433
2019-10-09 09:28:41 -07:00
Sidharth Guglani
d6591439d1 move YGSetLogger and YGConfigFree with global ref to vanilla jni
Summary: Move YGSetLogger and YGConfigFree methods to vanilla JNI

Reviewed By: amir-shalem

Differential Revision: D17754999

fbshipit-source-id: 8dfcf1a54e4d54ebf91e38c6513e6a703a40ae92
2019-10-09 09:28:41 -07:00
Sidharth Guglani
2ef674edd3 move measure and baseline methods
Summary: Measure and baseline callbacks moved to vanilla JNI

Reviewed By: amir-shalem

Differential Revision: D17714334

fbshipit-source-id: dafbde36984aba948a6345a21d3808a6ef4013e8
2019-10-08 17:51:35 -07:00
Sidharth Guglani
22a60e82b0 move yg node new and ygnode new with config
Summary: YGNode creation methods to vanilla JNI

Reviewed By: amir-shalem

Differential Revision: D17714230

fbshipit-source-id: 74e14e876ab7efc67771d92091c2a78f09072b83
2019-10-08 17:51:34 -07:00
Sidharth Guglani
34739ec652 Move calculate layout method to vanilla JNI
Summary: Using vanilla JNI for calculate layout

Reviewed By: amir-shalem

Differential Revision: D17714219

fbshipit-source-id: bb05de4a0112eefc2b731997a4c1ecef5c0c7361
2019-10-08 17:51:34 -07:00
Sidharth Guglani
b9b0217a07 Add Scoped Local and Global Ref
Summary: Add ScopedLocalRef, ScopedGlobalRef and some common methods to be used later.

Reviewed By: amir-shalem

Differential Revision: D17711284

fbshipit-source-id: be43d5e246bc2406765057783be11854877c41f1
2019-10-08 17:51:33 -07:00
Sidharth Guglani
7c2683fe52 move setStyleInputs to vanilla jni (YogaStyleProperties Part 5)
Summary: Move Yoga style properties to vanilla JNI under a flag.

Reviewed By: amir-shalem

Differential Revision: D17686117

fbshipit-source-id: e79bee1188c24e301b23416486b10f613434eebc
2019-10-08 14:37:27 -07:00
Sidharth Guglani
ee73f556b4 move config jni methods to vanilla jni
Summary: Move yoga node config related jni methods to vanilla jni

Reviewed By: amir-shalem

Differential Revision: D17684821

fbshipit-source-id: 31a667b3ad67501aaef83a132971e4e0826cacd4
2019-10-08 14:37:26 -07:00
Sidharth Guglani
34b68cf1d2 move YGNode related methods to vanilla jni
Summary: This diff moves methods related to actions on YGNode like free node, reset node etc. to vanilla JNI

Reviewed By: amir-shalem

Differential Revision: D17668008

fbshipit-source-id: 03bfc51ec1fcf06569713400f984d551827e22fe
2019-10-08 14:37:26 -07:00
Sidharth Guglani
8975019269 move edge style properties to vanilla jni (YogaStyleProperties Part 4)
Summary: Move Yoga style properties to vanilla JNI under a flag.

Reviewed By: amir-shalem

Differential Revision: D17667201

fbshipit-source-id: 448134d6d7d0dd0c6ff2734b3eb39e65d1cb403f
2019-10-08 14:37:25 -07:00
Sidharth Guglani
6e6b1369ac move percent auto style properties to vanilla jni (YogaStyleProperties Part 3)
Summary: Move Yoga style properties to vanilla JNI under a flag.

Reviewed By: amir-shalem

Differential Revision: D17666674

fbshipit-source-id: 08490bf7c214c856a93214088a27dd4e6df9e0fd
2019-10-08 14:37:25 -07:00
Sidharth Guglani
25b8c94788 move common code to YGJNI.h header class
Summary: Moving common code to YGJNI.h header class so that same can be used in fbjni and vanilla jni implementations

Reviewed By: amir-shalem

Differential Revision: D17666457

fbshipit-source-id: 1e6cd2506fb773b8a17ebef277a2c7ef9728e66b
2019-10-08 14:37:24 -07:00
Sidharth Guglani
3fce27c48c Migrate YGNodeStyleGetFlex method to vanilla jni (YogaStyleProperties Part 2)
Summary: Move Yoga style properties to vanilla JNI under a flag.

Reviewed By: amir-shalem

Differential Revision: D17666090

fbshipit-source-id: 121b939c310799c79f2fce0ea293f88b2940c4fc
2019-10-08 14:37:24 -07:00
Sidharth Guglani
32a973ebd1 Move style properties which accept one parameter to vanilla JNI (YogaStyleProperties Part 1)
Summary: Move Yoga style properties to vanilla JNI under a flag.

Reviewed By: amir-shalem

Differential Revision: D17666048

fbshipit-source-id: 6565acd35ab04ef0c3a2544447a25dc6edc3e7a5
2019-10-08 14:37:24 -07:00
Andres Suarez
c37f5956e4 Fix license headers
Reviewed By: scottrice

Differential Revision: D17673223

fbshipit-source-id: 42a3a25934ef63b24ebf9f5f1909cb562d0d4172
2019-09-30 15:09:48 -07:00
Sidharth Guglani
0875b6b542 Add boolean flag to decide whether to use fbjni or jni
Summary:
Adds a flag useVanillaJNI in YogaConfig to determine whether to use FbJNI or JNI.
Currently default is set to false.

We will experiment based on this flag once all code have been migrated.

Reviewed By: Andrey-Mishanin

Differential Revision: D17601703

fbshipit-source-id: 377a5bd2a6f8a7584e84932e87fa7044d8165efd
2019-09-26 17:34:18 -07:00
Sidharth Guglani
b29e144649 Add separate classes to implement JNI methods suing vanilla JNI
Summary:
This diffs adds a separate file YGJNIVanilla.cpp to add jni methods which uses vanilla JNI instead of FBJNI.
In this diff only one method has been added to setup the experiment boolean setup.

At the end of this diff stack , we will be able to experiment between fbjni and vanilla jni in yoga and finally get rid of fbjni which saves us around 300Kb per architecture in yoga binary size.

Reviewed By: Andrey-Mishanin

Differential Revision: D17601591

fbshipit-source-id: a88520c625bd8b5d9ffcf8ab5f02fc71dc800081
2019-09-26 17:34:17 -07:00
Uts Sikder
f00116c3a6 BREAKING: rm YogaNode parameter from YogaLogger#log
Summary:
In D17439957, I noted that YogaLogger#log throws a NoMethodFoundException when called from C++ b/c C++ and Java's signatures of that method don't match. C++ uses YogaNodeJNIBase for the first param, Java uses YogaNode. Both my attempts to fix this failed.

Attempt #1 - Make Java use YogaNodeJNIBase. This doesn't work because the :java-interface target includes YogaLogger but not YogaNodeJNIBase. Moving YogaLogger to the impl target doesn't work either b/c other files in :java-interface reference YogaLogger.

Attempt #2 - Make C++ use YogaNode. This doesn't work b/c we try to call the log method with objects of fbjni type YogaNodeJNIBase. This would be fine in Java since YogaNodeJNIBase extends YogaNode. But fbjni's typing isn't advanced enough to know this, so the Yoga C++ fails to compile.

At this point, I was wondering what the value of having this param in the log function at all was. None of the implementations in our codebase use it today. It might be easier to just remove it all together. This also removes a bug with YGNodePrint where we pass a null layout context that eventually causes a SIG_ABRT when we use it to try to find a YogaNode to pass to this function. (https://fburl.com/diffusion/ssw9h8lv).

Reviewed By: amir-shalem

Differential Revision: D17470379

fbshipit-source-id: 8fc2d95505971a52af2399a9fbb60b63f27f0ec2
2019-09-25 09:15:45 -07:00
Amir Shalem
f1baf8336b Use direct access to YogaConfig mNativePointer parameter
Summary:
Use direct access to YogaConfig mNativePointer parameter

Results:
```
The following primary metrics showed statistically significant changes at the 95% confidence level:
javaFullLifecycleAllocateCalculateReadLayout	-1.25%
javaLayoutReading	0.44%
javaYogaNodeAllocateAndSetProps	-1.92%
javaYogaNodeAllocation	-2.11%
javaYogaNodeStylePropAssignment	-0.89%
```

Differential Revision: D17519542

fbshipit-source-id: c39bfe1b0ecae9149dc6da2a0a7e936df215ec5b
2019-09-22 13:53:06 -07:00
Uts Sikder
36eae205e1 fix type mismatches in YogaLogger#log function
Summary: This diff fixes two issues with the JNI integration of YogaLogger#log. (1) The YogaLogger class descriptor was missing a semicolon. This causes a ClassNotFoundException whenever you try to call the log method from C++. (2) The C++ signature for the class was using YogaNodeJNIBase as an arg but the Java signature was using YogaNode. This causes a MethodNotFoundException whenever you try to call the method after fixing problem 1.

Reviewed By: astreet

Differential Revision: D17439957

fbshipit-source-id: be3c16512558050265565b3688fb09a7da31b9b2
2019-09-18 21:32:09 -07:00
Amir Shalem
ad5b3410f0 Remove dead code of mYogaNodeCloneFunction
Summary: Code cleanup, remove mYogaNodeCloneFunction completely and its `YogaNodeCloneFunction`

Reviewed By: SidharthGuglani

Differential Revision: D17284191

fbshipit-source-id: 36dae0c0548cfdd3e85182a8e3c6ff9a2d3a5011
2019-09-18 05:52:56 -07:00
Amir Shalem
e2dbff0ca6 Split interface and jni java target
Summary:
Split the yoga buck targets from interface to actual implementation.

This is currently done without moving any files folder, since only we will make the distinction between interface<-->implementation only this buck target (and not in the litho/reactnative yoga copies).

Buck does insures that the `java-interface` is pure since it doesn't depend on any fbjni code.

Reviewed By: SidharthGuglani

Differential Revision: D17266406

fbshipit-source-id: 46aa469b74c2c3114f1d3d762c41d32cfe269f57
2019-09-18 00:40:28 -07:00
Amir Shalem
96eb94afd0 Remove YogaNode.create() from the abstract class
Summary:
Remove YogaNode.create() from the abstract class after we made sure nothing uses it anymore
This is the final stage to make `YogaNode` a pure class without JNI references

Reviewed By: SidharthGuglani

Differential Revision: D17280571

fbshipit-source-id: bd0eb138f7a6a9de8988fc0a7b90badbf635dac5
2019-09-18 00:40:27 -07:00
Amir Shalem
9100019c0a Split YogaConfig into interface and actual implementation
Summary:
Split YogaConfig into the same way YogaNode is split today.

Into an abstract class defining the interface, and actual JNI implementation

Reviewed By: SidharthGuglani

Differential Revision: D17266404

fbshipit-source-id: 3d5d6aa65c55cfa61d47c662d140cdce6dcb0ea1
2019-09-18 00:40:27 -07:00
Sidharth Guglani
21f814b2a6 remove infer-annotations dependency (#922)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/922

We are not using this dependency anywhere in yoga. Removed in this diff.

Reviewed By: passy

Differential Revision: D17131081

fbshipit-source-id: 5544b892f4ef5ca0207d9e21a5b97a2940ac6d53
2019-09-17 12:08:19 -07:00
Amir Shalem
499d28d021 Expose native pointer thru an interface function for YogaConfig
Summary:
Expose native pointer thru an interface function for YogaConfig (its package private to `com.facebook.yoga` namespace),
This way we can make later on YogaConfig a pure abstract class.

Plus, it makes sure external users don't modify the pointer

Reviewed By: SidharthGuglani

Differential Revision: D17266401

fbshipit-source-id: f39b488cea0b73bc3578bb3aa90ab00139bf9271
2019-09-17 07:15:24 -07:00
Amir Shalem
d697bbe0a5 Switch to YogaConfigFactory.create
Summary: Switch to `YogaNodeFactory.create()` instead of using `YogaNode.create()`

Reviewed By: SidharthGuglani

Differential Revision: D17266408

fbshipit-source-id: 69e1e59c7345d16eb174af97c2e231666a02354b
2019-09-17 07:15:23 -07:00
Amir Shalem
67a3841164 Switch to YogaNodeFactory.create
Summary: Switch to `YogaNodeFactory.create()` instead of using `YogaNode.create()`

Reviewed By: SidharthGuglani

Differential Revision: D17258195

fbshipit-source-id: 5f31540724a16e401fcd0fbdf19a4baa354b2d72
2019-09-17 07:15:23 -07:00
Sidharth Guglani
6ac38d188c use implementation instead of compile for yoga dependencies
Summary: Use implementation instead of compile in build.gradle

Reviewed By: passy

Differential Revision: D17343602

fbshipit-source-id: a2ec21a46ebbf3feb5dcc0d9ae2684f8efb096e3
2019-09-16 09:14:28 -07:00
Sidharth Guglani
8216c54b05 update build tools versions
Summary:
Update build tools version to 28.0.3 to fix the below warning

WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.

Reviewed By: passy

Differential Revision: D17343575

fbshipit-source-id: aa12bf2b55666aacb18f09b1cca22eab05f38220
2019-09-16 09:14:28 -07:00
Sidharth Guglani
968c075e39 bump version to 1.16.0-SNAPSHOT
Summary: Bump version to 1.16.0-SNAPSHOT for new yoga release

Reviewed By: amir-shalem

Differential Revision: D17396540

fbshipit-source-id: ddd01454752d88548ae7490cfd9fccfb8c591ec9
2019-09-16 08:25:31 -07:00
Sidharth Guglani
26dbe8b4ff bump version to 1.16.0
Summary: Bump version to 1.16.0 for new yoga release

Reviewed By: amir-shalem

Differential Revision: D17395785

fbshipit-source-id: b01b31d58b5b1a2a9532e9cce0892c08960ec31c
2019-09-16 07:48:59 -07:00
Sidharth Guglani
a5c2f7f27a fix yoga build issue Could not find yoga:libfb:unspecified.
Summary:
Fixes the yoga build 1:15:0 build issue

    Could not find yoga:libfb:unspecified.
    Required by:
    project :app > com.facebook.yoga:yoga:1.15.0

libfb dependency was added to solve import issue in YogaPhantomJNIRefs but since we don't have that file now in codebase , it will not be a problem.

Reviewed By: amir-shalem

Differential Revision: D17395380

fbshipit-source-id: ab8eb2c89afe29b4688787db2214c328d875041e
2019-09-16 05:25:39 -07:00
Sidharth Guglani
10811e1a94 bump version to 1.15.0-SNAPSHOT
Summary: Bumping version to 1.15.0-SNAPSHOT

Reviewed By: amir-shalem

Differential Revision: D17394807

fbshipit-source-id: 2ba8ecbb903b9810905fabf3b60efaa8458b6bfd
2019-09-16 04:37:39 -07:00
Sidharth Guglani
10f4bceac0 bump version to 1.15.0
Summary: Bumping version to 1.15.0 for new yoga release

Reviewed By: amir-shalem

Differential Revision: D17394805

fbshipit-source-id: de43e97a0c155f332ecbe4e98b78c2f7c9ffe771
2019-09-16 03:42:43 -07:00
Sidharth Guglani
47717324d4 fix fbjni and yoga event files not found in testutil issue
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/928

Reviewed By: amir-shalem

Differential Revision: D17383979

fbshipit-source-id: 755c2cc3749d5e23fbd1e0ac7a41632c1400ae24
2019-09-15 13:54:06 -07:00
Amir Shalem
1043c35f2b Fix libfbjni compilation (#927)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/927

When D16220924 brought a new fbjni copy (with new directories), we forgot to fix the cmake files which are used by gradle build system.

Reviewed By: SidharthGuglani

Differential Revision: D17367160

fbshipit-source-id: 3e7d20d4c53ff3012a164bf6e32f1000ecb3ffc2
2019-09-13 09:21:06 -07:00
Amir Shalem
fde89b056d Add standalone factory classes which generate YogaNode + YogaConfig
Summary:
Add standalone factory classes which generate YogaNode + YogaConfig, later on it will allow us to separate the yoga interface and actual implementation buck targets (see D17266406)

We've done such breakage change previously in D14122974.

Reviewed By: SidharthGuglani

Differential Revision: D17258196

fbshipit-source-id: b12f1a0d23c3f82b14cee0731a1daf1c015ee32c
2019-09-12 06:05:02 -07:00
Sidharth Guglani
a08a57b33c Remove unused YogaNodeJNIPhantomRefs.java
Summary:
Removed unused file YogaNodeJNIPhantomRefs.java as this was causing oss build failures because of an import.

````:yoga:compileDebugJavaWithJavac/home/travis/build/facebook/yoga/java/com/facebook/yoga/YogaNodeJNIPhantomRefs.java:9: error: package com.facebook.jni does not exist
import com.facebook.jni.DestructorThread;
                       ^
/home/travis/build/facebook/yoga/java/com/facebook/yoga/YogaNodeJNIPhantomRefs.java:30: error: package DestructorThread does not exist
    new DestructorThread.Destructor(node) {
                        ^
2 errors
 FAILED

Reviewed By: pasqualeanatriello

Differential Revision: D17257330

fbshipit-source-id: 98b0c5d5b7dcd94bee559b58194c13b07f47723d
2019-09-11 10:28:56 -07:00
Amir Shalem
31de91bbac fix gradle compliation (#925)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/925

Gradle is failing to compile yoga for two reasons:
1. Ever since `YogaNodeJNIPhantomRefs` was introduced which uses `DestructorThread.Destructor` from fbjni which was the first direct Java dependency from yoga java to fbjni java code.

2. Adding a missing gradle endpoint for `testutil` since it is now required for yoga unit-tests

Reviewed By: SidharthGuglani

Differential Revision: D17274226

fbshipit-source-id: 3df9648321162d34f81fd3675ca1474e8a1c6d3a
2019-09-10 08:18:56 -07:00
Sidharth Guglani
e6e224ce48 Add dist: trusty to yoga travis configuration
Summary:
clang 6.0 install was failing in yoga oss tests

Travis has made xenial as default distribution
https://changelog.travis-ci.com/xenial-as-the-default-build-environment-is-coming-97772

Added dist: trusty to the configuration to fix this.

Reviewed By: passy

Differential Revision: D17257300

fbshipit-source-id: f9fcd6ba774dad1c28bd953c0d850c7078d02015
2019-09-09 03:34:52 -07:00
Paul O'Shannessy
a04a6b5e8f Adopt Contributor Covenant
Summary:
In order to foster healthy open source communities, we're adopting the
[Contributor Covenant](https://www.contributor-covenant.org/). It has been
built by open source community members and represents a shared understanding of
what is expected from a healthy community.

Reviewed By: josephsavona, danobi, rdzhabarov

Differential Revision: D17104640

fbshipit-source-id: d210000de686c5f0d97d602b50472d5869bc6a49
2019-08-29 23:48:24 -07:00
Pascal Hartig
442d84ccfc Remove built-in DoNotStrip annotations
Summary:
Use the Yoga dependency instead which can be deduplicated by Gradle.

This solves (parts of) a bunch of issues concerning the use of
multiple FB libraries in one Android project.

Reviewed By: danielbuechele

Differential Revision: D16783243

fbshipit-source-id: 7f7915821dd286c51ec4ccbd95a2cdcb18b53bde
2019-08-15 04:21:56 -07:00
Pascal Hartig
4a2ccc658e Target Java 7
Summary: The artifacts generated otherwise can cause issues in Android projects.

Reviewed By: SidharthGuglani

Differential Revision: D16803253

fbshipit-source-id: db139560dfbddb917c27bdfd80e1bf5747e4a74b
2019-08-14 05:37:32 -07:00
Pascal Hartig
58622fa747 Set up proguard-annotations as separate Maven artifact
Summary:
We need one place, any place really, to publish that good old `DoNotStrip` annotation
from that we currently copy across various repos, causing havoc for anybody who
tries to integrate more than one FB Android library into their project.

Yoga is very well positioned for this because it's already its own Gradle module and
all that's missing are these few lines.

Reviewed By: SidharthGuglani

Differential Revision: D16783035

fbshipit-source-id: 69b6224a725194d036c6a23a36bd76d3487b9811
2019-08-13 06:26:15 -07:00
Sidharth Guglani
90cded3819 use array for passing measure callback reasons count
Summary:
Use an array for counting measure callbacks due to each reason.
and this is now added as qpl metadata in Layout Calculation qpl event

Reviewed By: davidaurelio

Differential Revision: D16666786

fbshipit-source-id: ff85fba835148f06b9c5d90c4604e552a813777a
2019-08-08 07:18:03 -07:00
Adlai Holler
d1e188341b Don't copy children in YGNodeComputeFlexBasisForChildren (#919)
Summary:
No need for a copy here.
Pull Request resolved: https://github.com/facebook/yoga/pull/919

Differential Revision: D16701461

Pulled By: davidaurelio

fbshipit-source-id: 3a90adbb2b5c43d5aefe693a8525aa3a37e53b3d
2019-08-08 00:24:07 -07:00
Nicola Ferruzzi
0f2350308e Properly test for the lack of a node measure func in YogaKit (#915)
Summary:
The test was broken and caused a few crashes on my project.
Pull Request resolved: https://github.com/facebook/yoga/pull/915

Differential Revision: D16701613

Pulled By: davidaurelio

fbshipit-source-id: 9ab5c43bb74e77593bc2426a249750a7ee8f4034
2019-08-08 00:10:25 -07:00
Luis Miguel Alvarado
9b120eded9 add space-evenly prop to justify-content.md (#918)
Summary:
This PR add the `space-evenly` prop, to the [justify-content.md](https://github.com/facebook/yoga/blob/master/website/contents/properties/justify-content.md) file.

The description was taken from [Mozilla](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content)
Pull Request resolved: https://github.com/facebook/yoga/pull/918

Differential Revision: D16701547

Pulled By: davidaurelio

fbshipit-source-id: cd1bb7dd20cb1184a1bafb0d8f33e851051bd9e5
2019-08-08 00:01:12 -07:00
Tim
a218880216 Fix compilation with CMake (#909)
Summary:
This adds the root of the source tree to the include path, which allow `#include <yoga/YGEnums.h>` to work.

Fixes https://github.com/facebook/yoga/issues/908
Pull Request resolved: https://github.com/facebook/yoga/pull/909

Differential Revision: D16701716

Pulled By: davidaurelio

fbshipit-source-id: 0fdc6479e4f3119a3e4ddbcd4b48541b282c1bbd
2019-08-07 23:53:44 -07:00
Denis
1a2802028b Update link: (#920)
Summary:
Update link for component kit on docs to `https://componentkit.org/docs/getting-started/`
Pull Request resolved: https://github.com/facebook/yoga/pull/920

Differential Revision: D16701505

Pulled By: davidaurelio

fbshipit-source-id: 10f7df4f7aa29d884d21135a92041b0630e1a31e
2019-08-07 19:51:39 -07:00
Tim
a37b286bae Yoga is written in C++ (#907)
Summary:
As far as I can tell now. Would be nice if you had an actual changelog somewhere!
Pull Request resolved: https://github.com/facebook/yoga/pull/907

Differential Revision: D16701738

Pulled By: davidaurelio

fbshipit-source-id: cf32dc96eca5258979bcaa9947d6ed6b5496398d
2019-08-07 19:44:24 -07:00
David Aurelio
dcfdb955b3 Back out "[Yoga] Experiment: double invocations of measure callbacks"
Summary:
Removes the double measure callbacks experiment
Original commit changesets: c6cf9c01a173,  b157d8137c72

Reviewed By: SidharthGuglani

Differential Revision: D16687367

fbshipit-source-id: 9649f8731bd1b27f4d291cee4fa30153165cea02
2019-08-07 18:24:32 -07:00
David Aurelio
72cefead02 Use Bitfield in YGLayout
Summary: Replaces the usage of C++ bitfields with our portable `Bitfield` class.

Reviewed By: SidharthGuglani

Differential Revision: D16656361

fbshipit-source-id: 05f679e2e994e109b2bd1090c879d6850fabdc40
2019-08-07 16:29:04 -07:00
David Aurelio
884e064a99 Use Bitfield in YGNode and YGStyle
Summary:
@public

Replaces the usage of C++ bitfields with our portable `Bitfield` class.

Reviewed By: SidharthGuglani

Differential Revision: D16649875

fbshipit-source-id: 539f016d5e1c9a8c48cc9bacbbf6ed985e385e69
2019-08-07 16:29:03 -07:00
David Aurelio
3ed9bec05c Remove style property bitmask
Summary:
@public

Removes the style properties bitmask. We have used this for experimentation, and it's no longer necessary.

This simplifyies the code, and allows us to cut over to `Bitfield.h` more easily.

Reviewed By: astreet

Differential Revision: D16648862

fbshipit-source-id: 17c0899807af976f4ba34db54f8f0f6a3cd92519
2019-08-07 16:29:03 -07:00
David Aurelio
dadf0473b7 Add portable bit field implementation
Summary:
@public
Our usage of C++ bit fields has lead to quite some problems with different compiler setups. Problems include sign bits, alignment, etc.

Here we introduce a portable implementation as a variadic template, allowing the user to store a number of booleans and enums (defined with `YG_ENUM_SEQ_DECL`) in an unsigned integer type of their choice.

This will replace all usages of bit fields across the Yoga code base.

Differential Revision: D16647801

fbshipit-source-id: 230ffab500885a3ad662ea8f19e35a5e9357a563
2019-08-07 16:29:02 -07:00
Daniel Büchele
947230958d make npm module
Summary: We want to use the yoga playground as a standalone package as well. This adds a webpack config to bundle the playground for npm. The package can then be distributed as `yoga-playground` via npm

Reviewed By: fabiomassimo

Differential Revision: D16583334

fbshipit-source-id: 84807ddd8983ba9f0fb43570b518c975f35544ab
2019-08-01 04:15:25 -07:00
Sidharth Guglani
095c991b85 Added counts for measure callbacks reasons in an array inside qpl annotations
Summary:
Added an array to maintain the counts of each of the reason of measure callbacks
and this is now added as qpl metadata in Layout Calculation qpl event

Reviewed By: davidaurelio

Differential Revision: D16516379

fbshipit-source-id: 201c5d2463f0a921841a0bbfec8f4d5e007000c8
2019-07-31 14:37:37 -07:00
Sidharth Guglani
825da1e868 create two layout pass reason flexLayout and flexMeasure instead of flex
Summary:
We had flex as a reason for both layout and measure. Now creating separating reason flexLayout and flexMeasure in this diff.

Also changed ordering of items in Enum to group layout and measure reasons

Reviewed By: davidaurelio

Differential Revision: D16562350

fbshipit-source-id: 75501f9d4dde0974009193b3991a8acc97b02ad0
2019-07-31 14:37:36 -07:00
Sidharth Guglani
5a25805cb5 Update flow-copy-source to use latest version
Summary:
Fixes vulnerability in mem dependency by updating the version of flow-copy-source in javascript/yarn.lock
da4e4398cb

Reviewed By: danielbuechele

Differential Revision: D16542191

fbshipit-source-id: e900ac2d358883fc269688b93faad3ffbec10f0d
2019-07-31 06:48:07 -07:00
Sidharth Guglani
adff8d96dd remove getInstanceCount usages
Summary:
This diffs removes the usages of getInstanceCount as it has been removed from yoga.
We will add event support in js later to handle these test cases

Reviewed By: davidaurelio

Differential Revision: D16560269

fbshipit-source-id: 52590c426faf87209f8635602b401fd5760af8ab
2019-07-31 06:48:06 -07:00
Sidharth Guglani
8c270e68cc add subdirectories of yoga also to js sources
Summary: Update build file to include subdirectories of yoga also in sources

Reviewed By: davidaurelio

Differential Revision: D16560253

fbshipit-source-id: 5dee4379912e003d4a1fa611882fbf736321615c
2019-07-31 06:48:06 -07:00
Samuel Susla
a2aa1b7fca Fix onDismiss in Modal
Summary:
# Disclaimer:
I might be missing something as the solution I implemented here seems like something that was considered by original author. If this solution isn't good, I have a plan B.

# Problem:
`onDismiss` prop isn't being called once the modal is dismissed, this diff fixes it.

Also I've noticed that `onDismiss` is meant to only work on iOS, why is that? By landing this diff, it'll be called on Android as well so we need to change the docs (https://facebook.github.io/react-native/docs/modal.html#ondismiss).

## Video that shows the problem
Following code is in playground.js P70222409 which just increments number everytime onDismiss is called

{F166303269}

Reviewed By: shergin

Differential Revision: D16109536

fbshipit-source-id: 3fba56f5671912387b217f03b613dffd89614c9d
2019-07-29 11:18:00 -07:00
Min ho Kim
ae956f06fb Fix typos (#25770)
Summary:
Fix typos mostly in comments and some string literals.

## Changelog

[General] [Fixed] - Fix typos
Pull Request resolved: https://github.com/facebook/react-native/pull/25770

Differential Revision: D16437857

Pulled By: cpojer

fbshipit-source-id: ffeb4d6b175e341381352091134f7c97d78c679f
2019-07-23 03:24:00 -07:00
David Aurelio
8c0eed3c75 Add PhantomRef based YogaNode subclass
Summary: Adds a subclass of `YogaNodeJNIBase` that uses `PhantomReference` for deallocating native memory rather than `Object#finalize()`. This should help making garbage collection more efficient.

Reviewed By: amir-shalem

Differential Revision: D16182667

fbshipit-source-id: d310fdb6af184168c43462b24f5e18ab5d0d7ad0
2019-07-19 17:24:49 -07:00
David Aurelio
4e4ef06de1 Implement double measure experiment
Reviewed By: SidharthGuglani

Differential Revision: D16340462

fbshipit-source-id: b157d8137c72f83a3bea46f30d0f46f65055f9ef
2019-07-19 10:40:17 -07:00
David Aurelio
a53c14dc75 Add internal experiments API
Summary: Adds internal API that we can use to conduct experiments.

Reviewed By: SidharthGuglani

Differential Revision: D16340463

fbshipit-source-id: 07a8bb7dbc4a02c5c95f1ad29b18845ab43752cf
2019-07-19 10:40:16 -07:00
Sidharth Guglani
c99fc9c4da using enum struct for LayoutPassReason and LayoutType
Summary: Using enum struct for using enums in form ENUM_NAME::ENUM_VALUE for better code readablility

Reviewed By: davidaurelio

Differential Revision: D16356562

fbshipit-source-id: cbe7adadad78eb5d0756c44679c0e102b7d31ec6
2019-07-18 07:04:47 -07:00
Uladzislau Paulovich
2fb857d73d yoga | Fix error about implicit conversion to bit-field
Summary:
`YGStyle` puts Yoga enums (which are signed integers by default) into bitfields: https://fburl.com/7fowlunu

Mixing signed values and bit-fields can be error-prone and it also fails to build on Windows with `clang-cl` due to `-Wbitfield-constant-conversion` warning being treated as error:

```
stderr: In file included from xplat\yoga\yoga\YGLayout.cpp:8:
In file included from xplat\yoga\yoga/Utils.h:8:
In file included from xplat\yoga\yoga/YGNode.h:13:
xplat\yoga\yoga/YGStyle.h(110,9): error: implicit truncation from 'YGAlign' to bit-field changes value from 4 to -4 [-Werror,-Wbitfield-constant-conversion]
        alignItems_(YGAlignStretch),
```

This diff fixes the problem by making all enums unsigned integers. This change can be problematic only if values of the enums are serialized somewhere. CC: David Aurelio

Reviewed By: davidaurelio

Differential Revision: D16336729

fbshipit-source-id: ee4dabd7bd1ee429e644bd322b375ec2694cc742
2019-07-18 06:20:18 -07:00
Sidharth Guglani
e6dfe04388 Pass reason for measure pass along with measurecallbackend event (#566)
Summary:
Pull Request resolved: https://github.com/facebook/litho/pull/566

Pull Request resolved: https://github.com/facebook/react-native/pull/25702

Pass reason for each measure callback to the flipper plugin

Reviewed By: davidaurelio

Differential Revision: D16221771

fbshipit-source-id: 2e72e1ebb3c7e633d189e7a7a81d655ac9531e51
2019-07-18 05:21:11 -07:00
Sidharth Guglani
5e40e4b682 remove YGMarker code
Summary: Removes code for now unused marker based approach

Reviewed By: davidaurelio

Differential Revision: D16048800

fbshipit-source-id: 228e0e906252782ee0bed543728b666d1f9cc854
2019-07-17 08:11:38 -07:00
Sidharth Guglani
7c891db9af move YGMarkerMeasure and YGMarkerBaselineFn to event based system
Summary: Using yoga event listener for adding systrace sections for measure and baseline events

Reviewed By: davidaurelio

Differential Revision: D16048795

fbshipit-source-id: 3c2161328250184929ed1a3357b8c42ec8ca2e29
2019-07-17 08:11:37 -07:00
David Aurelio
6d916ab063 Do not depend on libfb
Reviewed By: SidharthGuglani

Differential Revision: D16220913

fbshipit-source-id: c6851d8dbda572aa50117b92353460f8a5b6df36
2019-07-17 06:57:18 -07:00
David Aurelio
59d680f4e9 Upgrade fbjni
Summary:
Upgrades Yoga’s copy of *fbjni* to the latest version.

This will enable us

- to move from `finalize()` to `PhantomReference` to deallocate native memory, with the potential of making GC more efficient.
- to remove the internal dependency to *libfb,* allowing apps without an own dependency to ship less code

Reviewed By: passy

Differential Revision: D16220924

fbshipit-source-id: e8233fe2b5403946ff51f43cb6def558ded52fda
2019-07-17 06:57:18 -07:00
Amir Shalem
be305b5d0f Rename fbjni shared library name to the standard soname
Summary:
Before we can upgrade to latest fbjni, we need to make sure our shared libraries are named the same.

Currently when we compile libfbjni it is named as `liblib_fb_fbjni.so`, where as the regular fbjni is expected to be named as `libfbjni.so`

Reviewed By: davidaurelio

Differential Revision: D16250801

fbshipit-source-id: 9a7f0f803d7e525985b40a49edcc0e660e9025f5
2019-07-17 03:35:31 -07:00
Sidharth Guglani
d676d917e3 moved all yoga node jni batching code to YogaNodeJNIBase and removed subclasses
Summary: Removed classes YogaNodeJNI and YogaNodeJNIBatching and all the logic have been moved to base class

Reviewed By: davidaurelio

Differential Revision: D16221484

fbshipit-source-id: 830819f5bc6010291b8bc0c6d90897cea991909f
2019-07-15 11:16:38 -07:00
Sidharth Guglani
838fc3f019 remove useBatchingForLayoutOutputs config param and start using batching for layout outputs
Summary: Removes config param useBatchingForLayoutOutputs and now we are using batching of layout outputs as float array while passing data from c++ to java

Reviewed By: davidaurelio

Differential Revision: D16221483

fbshipit-source-id: 326c668d4dfd13b2cf031f98a84bfa50b1440513
2019-07-15 11:16:38 -07:00
David Aurelio
296982a29e Enable events in OSS
Summary:
- Events are our new approach to instrumentation, and keeping debug code out of the core library
- This has run internally at FB for some time now
- Enabling for OSS, too, to make Java tests pass

Reviewed By: SidharthGuglani

Differential Revision: D16202541

fbshipit-source-id: c13f5270f04bba59f9f0a06d9c793da92b73d4ff
2019-07-12 01:43:49 -07:00
David Aurelio
1d0668692b Make tests runnable with Buck/OSS again
Summary:
Fixes test execution for open source:

- adds hamcrest jar and dependency, as required by buck (to not throw `"Unable to locate hamcrest on the classpath. Please add as a test dependency."`)
- enables events for OSS, to make tests pass

Reviewed By: SidharthGuglani

Differential Revision: D16202542

fbshipit-source-id: a56069de162f739b3b989961b5dc00f3d37f5849
2019-07-12 01:43:48 -07:00
Sidharth Guglani
39e512f691 Add tests for measure and baseline events
Summary: Add tests for measure and baseline events , same as we had in InstrumentationTests for marker based approach

Reviewed By: davidaurelio

Differential Revision: D16074402

fbshipit-source-id: 8b11cd6468420428701fd5be5c57700cbd913d23
2019-07-10 08:50:44 -07:00
Sidharth Guglani
0f250490d4 add baseline start and baseline end events
Summary: Adds Baseline start and end events to be handled later for instrumentation

Reviewed By: davidaurelio

Differential Revision: D16048790

fbshipit-source-id: 8409dbb633168753a7bf8fab20bc6551d113ddd6
2019-07-10 08:50:43 -07:00
Sidharth Guglani
eeae39d707 move YGMarkerLayout to event based system
Summary: Using layoutPassStart and LayoutPassEnd events instead of YGMarkerLayout for instrumentation

Reviewed By: davidaurelio

Differential Revision: D16048789

fbshipit-source-id: 041a35bc2cb1b7281ca83cf9d35041b4011cfeb9
2019-07-10 08:50:42 -07:00
Sidharth Guglani
ce517689ff add tests for layoutPassStart and layoutPassEnd
Summary: Add tests for layout pass start and end , same as what we had in InstrumentationTests for marker based approach

Reviewed By: davidaurelio

Differential Revision: D16073121

fbshipit-source-id: 838f01cb2a41d2d2764ba7ce2f317147f737b287
2019-07-10 08:50:42 -07:00
Sidharth Guglani
9c82ba783f Adds typed event test data for test cases
Summary: We are now using custom TypedEventTestData for test cases as we need to copy some data passed from the yoga event system

Reviewed By: davidaurelio

Differential Revision: D16090931

fbshipit-source-id: 4d11bdbdd73b67172ad4bba4b294c71f1c24cc10
2019-07-10 08:50:41 -07:00
James Burnett
1c8e8d3aec Compile Issues with Recent GCC (#895)
Summary:
GCC 8.3.0 (and possibly all gcc 7+) identified several warnings for signed unsigned integer comparison. With `-Werror` enabled this broke compiling tests. I suspect the warning is related to google/googletest#683. This diff updates those `ASSERT_EQ` calls that attempt to compare signed and unsigned errors by specifically declaring the literals to be unsigned.

There is also an issue with Buck where it will not link to pthreads. facebook/buck#1443. Adding a `prebuilt_cxx_library` for pthread fixes that issue and the tests will compile and run.

Finally, there was a warning about a missing return after a switch in `InstrumentationTest.cpp`. I added a `return ""` as a default, but it might be better to throw something. Thoughts?
Pull Request resolved: https://github.com/facebook/yoga/pull/895

Reviewed By: davidaurelio

Differential Revision: D15393082

Pulled By: davidaurelio

fbshipit-source-id: 4f13ec2f016af39537c08fb591b188a6a0ed55ce
2019-07-04 19:08:18 -07:00
Uladzislau Paulovich
cc27d85110 Remove incorrect constexpr specifier in YGLayout (#25430)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/25430

Pull Request resolved: https://github.com/facebook/litho/pull/561

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

* According to C++ standard values which produce undefined behavior cannot be declared as `constexpr`.
* Expressions which evaluate to `nan, infinity, etc` are undefined behavior.

For more details you can checkout this Stackoverflow answer: https://stackoverflow.com/a/46373136

Reviewed By: davidaurelio

Differential Revision: D16055108

fbshipit-source-id: ee85ba63a714b18bfb8aa8c0770652e184454f74
2019-07-01 08:52:10 -07:00
David Aurelio
cd5324378d Move YG_ENABLE_EVENTS checks to event.h
Summary:
Instead of checking whether `YG_ENABLE_EVENTS` is defined for every publish, we simply wrap the body of the `publish` function macro that delegates to the method that actually publishes the event.

This way we get

1. easier to write code where we publish events
2. more type safety when editing, enabling editors/IDEs to show errors without knowing about `YG_ENABLE_EVENTS`

Reviewed By: SidharthGuglani

Differential Revision: D16049888

fbshipit-source-id: cbf362d6f7be5053c3f377125d303b7137d6a241
2019-06-28 09:58:57 -07:00
David Aurelio
c6ae314202 Stop recording measure callback duration
Summary: Removes time measurements for measure callbacks. This functionality should not be part of Yoga/core, and can now be done by event subscribers themselves, as we have two events per measure callback.

Reviewed By: SidharthGuglani

Differential Revision: D16049812

fbshipit-source-id: e16556f3854e42f4bada39a97a668e718719b22c
2019-06-28 09:58:57 -07:00
David Aurelio
73224c62b5 Publish two events for measure callbacks
Summary: Publishing two events will allow us to replace marker functionality completely with events. This also allows us to remove measuring time spent from Yoga itself.

Reviewed By: SidharthGuglani

Differential Revision: D16049810

fbshipit-source-id: 98628a92ed3c94d479e9fbcd53fac90c5f524087
2019-06-28 09:58:56 -07:00
David Aurelio
2c6a4485f5 Remove duplicate declaration of YGRoundValueToPixelGrid from Yoga-internal.h
Summary:
@public

Removes the declaration of `YGRoundValueToPixelGrid` from `Yoga-internal.h`, as it is already declared in `Yoga.h`. `Yoga.h` is included from `Yoga-internal.h`

Reviewed By: SidharthGuglani

Differential Revision: D16047832

fbshipit-source-id: 72d9d2510372c983eedacc5d7af406b9346f18e6
2019-06-28 05:17:06 -07:00
dattc2
cf005df828 make yoga threadsafe (#852)
Summary:
Continuing https://github.com/facebook/yoga/pull/791
nokia6686 is a former member of our team, so we are trying to pick up what he left and carry out the pull request.
# Solution
Improved from previous solution with jpap's suggestions.
2. Passing ```gDepth``` and ```gCurrentGenerationCount``` (renamed to **_depth_** and **_generationCount_** respectively) between function calls that stem from ```YGNodeCalculateLayout```.
In ```YGNodeCalculateLayout```, pass ```depth``` as value 0, to indicate the root depth.
Pull Request resolved: https://github.com/facebook/yoga/pull/852

Reviewed By: SidharthGuglani

Differential Revision: D15537450

Pulled By: davidaurelio

fbshipit-source-id: 338f51383591ba27702ebe759f6c47c2dede3530
2019-06-25 12:10:23 -07:00
Chris Hopman
f539d68049 Force ordering of :yoga/:yogaForDebug
Summary:
Due to testutil depending on :yoga, we are always linking against both
:yoga and :yogaForDebug in tests. This is only working right now due to luck in
how Buck orders the link line. Adding a dependency is silly but it enforces
that Buck maintain the ordering that we currently have even when it changes how
it does its traversal.

Reviewed By: philipjameson

Differential Revision: D15973581

fbshipit-source-id: 3d18aff578ee4d56175ce5efae52b56aeb2d9586
2019-06-24 17:10:45 -07:00
Sidharth Guglani
39996512fc pass cachedLayout and cachedMeasure measures to plugin
Summary: Passing whether layout cache or measure cache was used or not

Reviewed By: davidaurelio

Differential Revision: D15920937

fbshipit-source-id: a6728e7af07ea228a285f824fbdfddc8130c5990
2019-06-24 08:37:18 -07:00
Sidharth Guglani
2dc5a16d1f Move event NodeLayout to end of NodeLayout step
Summary:
Added event NodeLayoutEnd and this is being used now instead of NodeLayout
It will be used later to add more information about caches

Reviewed By: davidaurelio

Differential Revision: D15920935

fbshipit-source-id: c9f5e193bc8cc70d26ff5d84882d483c9b09f67d
2019-06-24 08:37:17 -07:00
David Aurelio
d667ebd66e Replace relative include
Summary: Replaces the relative include to `YGEnums.h` in `yoga/event/event.h` with `#include <yoga/YGEnums.h>

Reviewed By: SidharthGuglani

Differential Revision: D15778634

fbshipit-source-id: 2bceeb58f26c0d9d0df6c0e7ea20b8ddf68a1ee5
2019-06-21 04:11:36 -07:00
Sidharth Guglani
2b8217ce8d Send measure pass duration
Summary: Send measure callback duration time to yoga plugin

Reviewed By: davidaurelio

Differential Revision: D15917548

fbshipit-source-id: 2c947f14ddbc5932cedd0aab8622260478ec29a6
2019-06-21 02:38:57 -07:00
Stiopa Koltsov
9dac56e824 Migrate Yoga targets to raw_headers
Summary:
In "regular" header mode, Buck will symlink from `buck-out/` to the actual header file. This works fine with GCC and clang, but not with MSVC. Headers will be treated as different file, sidestepping `#pragma once` directives.

As a result, all kinds of symbols get declared twice, leading to compile errors.

Reviewed By: davidaurelio

Differential Revision: D15781947

fbshipit-source-id: a3b4e211b8b74b9ef44fc39471a3009b2cf47260
2019-06-15 12:07:14 -07:00
David Aurelio
a7e8aec3d9 Allow to end markers early
Summary:
Adds the ability to `MarkerSection` to end the marker before it goes out of scope.

This unlocks two scenarios:
- reuse the data associated with a marker after ending it.
- end markers in the middle of a function without adding arbitrary blocks.

Reviewed By: SidharthGuglani

Differential Revision: D15837840

fbshipit-source-id: c0afaeeabd169c65189b5028be54ea7dac3e3b84
2019-06-15 10:26:32 -07:00
David Aurelio
6b5bf570c8 Count the number measure callback invocations
Summary: Counts how many times measure callbacks have been invoked during a layout pass. This is made available via the marker and event APIs.

Reviewed By: SidharthGuglani

Differential Revision: D15836983

fbshipit-source-id: 3835bef94e497375821c9f2ad8209447b4f11518
2019-06-15 10:26:31 -07:00
Sidharth Guglani
a130ac2f9c pass measure callback data from c++ to java
Summary:
Passing Measure callback data - width, widthMeasureMode, height, heightMeasureMode, measuredWidth and measuredHeight along with NodeMeasure event
This data is then propagated to java layer in this diff

Reviewed By: davidaurelio

Differential Revision: D15697523

fbshipit-source-id: 615463da237175ff88abef3f6528b55333ccd915
2019-06-12 00:33:31 -07:00
405 changed files with 11193 additions and 6917 deletions

View File

@@ -1,5 +1,6 @@
language: java language: java
os: linux os: linux
dist: trusty
addons: addons:
apt: apt:
sources: sources:

9
BUCK
View File

@@ -17,9 +17,9 @@ TEST_COMPILER_FLAGS = BASE_COMPILER_FLAGS + GMOCK_OVERRIDE_FLAGS + [
yoga_cxx_library( yoga_cxx_library(
name = "yoga", name = "yoga",
srcs = glob(["yoga/**/*.cpp"]), srcs = glob(["yoga/**/*.cpp"]),
header_namespace = "",
exported_headers = subdir_glob([("", "yoga/**/*.h")]),
compiler_flags = LIBRARY_COMPILER_FLAGS, compiler_flags = LIBRARY_COMPILER_FLAGS,
public_include_directories = ["."],
raw_headers = glob(["yoga/**/*.h"]),
soname = "libyogacore.$(ext)", soname = "libyogacore.$(ext)",
tests = [":YogaTests"], tests = [":YogaTests"],
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
@@ -31,13 +31,14 @@ yoga_cxx_library(
yoga_cxx_library( yoga_cxx_library(
name = "yogaForDebug", name = "yogaForDebug",
srcs = glob(["yoga/**/*.cpp"]), srcs = glob(["yoga/**/*.cpp"]),
header_namespace = "",
exported_headers = subdir_glob([("", "yoga/**/*.h")]),
compiler_flags = TEST_COMPILER_FLAGS, compiler_flags = TEST_COMPILER_FLAGS,
public_include_directories = ["."],
raw_headers = glob(["yoga/**/*.h"]),
soname = "libyogacore.$(ext)", soname = "libyogacore.$(ext)",
tests = [":YogaTests"], tests = [":YogaTests"],
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
deps = [ deps = [
":yoga",
yoga_dep("lib/fb:ndklog"), yoga_dep("lib/fb:ndklog"),
], ],
) )

View File

@@ -1,16 +1,24 @@
#
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates.
# #
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
#
cmake_minimum_required(VERSION 3.4.1) cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_VERBOSE_MAKEFILE on)
file(GLOB yogacore_SRC yoga/*.cpp) add_compile_options(
-fno-omit-frame-pointer
-fexceptions
-fvisibility=hidden
-ffunction-sections
-fdata-sections
-Wall
-std=c++11)
file(GLOB_RECURSE yogacore_SRC yoga/*.cpp)
add_library(yogacore STATIC ${yogacore_SRC}) add_library(yogacore STATIC ${yogacore_SRC})
target_include_directories(yogacore PUBLIC .)
target_link_libraries(yogacore android log) target_link_libraries(yogacore android log)
set_target_properties(yogacore PROPERTIES CXX_STANDARD 11) set_target_properties(yogacore PROPERTIES CXX_STANDARD 11)

View File

@@ -1,3 +1,77 @@
# Code of Conduct # Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated. ## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@fb.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -1,7 +1,7 @@
# Yoga [![CocoaPods](https://img.shields.io/cocoapods/v/YogaKit.svg)](http://cocoapods.org/pods/YogaKit) [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![bintray](https://img.shields.io/bintray/v/facebook/maven/com.facebook.yoga:yoga.svg)](https://bintray.com/facebook/maven/com.facebook.yoga%3Ayoga/_latestVersion) [![NuGet](https://img.shields.io/nuget/v/Facebook.Yoga.svg)](https://www.nuget.org/packages/Facebook.Yoga) # Yoga [![CocoaPods](https://img.shields.io/cocoapods/v/YogaKit.svg)](http://cocoapods.org/pods/YogaKit) [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![bintray](https://img.shields.io/bintray/v/facebook/maven/com.facebook.yoga:yoga.svg)](https://bintray.com/facebook/maven/com.facebook.yoga%3Ayoga/_latestVersion) [![NuGet](https://img.shields.io/nuget/v/Facebook.Yoga.svg)](https://www.nuget.org/packages/Facebook.Yoga)
## Building ## Building
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable. Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
## Testing ## Testing
For testing we rely on [gtest](https://github.com/google/googletest) as a submodule. After cloning Yoga run `git submodule init` followed by `git submodule update`. For testing we rely on [gtest](https://github.com/google/googletest) as a submodule. After cloning Yoga run `git submodule init` followed by `git submodule update`.

View File

@@ -859,9 +859,6 @@
597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; };
597633391F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; 597633391F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; };
598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; 598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; };
598FD1951F817335006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; };
598FD1961F817335006C54CB /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.m */; };
598FD1971F817336006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; };
599FAA361FB274980058CCF6 /* RCTSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; }; 599FAA361FB274980058CCF6 /* RCTSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; };
599FAA371FB274980058CCF6 /* RCTSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; }; 599FAA371FB274980058CCF6 /* RCTSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 599FAA2A1FB274970058CCF6 /* RCTSurface.h */; };
599FAA381FB274980058CCF6 /* RCTSurface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA2B1FB274970058CCF6 /* RCTSurface.mm */; }; 599FAA381FB274980058CCF6 /* RCTSurface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 599FAA2B1FB274970058CCF6 /* RCTSurface.mm */; };
@@ -999,7 +996,6 @@
8507BBBF21EDACC200AEAFCA /* JSCExecutorFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */; }; 8507BBBF21EDACC200AEAFCA /* JSCExecutorFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */; };
8507BBC021EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */; }; 8507BBC021EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */; };
8507BBC121EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */; }; 8507BBC121EDACC200AEAFCA /* JSCExecutorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */; };
916F9C2D1F743F57002E5920 /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.m */; };
A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; }; A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; }; A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; };
A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; }; A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
@@ -2059,8 +2055,6 @@
83F15A171B7CC46900F10295 /* UIView+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Private.h"; sourceTree = "<group>"; }; 83F15A171B7CC46900F10295 /* UIView+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Private.h"; sourceTree = "<group>"; };
8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSCExecutorFactory.mm; sourceTree = "<group>"; }; 8507BBBC21EDACC200AEAFCA /* JSCExecutorFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JSCExecutorFactory.mm; sourceTree = "<group>"; };
8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCExecutorFactory.h; sourceTree = "<group>"; }; 8507BBBD21EDACC200AEAFCA /* JSCExecutorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCExecutorFactory.h; sourceTree = "<group>"; };
91076A871F743AB00081B4FA /* RCTModalManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTModalManager.m; sourceTree = "<group>"; };
91076A881F743AB00081B4FA /* RCTModalManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTModalManager.h; sourceTree = "<group>"; };
A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReloadCommand.h; sourceTree = "<group>"; }; A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReloadCommand.h; sourceTree = "<group>"; };
A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReloadCommand.m; sourceTree = "<group>"; }; A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReloadCommand.m; sourceTree = "<group>"; };
AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = "<group>"; }; AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = "<group>"; };
@@ -2405,8 +2399,6 @@
83392EB21B6634E10013B15F /* RCTModalHostViewController.m */, 83392EB21B6634E10013B15F /* RCTModalHostViewController.m */,
83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */, 83A1FE8D1B62643A00BE0E65 /* RCTModalHostViewManager.h */,
83A1FE8E1B62643A00BE0E65 /* RCTModalHostViewManager.m */, 83A1FE8E1B62643A00BE0E65 /* RCTModalHostViewManager.m */,
91076A881F743AB00081B4FA /* RCTModalManager.h */,
91076A871F743AB00081B4FA /* RCTModalManager.m */,
58114A121AAE854800E7D092 /* RCTPicker.h */, 58114A121AAE854800E7D092 /* RCTPicker.h */,
58114A131AAE854800E7D092 /* RCTPicker.m */, 58114A131AAE854800E7D092 /* RCTPicker.m */,
58114A141AAE854800E7D092 /* RCTPickerManager.h */, 58114A141AAE854800E7D092 /* RCTPickerManager.h */,
@@ -3028,7 +3020,6 @@
3D7BFD301EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */, 3D7BFD301EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */,
59EDBCA81FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */, 59EDBCA81FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */,
3D302F6C1DF828F800D6DDAE /* RCTAnimationType.h in Headers */, 3D302F6C1DF828F800D6DDAE /* RCTAnimationType.h in Headers */,
598FD1951F817335006C54CB /* RCTModalManager.h in Headers */,
657734871EE834E000A0E9EA /* RCTInspectorDevServerHelper.h in Headers */, 657734871EE834E000A0E9EA /* RCTInspectorDevServerHelper.h in Headers */,
3D302F6D1DF828F800D6DDAE /* RCTAutoInsetsProtocol.h in Headers */, 3D302F6D1DF828F800D6DDAE /* RCTAutoInsetsProtocol.h in Headers */,
3D302F6E1DF828F800D6DDAE /* RCTBorderDrawing.h in Headers */, 3D302F6E1DF828F800D6DDAE /* RCTBorderDrawing.h in Headers */,
@@ -3189,7 +3180,6 @@
3D80DA2D1DF820620028D040 /* RCTFrameUpdate.h in Headers */, 3D80DA2D1DF820620028D040 /* RCTFrameUpdate.h in Headers */,
3D80DA2E1DF820620028D040 /* RCTImageSource.h in Headers */, 3D80DA2E1DF820620028D040 /* RCTImageSource.h in Headers */,
3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */, 3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */,
598FD1971F817336006C54CB /* RCTModalManager.h in Headers */,
599FAA3A1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */, 599FAA3A1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */,
3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */, 3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */,
3DCE53281FEAB23100613583 /* RCTDatePicker.h in Headers */, 3DCE53281FEAB23100613583 /* RCTDatePicker.h in Headers */,
@@ -4002,7 +3992,6 @@
2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */, 2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */,
599FAA451FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */, 599FAA451FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */,
2D3B5EC81D9B095800451313 /* RCTActivityIndicatorViewManager.m in Sources */, 2D3B5EC81D9B095800451313 /* RCTActivityIndicatorViewManager.m in Sources */,
598FD1961F817335006C54CB /* RCTModalManager.m in Sources */,
3DCD185D1DF978E7007FE5A1 /* RCTReloadCommand.m in Sources */, 3DCD185D1DF978E7007FE5A1 /* RCTReloadCommand.m in Sources */,
130443DB1E401ADD00D93A67 /* RCTConvert+Transform.m in Sources */, 130443DB1E401ADD00D93A67 /* RCTConvert+Transform.m in Sources */,
3D0B84301EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m in Sources */, 3D0B84301EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m in Sources */,
@@ -4254,7 +4243,6 @@
391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */, 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */,
1450FF861BCFF28A00208362 /* RCTProfile.m in Sources */, 1450FF861BCFF28A00208362 /* RCTProfile.m in Sources */,
13AB90C11B6FA36700713B4F /* RCTComponentData.m in Sources */, 13AB90C11B6FA36700713B4F /* RCTComponentData.m in Sources */,
916F9C2D1F743F57002E5920 /* RCTModalManager.m in Sources */,
F1EFDA50201F661000EE6E4C /* RCTUIUtils.m in Sources */, F1EFDA50201F661000EE6E4C /* RCTUIUtils.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@@ -1,9 +1,8 @@
#
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates.
# #
# This source code is licensed under the MIT license found in the LICENSE # This source code is licensed under the MIT license found in the
# file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
#
Pod::Spec.new do |spec| Pod::Spec.new do |spec|
spec.name = 'Yoga' spec.name = 'Yoga'
spec.version = '1.14.0' spec.version = '1.14.0'

View File

@@ -1,12 +1,11 @@
#
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates.
# #
# This source code is licensed under the MIT license found in the LICENSE # This source code is licensed under the MIT license found in the
# file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
#
podspec = Pod::Spec.new do |spec| podspec = Pod::Spec.new do |spec|
spec.name = 'YogaKit' spec.name = 'YogaKit'
spec.version = '1.14.0' spec.version = '1.17.0'
spec.license = { :type => 'MIT', :file => "LICENSE" } spec.license = { :type => 'MIT', :file => "LICENSE" }
spec.homepage = 'https://facebook.github.io/yoga/' spec.homepage = 'https://facebook.github.io/yoga/'
spec.documentation_url = 'https://facebook.github.io/yoga/docs/' spec.documentation_url = 'https://facebook.github.io/yoga/docs/'
@@ -23,11 +22,20 @@ podspec = Pod::Spec.new do |spec|
spec.platform = :ios spec.platform = :ios
spec.ios.deployment_target = '8.0' spec.ios.deployment_target = '8.0'
spec.ios.frameworks = 'UIKit' spec.ios.frameworks = 'UIKit'
spec.default_subspec = "Core"
spec.dependency 'Yoga', '~> 1.14' spec.dependency 'Yoga', '~> 1.14'
spec.source_files = 'YogaKit/Source/*.{h,m,swift}' spec.module_name = 'YogaKit'
spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h'
spec.private_header_files = 'YogaKit/Source/YGLayout+Private.h' spec.subspec "Core" do |ss|
spec.swift_version = '4.0' ss.source_files = 'YogaKit/Source/*.{h,m}'
ss.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h'
ss.private_header_files = 'YogaKit/Source/YGLayout+Private.h'
end
spec.subspec 'SwiftExtension' do |ss|
ss.source_files = 'YogaKit/Source/*.{swift}'
end
end end
# See https://github.com/facebook/yoga/pull/366 # See https://github.com/facebook/yoga/pull/366

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#import "YGLayout.h" #import "YGLayout.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#import "YGLayout.h" #import "YGLayout.h"
#import <yoga/Yoga.h> #import <yoga/Yoga.h>

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <yoga/YGEnums.h> #import <yoga/YGEnums.h>
#import <yoga/Yoga.h> #import <yoga/Yoga.h>

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the
@@ -180,7 +180,7 @@ static YGConfigRef globalConfig;
// the measure function. Since we already know that this is a leaf, // the measure function. Since we already know that this is a leaf,
// this *should* be fine. Forgive me Hack Gods. // this *should* be fine. Forgive me Hack Gods.
const YGNodeRef node = self.node; const YGNodeRef node = self.node;
if (YGNodeHasMeasureFunc(node)) { if (!YGNodeHasMeasureFunc(node)) {
YGNodeSetMeasureFunc(node, YGMeasureView); YGNodeSetMeasureFunc(node, YGMeasureView);
} }

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import Foundation import Foundation

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import UIKit import UIKit

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import UIKit import UIKit

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#import "ViewController.h" #import "ViewController.h"

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import UIKit import UIKit

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import UIKit import UIKit

View File

@@ -1,9 +1,8 @@
/** /*
* Copyright 2014-present, Facebook, Inc. * Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* *
* This source code is licensed under the license found in the * This source code is licensed under the MIT license found in the
* LICENSE-examples file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
import UIKit import UIKit

View File

@@ -3,7 +3,7 @@
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "yoga_android_aar", "yoga_android_resource") load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "yoga_android_aar", "yoga_android_resource")
yoga_android_aar( yoga_android_aar(
name = "android", name = "android",
@@ -14,7 +14,6 @@ yoga_android_aar(
deps = [ deps = [
ANDROID_JAVA_TARGET, ANDROID_JAVA_TARGET,
ANDROID_RES_TARGET, ANDROID_RES_TARGET,
INFER_ANNOTATIONS_TARGET,
JAVA_TARGET, JAVA_TARGET,
PROGRUARD_ANNOTATIONS_TARGET, PROGRUARD_ANNOTATIONS_TARGET,
], ],

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;
import android.content.Intent; import android.content.Intent;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;
import java.io.File; import java.io.File;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;
import android.os.Bundle; import android.os.Bundle;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;
import android.os.Bundle; import android.os.Bundle;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;
import android.os.Bundle; import android.os.Bundle;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.samples.yoga;
import android.content.Intent; import android.content.Intent;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga.android; package com.facebook.yoga.android;
import java.util.HashMap; import java.util.HashMap;
@@ -17,6 +18,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.facebook.yoga.YogaNode; import com.facebook.yoga.YogaNode;
import com.facebook.yoga.YogaNodeFactory;
/** /**
* Much like a {@link YogaLayout}, except this class does not render itself (the container) to the * Much like a {@link YogaLayout}, except this class does not render itself (the container) to the
@@ -32,7 +34,7 @@ public class VirtualYogaLayout extends ViewGroup {
final private List<View> mChildren = new LinkedList<>(); final private List<View> mChildren = new LinkedList<>();
final private Map<View, YogaNode> mYogaNodes = new HashMap<>(); final private Map<View, YogaNode> mYogaNodes = new HashMap<>();
final private YogaNode mYogaNode = YogaNode.create(); final private YogaNode mYogaNode = YogaNodeFactory.create();
public VirtualYogaLayout(Context context) { public VirtualYogaLayout(Context context) {
super(context); super(context);
@@ -72,7 +74,7 @@ public class VirtualYogaLayout extends ViewGroup {
return; return;
} }
YogaNode node = YogaNode.create(); YogaNode node = YogaNodeFactory.create();
YogaLayout.LayoutParams lp = new YogaLayout.LayoutParams(params); YogaLayout.LayoutParams lp = new YogaLayout.LayoutParams(params);
YogaLayout.applyLayoutParams(lp, node, child); YogaLayout.applyLayoutParams(lp, node, child);
node.setData(child); node.setData(child);

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga.android; package com.facebook.yoga.android;
import android.content.Context; import android.content.Context;
@@ -28,6 +29,7 @@ import com.facebook.yoga.YogaMeasureFunction;
import com.facebook.yoga.YogaMeasureMode; import com.facebook.yoga.YogaMeasureMode;
import com.facebook.yoga.YogaMeasureOutput; import com.facebook.yoga.YogaMeasureOutput;
import com.facebook.yoga.YogaNode; import com.facebook.yoga.YogaNode;
import com.facebook.yoga.YogaNodeFactory;
import com.facebook.yoga.YogaOverflow; import com.facebook.yoga.YogaOverflow;
import com.facebook.yoga.YogaPositionType; import com.facebook.yoga.YogaPositionType;
import com.facebook.yoga.YogaWrap; import com.facebook.yoga.YogaWrap;
@@ -77,7 +79,7 @@ public class YogaLayout extends ViewGroup {
public YogaLayout(Context context, AttributeSet attrs, int defStyleAttr) { public YogaLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
mYogaNode = YogaNode.create(); mYogaNode = YogaNodeFactory.create();
mYogaNodes = new HashMap<>(); mYogaNodes = new HashMap<>();
mYogaNode.setData(this); mYogaNode.setData(this);
@@ -154,7 +156,7 @@ public class YogaLayout extends ViewGroup {
if(mYogaNodes.containsKey(child)) { if(mYogaNodes.containsKey(child)) {
childNode = mYogaNodes.get(child); childNode = mYogaNodes.get(child);
} else { } else {
childNode = YogaNode.create(); childNode = YogaNodeFactory.create();
} }
childNode.setData(child); childNode.setData(child);

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga.android; package com.facebook.yoga.android;
import android.content.Context; import android.content.Context;

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the
@@ -34,7 +34,7 @@ ext {
minSdkVersion = 14 minSdkVersion = 14
targetSdkVersion = 25 targetSdkVersion = 25
compileSdkVersion = 26 compileSdkVersion = 26
buildToolsVersion = '26.0.2' buildToolsVersion = '28.0.3'
sourceCompatibilityVersion = JavaVersion.VERSION_1_7 sourceCompatibilityVersion = JavaVersion.VERSION_1_7
targetCompatibilityVersion = JavaVersion.VERSION_1_7 targetCompatibilityVersion = JavaVersion.VERSION_1_7
} }

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,10 +1,7 @@
#!/bin/sh #!/bin/sh
#
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates.
# #
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
#
./csharp/Mac/Facebook.Yoga.Mac.Tests/bin/Release/Facebook.Yoga.Mac.Tests.app/Contents/MacOS/Facebook.Yoga.Mac.Tests ./csharp/Mac/Facebook.Yoga.Mac.Tests/bin/Release/Facebook.Yoga.Mac.Tests.app/Contents/MacOS/Facebook.Yoga.Mac.Tests

View File

@@ -1,3 +1,10 @@
/*
* Copyright (c) Facebook, Inc. and its 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; using System;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Facebook.Yoga; using Facebook.Yoga;

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#include "YGInterop.h" #include "YGInterop.h"
static YGInteropLogger gManagedLogger; static YGInteropLogger gManagedLogger;

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#pragma once #pragma once
#include <yoga/Yoga.h> #include <yoga/Yoga.h>

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
// dllmain.cpp : Defines the entry point for the DLL application. // dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h" #include "stdafx.h"

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // Microsoft Visual C++ generated include file.
// Used by Yoga.rc // Used by Yoga.rc

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
// stdafx.cpp : source file that includes just the standard includes // stdafx.cpp : source file that includes just the standard includes
// Yoga.pch will be the pre-compiled header // Yoga.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information // stdafx.obj will contain the pre-compiled type information

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
// stdafx.h : include file for standard system include files, // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but // or project specific include files that are used frequently, but
// are changed infrequently // are changed infrequently

View File

@@ -1,9 +1,10 @@
/* /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
#pragma once #pragma once
// Including SDKDDKVer.h defines the highest available Windows platform. // Including SDKDDKVer.h defines the highest available Windows platform.

View File

@@ -1,11 +1,8 @@
#!/bin/sh #!/bin/sh
#
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates.
# #
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
#
cd `dirname "$0"` cd `dirname "$0"`
echo $ANDROID_SDK echo $ANDROID_SDK

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the

View File

@@ -1,4 +1,9 @@
#!/bin/sh #!/bin/sh
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
if mcs --version >/dev/null 2>&1 && mono --version >/dev/null 2>&1; then true; else if mcs --version >/dev/null 2>&1 && mono --version >/dev/null 2>&1; then true; else
echo "ERROR: Need to install Mono (brew install mono, or http://www.mono-project.com/download/)" echo "ERROR: Need to install Mono (brew install mono, or http://www.mono-project.com/download/)"
exit 1 exit 1

View File

@@ -72,7 +72,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
this.push('public void test_' + name + '() {'); this.push('public void test_' + name + '() {');
this.pushIndent(); this.pushIndent();
this.push("YogaConfig config = new YogaConfig();") this.push("YogaConfig config = YogaConfigFactory.create();")
for (var i in experiments) { for (var i in experiments) {
this.push('config.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);'); this.push('config.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);');
} }

View File

@@ -1,4 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require 'watir' require 'watir'
require 'fileutils' require 'fileutils'

View File

@@ -9,7 +9,7 @@
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
VERSION_NAME=1.14.0-SNAPSHOT VERSION_NAME=1.16.0-SNAPSHOT
POM_URL=https://github.com/facebook/yoga POM_URL=https://github.com/facebook/yoga
POM_SCM_URL=https://github.com/facebook/yoga.git POM_SCM_URL=https://github.com/facebook/yoga.git
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git

View File

@@ -1,3 +1,10 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Configure the Android maven publication // Configure the Android maven publication
apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.github.dcendents.android-maven'

View File

@@ -1,3 +1,10 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Android tasks for Javadoc and sources.jar generation // Android tasks for Javadoc and sources.jar generation
afterEvaluate { project -> afterEvaluate { project ->

View File

@@ -1,3 +1,10 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Upload to Bintray // Upload to Bintray
apply plugin: 'com.jfrog.bintray' apply plugin: 'com.jfrog.bintray'

View File

@@ -1,3 +1,10 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Set up everything required for releasing on Bintray // Set up everything required for releasing on Bintray
ext { ext {
bintrayRepo = 'maven' bintrayRepo = 'maven'

View File

@@ -1,3 +1,10 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Common Android tasks for all releases that generate Javadocs, sources, etc. // Common Android tasks for all releases that generate Javadocs, sources, etc.
apply from: rootProject.file('gradle/android-tasks.gradle') apply from: rootProject.file('gradle/android-tasks.gradle')

View File

@@ -3,13 +3,19 @@
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "CXX_LIBRARY_WHITELIST", "FBJNI_JAVA_TARGET", "FBJNI_TARGET", "INFER_ANNOTATIONS_TARGET", "JNI_TARGET", "JSR_305_TARGET", "JUNIT_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "yoga_cxx_lib", "yoga_cxx_library", "yoga_dep", "yoga_java_binary", "yoga_java_library", "yoga_java_test") load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "CXX_LIBRARY_WHITELIST", "FBJNI_JAVA_TARGET", "FBJNI_TARGET", "JNI_TARGET", "JSR_305_TARGET", "JUNIT_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "yoga_cxx_lib", "yoga_cxx_library", "yoga_dep", "yoga_java_binary", "yoga_java_library", "yoga_java_test")
CXX_LIBRARY_WHITELIST_FOR_TESTS = CXX_LIBRARY_WHITELIST + [ CXX_LIBRARY_WHITELIST_FOR_TESTS = CXX_LIBRARY_WHITELIST + [
yoga_cxx_lib("testutil:jni"), yoga_cxx_lib("testutil:jni"),
yoga_cxx_lib("testutil:testutil"), yoga_cxx_lib("testutil:testutil"),
] ]
YOGA_JAVA_IMPLEMENTATION_FILES = [
"com/facebook/yoga/*JNI*.java",
"com/facebook/yoga/*Factory.java",
"com/facebook/yoga/YogaNative.java",
]
yoga_cxx_library( yoga_cxx_library(
name = "jni", name = "jni",
srcs = glob(["jni/*.cpp"]), srcs = glob(["jni/*.cpp"]),
@@ -19,6 +25,9 @@ yoga_cxx_library(
compiler_flags = [ compiler_flags = [
"-fno-omit-frame-pointer", "-fno-omit-frame-pointer",
"-fexceptions", "-fexceptions",
"-fvisibility=hidden",
"-ffunction-sections",
"-fdata-sections",
"-fPIC", "-fPIC",
"-Wall", "-Wall",
"-Werror", "-Werror",
@@ -38,9 +47,40 @@ yoga_cxx_library(
], ],
) )
yoga_java_library(
name = "java-interface",
srcs = glob(
["com/facebook/yoga/*.java"],
exclude = YOGA_JAVA_IMPLEMENTATION_FILES,
),
required_for_source_only_abi = True,
source = "1.7",
target = "1.7",
visibility = ["PUBLIC"],
deps = [
JSR_305_TARGET,
PROGRUARD_ANNOTATIONS_TARGET,
],
)
yoga_java_library(
name = "java-impl",
srcs = glob(YOGA_JAVA_IMPLEMENTATION_FILES),
required_for_source_only_abi = True,
source = "1.7",
target = "1.7",
deps = [
":java-interface",
":jni",
FBJNI_JAVA_TARGET,
JSR_305_TARGET,
PROGRUARD_ANNOTATIONS_TARGET,
SOLOADER_TARGET,
],
)
yoga_java_library( yoga_java_library(
name = "java", name = "java",
srcs = glob(["com/facebook/yoga/*.java"]),
required_for_source_only_abi = True, required_for_source_only_abi = True,
source = "1.7", source = "1.7",
target = "1.7", target = "1.7",
@@ -48,12 +88,9 @@ yoga_java_library(
yoga_dep("java:tests"), yoga_dep("java:tests"),
], ],
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
deps = [ exported_deps = [
":jni", ":java-impl",
INFER_ANNOTATIONS_TARGET, ":java-interface",
JSR_305_TARGET,
PROGRUARD_ANNOTATIONS_TARGET,
SOLOADER_TARGET,
], ],
) )

View File

@@ -1,9 +1,7 @@
#
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) Facebook, Inc. and its affiliates.
# #
# This source code is licensed under the MIT license found in the # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
#
cmake_minimum_required(VERSION 3.4.1) cmake_minimum_required(VERSION 3.4.1)
@@ -26,13 +24,19 @@ add_subdirectory(${yogacore_DIR} ${yogacore_build_DIR})
add_compile_options( add_compile_options(
-fno-omit-frame-pointer -fno-omit-frame-pointer
-fexceptions -fexceptions
-fvisibility=hidden
-ffunction-sections
-fdata-sections
-Wall -Wall
-std=c++11) -std=c++11)
add_library(yoga SHARED jni/YGJNI.cpp jni/YGJTypes.cpp) file(GLOB jni_SRC
jni/*.cpp)
add_library(yoga SHARED ${jni_SRC})
target_include_directories(yoga PRIVATE target_include_directories(yoga PRIVATE
${libfb_DIR}/include ${libfb_DIR}/include
${yogacore_DIR}) ${yogacore_DIR})
target_link_libraries(yoga yogacore fb) target_link_libraries(yoga -Wl,--gc-sections yogacore fb)

View File

@@ -1,4 +1,4 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the * This source code is licensed under the MIT license found in the
@@ -58,10 +58,11 @@ android {
} }
dependencies { dependencies {
compileOnly 'com.google.code.findbugs:jsr305:3.0.1' implementation 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly project(':yoga:proguard-annotations') implementation project(':yoga:proguard-annotations')
implementation 'com.facebook.soloader:soloader:0.5.1' implementation 'com.facebook.soloader:soloader:0.5.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation project(':testutil')
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.yoga;
public enum LayoutPassReason {
INITIAL(0),
ABS_LAYOUT(1),
STRETCH(2),
MULTILINE_STRETCH(3),
FLEX_LAYOUT(4),
MEASURE(5),
ABS_MEASURE(6),
FLEX_MEASURE(7);
private final int mIntValue;
LayoutPassReason(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static LayoutPassReason fromInt(int value) {
switch (value) {
case 0: return INITIAL;
case 1: return ABS_LAYOUT;
case 2: return STRETCH;
case 3: return MULTILINE_STRETCH;
case 4: return FLEX_LAYOUT;
case 5: return MEASURE;
case 6: return ABS_MEASURE;
case 7: return FLEX_MEASURE;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
}

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;

View File

@@ -1,80 +1,45 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.soloader.SoLoader; public abstract class YogaConfig {
public class YogaConfig {
public static int SPACING_TYPE = 1; public static int SPACING_TYPE = 1;
public static boolean useBatchingForLayoutOutputs = false;
long mNativePointer; public abstract void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled);
private YogaLogger mLogger;
private YogaNodeCloneFunction mYogaNodeCloneFunction;
public YogaConfig() { public abstract void setUseWebDefaults(boolean useWebDefaults);
mNativePointer = YogaNative.jni_YGConfigNew();
if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory");
}
}
@Override public abstract void setPrintTreeFlag(boolean enable);
protected void finalize() throws Throwable {
try {
YogaNative.jni_YGConfigFree(mNativePointer);
} finally {
super.finalize();
}
}
public void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled) {
YogaNative.jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled);
}
public void setUseWebDefaults(boolean useWebDefaults) {
YogaNative.jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults);
}
public void setPrintTreeFlag(boolean enable) {
YogaNative.jni_YGConfigSetPrintTreeFlag(mNativePointer, enable);
}
public void setPointScaleFactor(float pixelsInPoint) {
YogaNative.jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
}
public abstract void setPointScaleFactor(float pixelsInPoint);
/** /**
* Yoga previously had an error where containers would take the maximum space possible instead of the minimum * Yoga previously had an error where containers would take the maximum space possible instead of the minimum
* like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch; * like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour. * Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
*/ */
public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) { public abstract void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour);
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
}
/** /**
* If this flag is set then yoga would diff the layout without legacy flag and would set a bool in * If this flag is set then yoga would diff the layout without legacy flag and would set a bool in
* YogaNode(mDoesLegacyStretchFlagAffectsLayout) with true if the layouts were different and false * YogaNode(mDoesLegacyStretchFlagAffectsLayout) with true if the layouts were different and false
* if not * if not
*/ */
public void setShouldDiffLayoutWithoutLegacyStretchBehaviour( public abstract void setShouldDiffLayoutWithoutLegacyStretchBehaviour(
boolean shouldDiffLayoutWithoutLegacyStretchBehaviour) { boolean shouldDiffLayoutWithoutLegacyStretchBehaviour);
YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
}
public void setLogger(YogaLogger logger) { public abstract void setLogger(YogaLogger logger);
mLogger = logger;
YogaNative.jni_YGConfigSetLogger(mNativePointer, logger);
}
public YogaLogger getLogger() { public abstract YogaLogger getLogger();
return mLogger;
} abstract long getNativePointer();
public abstract void setUseVanillaJNI(boolean useVanillaJNI);
public abstract boolean useVanillaJNI();
} }

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.yoga;
public abstract class YogaConfigFactory {
public static YogaConfig create() {
return new YogaConfigJNIFinalizer();
}
public static YogaConfig create(boolean useVanillaJNI) {
return new YogaConfigJNIFinalizer(useVanillaJNI);
}
}

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.yoga;
public abstract class YogaConfigJNIBase extends YogaConfig {
long mNativePointer;
private YogaLogger mLogger;
protected boolean useVanillaJNI = false;
private YogaConfigJNIBase(long nativePointer) {
if (nativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory");
}
mNativePointer = nativePointer;
}
YogaConfigJNIBase() {
this(YogaNative.jni_YGConfigNew());
}
YogaConfigJNIBase(boolean useVanillaJNI) {
this(useVanillaJNI ? YogaNative.jni_YGConfigNewJNI() : YogaNative.jni_YGConfigNew());
this.useVanillaJNI = useVanillaJNI;
}
public void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetExperimentalFeatureEnabledJNI(mNativePointer, feature.intValue(), enabled);
else
YogaNative.jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled);
}
public void setUseWebDefaults(boolean useWebDefaults) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetUseWebDefaultsJNI(mNativePointer, useWebDefaults);
else
YogaNative.jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults);
}
public void setPrintTreeFlag(boolean enable) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetPrintTreeFlagJNI(mNativePointer, enable);
else
YogaNative.jni_YGConfigSetPrintTreeFlag(mNativePointer, enable);
}
public void setPointScaleFactor(float pixelsInPoint) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetPointScaleFactorJNI(mNativePointer, pixelsInPoint);
else
YogaNative.jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
}
/**
* Yoga previously had an error where containers would take the maximum space possible instead of the minimum
* like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
*/
public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviourJNI(mNativePointer, useLegacyStretchBehaviour);
else
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
}
/**
* If this flag is set then yoga would diff the layout without legacy flag and would set a bool in
* YogaNode(mDoesLegacyStretchFlagAffectsLayout) with true if the layouts were different and false
* if not
*/
public void setShouldDiffLayoutWithoutLegacyStretchBehaviour(
boolean shouldDiffLayoutWithoutLegacyStretchBehaviour) {
if (useVanillaJNI)
YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviourJNI(
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
else
YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
}
public void setLogger(YogaLogger logger) {
mLogger = logger;
if (useVanillaJNI)
YogaNative.jni_YGConfigSetLoggerJNI(mNativePointer, logger);
else
YogaNative.jni_YGConfigSetLogger(mNativePointer, logger);
}
public YogaLogger getLogger() {
return mLogger;
}
long getNativePointer() {
return mNativePointer;
}
@Override
public void setUseVanillaJNI(boolean useVanillaJNI) {
this.useVanillaJNI = useVanillaJNI;
}
@Override
public boolean useVanillaJNI() {
return this.useVanillaJNI;
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.yoga;
public class YogaConfigJNIFinalizer extends YogaConfigJNIBase {
public YogaConfigJNIFinalizer() {
super();
}
public YogaConfigJNIFinalizer(boolean useVanillaJNI) {
super(useVanillaJNI);
}
@Override
protected void finalize() throws Throwable {
try {
freeNatives();
} finally {
super.finalize();
}
}
public void freeNatives() {
if (mNativePointer != 0) {
long nativePointer = mNativePointer;
mNativePointer = 0;
if (useVanillaJNI)
YogaNative.jni_YGConfigFreeJNI(nativePointer);
else
YogaNative.jni_YGConfigFree(nativePointer);
}
}
}

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
public class YogaConstants { public class YogaConstants {

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;

View File

@@ -1,9 +1,10 @@
/** /*
* Copyright (c) Facebook, Inc. and its affiliates. * Copyright (c) Facebook, Inc. and its affiliates.
* *
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the
* file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;

Some files were not shown because too many files have changed in this diff Show More