From 2a103373442a5855d18b6edf75679dad3b54c237 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 13 Dec 2017 14:43:19 -0800 Subject: [PATCH] Consolidate mobile yoga into top-level xplat Reviewed By: emilsjolander Differential Revision: D6494379 fbshipit-source-id: f6b78d8a1b3d4bcdeef350ad7bd097cdbe5d15b1 --- BUCK | 4 +- YogaKit/BUCK | 11 ++- android/BUCK | 2 +- android/sample/BUCK | 2 +- .../java/com/facebook/samples/yoga/BUCK | 2 +- .../main/java/com/facebook/yoga/android/BUCK | 2 +- java/BUCK | 2 +- .../com/facebook/proguard/annotations/BUCK | 2 +- lib/android-support/BUCK | 2 +- lib/fb/src/main/java/com/facebook/jni/BUCK | 2 +- lib/gtest/BUCK | 2 +- lib/infer-annotations/BUCK | 2 +- lib/jni/BUCK | 2 + lib/jsr-305/BUCK | 2 +- lib/junit/BUCK | 2 +- yoga_defs.bzl | 67 ++++++++++++++++++- 16 files changed, 90 insertions(+), 18 deletions(-) diff --git a/BUCK b/BUCK index 58b6a659..427b62e7 100644 --- a/BUCK +++ b/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include_defs("//yoga_defs.bzl") +load("//:yoga_defs.bzl", "LIBRARY_COMPILER_FLAGS", "BASE_COMPILER_FLAGS", "GTEST_TARGET", "yoga_dep", "cxx_library", "cxx_test") GMOCK_OVERRIDE_FLAGS = [ # gmock does not mark mocked methods as override, ignore the warnings in tests @@ -30,7 +30,7 @@ cxx_library( soname = "libyogacore.$(ext)", tests = [":YogaTests"], visibility = ["PUBLIC"], - deps = [] if THIS_IS_FBOBJC else [ + deps = [ yoga_dep("lib/fb:ndklog"), ], ) diff --git a/YogaKit/BUCK b/YogaKit/BUCK index 10c6cae3..0915156f 100644 --- a/YogaKit/BUCK +++ b/YogaKit/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include_defs("//yoga_defs.bzl") +load("//:yoga_defs.bzl", "yoga_dep", "apple_library", "apple_test") COMPILER_FLAGS = [ "-fobjc-arc", @@ -30,12 +30,19 @@ COMPILER_FLAGS = [ apple_library( name = "YogaKit", srcs = glob(["Source/**/*.m"]), - exported_headers = glob(["Source/**/*.h"]), + exported_headers = subdir_glob( + [ + ("", "Source/**/*.h"), + ("Source", "**/*.h"), + ], + prefix = "YogaKit", + ), compiler_flags = COMPILER_FLAGS, frameworks = [ "$SDKROOT/System/Library/Frameworks/Foundation.framework", "$SDKROOT/System/Library/Frameworks/UIKit.framework", ], + header_path_prefix = "", link_whole = True, visibility = ["PUBLIC"], deps = [ diff --git a/android/BUCK b/android/BUCK index b78e79f1..91356b69 100644 --- a/android/BUCK +++ b/android/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET") +load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "android_aar", "android_resource") android_aar( name = "android", diff --git a/android/sample/BUCK b/android/sample/BUCK index c1fa6383..3229e634 100644 --- a/android/sample/BUCK +++ b/android/sample/BUCK @@ -4,7 +4,7 @@ # This source code is licensed under the license found in the # LICENSE-examples file in the root directory of this source tree. -load("//:yoga_defs.bzl", "ANDROID_SAMPLE_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_RES_TARGET") +load("//:yoga_defs.bzl", "ANDROID_SAMPLE_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_RES_TARGET", "android_binary", "android_resource") android_binary( name = "sample", diff --git a/android/sample/java/com/facebook/samples/yoga/BUCK b/android/sample/java/com/facebook/samples/yoga/BUCK index 653420bc..bdc5f660 100644 --- a/android/sample/java/com/facebook/samples/yoga/BUCK +++ b/android/sample/java/com/facebook/samples/yoga/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_SUPPORT_TARGET", "APPCOMPAT_TARGET", "ANDROID_SUPPORT_TARGET", "SOLOADER_TARGET") +load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_SUPPORT_TARGET", "APPCOMPAT_TARGET", "SOLOADER_TARGET", "android_library") android_library( name = "yoga", diff --git a/android/src/main/java/com/facebook/yoga/android/BUCK b/android/src/main/java/com/facebook/yoga/android/BUCK index 60ac2133..d07c074f 100644 --- a/android/src/main/java/com/facebook/yoga/android/BUCK +++ b/android/src/main/java/com/facebook/yoga/android/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "JSR_305_TARGET", "SOLOADER_TARGET") +load("//:yoga_defs.bzl", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "JSR_305_TARGET", "SOLOADER_TARGET", "android_library") android_library( name = "android", diff --git a/java/BUCK b/java/BUCK index 87532e01..93d26b02 100644 --- a/java/BUCK +++ b/java/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include_defs("//yoga_defs.bzl") +load("//:yoga_defs.bzl", "FBJNI_TARGET", "JNI_TARGET", "INFER_ANNOTATIONS_TARGET", "JSR_305_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "JUNIT_TARGET", "FBJNI_JAVA_TARGET", "CXX_LIBRARY_WHITELIST", "yoga_dep", "cxx_library", "java_library", "java_test", "java_binary") cxx_library( name = "jni", diff --git a/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/BUCK b/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/BUCK index 42e345e7..f57b4d9e 100644 --- a/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/BUCK +++ b/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "YOGA_ROOTS") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "java_library") java_library( name = "annotations", diff --git a/lib/android-support/BUCK b/lib/android-support/BUCK index 852fff24..796bfd33 100644 --- a/lib/android-support/BUCK +++ b/lib/android-support/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "YOGA_ROOTS") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar") prebuilt_jar( name = "android-support", diff --git a/lib/fb/src/main/java/com/facebook/jni/BUCK b/lib/fb/src/main/java/com/facebook/jni/BUCK index 2cca2f8c..6e3638ff 100644 --- a/lib/fb/src/main/java/com/facebook/jni/BUCK +++ b/lib/fb/src/main/java/com/facebook/jni/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "JSR_305_TARGET") +load("//:yoga_defs.bzl", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "JSR_305_TARGET", "java_library") java_library( name = "jni", diff --git a/lib/gtest/BUCK b/lib/gtest/BUCK index c33e38a3..94c9998a 100644 --- a/lib/gtest/BUCK +++ b/lib/gtest/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include_defs("//yoga_defs.bzl") +load("//:yoga_defs.bzl", "cxx_library", "YOGA_ROOTS") COMPILER_FLAGS = [ "-std=c++11", diff --git a/lib/infer-annotations/BUCK b/lib/infer-annotations/BUCK index d6c2b7d9..4662a100 100644 --- a/lib/infer-annotations/BUCK +++ b/lib/infer-annotations/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "YOGA_ROOTS") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar", "java_library") prebuilt_jar( name = "infer-annotations-jar", diff --git a/lib/jni/BUCK b/lib/jni/BUCK index a0612ddd..a39dbe38 100644 --- a/lib/jni/BUCK +++ b/lib/jni/BUCK @@ -5,6 +5,8 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. +load("//:yoga_defs.bzl", "cxx_library") + cxx_library( name = "jni", header_namespace = "", diff --git a/lib/jsr-305/BUCK b/lib/jsr-305/BUCK index 7f576835..50f8d0c1 100644 --- a/lib/jsr-305/BUCK +++ b/lib/jsr-305/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "YOGA_ROOTS") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar", "java_library") prebuilt_jar( name = "jsr305-jar", diff --git a/lib/junit/BUCK b/lib/junit/BUCK index 58e584c4..f0812056 100644 --- a/lib/junit/BUCK +++ b/lib/junit/BUCK @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -load("//:yoga_defs.bzl", "YOGA_ROOTS") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar", "java_library") prebuilt_jar( name = "junit-jar", diff --git a/yoga_defs.bzl b/yoga_defs.bzl index 58694c95..31e5aa5d 100644 --- a/yoga_defs.bzl +++ b/yoga_defs.bzl @@ -19,8 +19,6 @@ ANDROID_RES_TARGET = '//android:res' ANDROID_SAMPLE_JAVA_TARGET = '//android/sample/java/com/facebook/samples/yoga:yoga' ANDROID_SAMPLE_RES_TARGET = '//android/sample:res' -THIS_IS_FBOBJC = False - CXX_LIBRARY_WHITELIST = [ '//:yoga', '//lib/fb:fbjni', @@ -42,3 +40,68 @@ LIBRARY_COMPILER_FLAGS = BASE_COMPILER_FLAGS + [ def yoga_dep(dep): return '//' + dep + + +_original_android_aar = android_aar +def android_aar(*args, **kwargs): + _original_android_aar(*args, **kwargs) + + +_original_android_binary = android_binary +def android_binary(*args, **kwargs): + _original_android_binary(*args, **kwargs) + + +_original_android_library = android_library +def android_library(*args, **kwargs): + _original_android_library(*args, **kwargs) + + +_original_android_resource = android_resource +def android_resource(*args, **kwargs): + _original_android_resource(*args, **kwargs) + + +_original_apple_library = apple_library +def apple_library(*args, **kwargs): + _original_apple_library(*args, **kwargs) + + +_original_apple_test = apple_test +def apple_test(*args, **kwargs): + _original_apple_test(*args, **kwargs) + + +_original_cxx_library = cxx_library +def cxx_library(*args, **kwargs): + _original_cxx_library(*args, **kwargs) + + +_original_cxx_test = cxx_test +def cxx_test(*args, **kwargs): + _original_cxx_test(*args, **kwargs) + + +_original_java_binary = java_binary +def java_binary(*args, **kwargs): + _original_java_binary(*args, **kwargs) + + +_original_java_library = java_library +def java_library(*args, **kwargs): + _original_java_library(*args, **kwargs) + + +_original_java_test = java_test +def java_test(*args, **kwargs): + _original_java_test(*args, **kwargs) + + +_original_prebuilt_cxx_library = prebuilt_cxx_library +def prebuilt_cxx_library(*args, **kwargs): + _original_prebuilt_cxx_library(*args, **kwargs) + + +_original_prebuilt_jar = prebuilt_jar +def prebuilt_jar(*args, **kwargs): + _original_prebuilt_jar(*args, **kwargs)