From e2dbff0ca6c6e808f38d2b195c8ff3ddec47fea6 Mon Sep 17 00:00:00 2001 From: Amir Shalem Date: Wed, 18 Sep 2019 00:36:26 -0700 Subject: [PATCH] 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 --- java/BUCK | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/java/BUCK b/java/BUCK index 73e0a89a..5b335bad 100644 --- a/java/BUCK +++ b/java/BUCK @@ -10,6 +10,12 @@ CXX_LIBRARY_WHITELIST_FOR_TESTS = CXX_LIBRARY_WHITELIST + [ 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( name = "jni", srcs = glob(["jni/*.cpp"]), @@ -38,9 +44,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( name = "java", - srcs = glob(["com/facebook/yoga/*.java"]), required_for_source_only_abi = True, source = "1.7", target = "1.7", @@ -48,12 +85,9 @@ yoga_java_library( yoga_dep("java:tests"), ], visibility = ["PUBLIC"], - deps = [ - ":jni", - FBJNI_JAVA_TARGET, - JSR_305_TARGET, - PROGRUARD_ANNOTATIONS_TARGET, - SOLOADER_TARGET, + exported_deps = [ + ":java-impl", + ":java-interface", ], )