From eb15939c23021611342253c7e6d3ede4f30687cc Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Sat, 14 Apr 2018 12:39:23 -0700 Subject: [PATCH] Make yoga wrapper macros start with yoga_ Summary: Rename macros Reviewed By: mzlee Differential Revision: D7606834 fbshipit-source-id: a2089260dbe46f30f49a207737c83472e2fb3c63 --- BUCK | 6 +- YogaKit/BUCK | 6 +- android/BUCK | 6 +- android/sample/BUCK | 6 +- .../java/com/facebook/samples/yoga/BUCK | 4 +- .../main/java/com/facebook/yoga/android/BUCK | 4 +- csharp/BUCK | 4 +- java/BUCK | 10 +- .../com/facebook/proguard/annotations/BUCK | 4 +- lib/android-support/BUCK | 4 +- lib/fb/BUCK | 6 +- lib/fb/src/main/java/com/facebook/jni/BUCK | 4 +- lib/gtest/BUCK | 4 +- lib/infer-annotations/BUCK | 6 +- lib/jni/BUCK | 4 +- lib/jsr-305/BUCK | 6 +- lib/junit/BUCK | 6 +- yoga_defs.bzl | 93 ++++++++----------- 18 files changed, 85 insertions(+), 98 deletions(-) diff --git a/BUCK b/BUCK index efac474f..edd57942 100644 --- a/BUCK +++ b/BUCK @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "LIBRARY_COMPILER_FLAGS", "BASE_COMPILER_FLAGS", "GTEST_TARGET", "yoga_dep", "cxx_library", "cxx_test") +load("//:yoga_defs.bzl", "LIBRARY_COMPILER_FLAGS", "BASE_COMPILER_FLAGS", "GTEST_TARGET", "yoga_dep", "yoga_cxx_library", "yoga_cxx_test") GMOCK_OVERRIDE_FLAGS = [ # gmock does not mark mocked methods as override, ignore the warnings in tests @@ -18,7 +18,7 @@ TEST_COMPILER_FLAGS = BASE_COMPILER_FLAGS + GMOCK_OVERRIDE_FLAGS + [ "-std=c++1y", ] -cxx_library( +yoga_cxx_library( name = "yoga", srcs = glob(["yoga/*.cpp"]), header_namespace = "", @@ -32,7 +32,7 @@ cxx_library( ], ) -cxx_test( +yoga_cxx_test( name = "YogaTests", srcs = glob(["tests/*.cpp"]), compiler_flags = TEST_COMPILER_FLAGS, diff --git a/YogaKit/BUCK b/YogaKit/BUCK index 738a0732..fb56bd3d 100644 --- a/YogaKit/BUCK +++ b/YogaKit/BUCK @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "yoga_dep", "apple_library", "apple_test") +load("//:yoga_defs.bzl", "yoga_dep", "yoga_apple_library", "yoga_apple_test") COMPILER_FLAGS = [ "-fobjc-arc", @@ -25,7 +25,7 @@ COMPILER_FLAGS = [ "-Wunused-value", ] -apple_library( +yoga_apple_library( name = "YogaKit", srcs = glob(["Source/**/*.m"]), header_namespace = "", @@ -49,7 +49,7 @@ apple_library( ], ) -apple_test( +yoga_apple_test( name = "YogaKitTests", srcs = glob(["Tests/**/*.m"]), compiler_flags = COMPILER_FLAGS, diff --git a/android/BUCK b/android/BUCK index 117e3f8c..af64135f 100644 --- a/android/BUCK +++ b/android/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "android_aar", "android_resource") +load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "yoga_android_aar", "yoga_android_resource") -android_aar( +yoga_android_aar( name = "android", manifest_skeleton = "src/main/AndroidManifest.xml", visibility = [ @@ -20,7 +20,7 @@ android_aar( ], ) -android_resource( +yoga_android_resource( name = "res", package = "com.facebook.yoga.android", res = "src/main/res", diff --git a/android/sample/BUCK b/android/sample/BUCK index 3229e634..3e264416 100644 --- a/android/sample/BUCK +++ b/android/sample/BUCK @@ -4,9 +4,9 @@ # 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", "android_binary", "android_resource") +load("//:yoga_defs.bzl", "ANDROID_SAMPLE_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_RES_TARGET", "yoga_android_binary", "yoga_android_resource") -android_binary( +yoga_android_binary( name = "sample", keystore = ":debug_keystore", manifest = "AndroidManifest.xml", @@ -16,7 +16,7 @@ android_binary( ], ) -android_resource( +yoga_android_resource( name = "res", package = "com.facebook.samples.yoga", res = "res", diff --git a/android/sample/java/com/facebook/samples/yoga/BUCK b/android/sample/java/com/facebook/samples/yoga/BUCK index 39d7d7b3..4c216b1e 100644 --- a/android/sample/java/com/facebook/samples/yoga/BUCK +++ b/android/sample/java/com/facebook/samples/yoga/BUCK @@ -3,9 +3,9 @@ # 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_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_SUPPORT_TARGET", "APPCOMPAT_TARGET", "SOLOADER_TARGET", "android_library") +load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_SUPPORT_TARGET", "APPCOMPAT_TARGET", "SOLOADER_TARGET", "yoga_android_library") -android_library( +yoga_android_library( name = "yoga", srcs = glob(["**/*.java"]), visibility = [ diff --git a/android/src/main/java/com/facebook/yoga/android/BUCK b/android/src/main/java/com/facebook/yoga/android/BUCK index d7f28c98..01a8d47d 100644 --- a/android/src/main/java/com/facebook/yoga/android/BUCK +++ b/android/src/main/java/com/facebook/yoga/android/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "JSR_305_TARGET", "SOLOADER_TARGET", "android_library") +load("//:yoga_defs.bzl", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "JSR_305_TARGET", "SOLOADER_TARGET", "yoga_android_library") -android_library( +yoga_android_library( name = "android", srcs = glob(["**/*.java"]), visibility = [ diff --git a/csharp/BUCK b/csharp/BUCK index 0a59bf49..7cbe2b50 100644 --- a/csharp/BUCK +++ b/csharp/BUCK @@ -3,7 +3,7 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "BASE_COMPILER_FLAGS", "yoga_dep", "cxx_library", "is_apple_platform") +load("//:yoga_defs.bzl", "BASE_COMPILER_FLAGS", "yoga_dep", "yoga_cxx_library", "is_apple_platform") COMPILER_FLAGS = BASE_COMPILER_FLAGS + ["-std=c++11"] @@ -21,7 +21,7 @@ csharp_library( framework_ver = "net45", ) -cxx_library( +yoga_cxx_library( name = "yoganet", srcs = glob(["Yoga/YGInterop.cpp"]), compiler_flags = COMPILER_FLAGS, diff --git a/java/BUCK b/java/BUCK index 45ce1959..60c11da4 100644 --- a/java/BUCK +++ b/java/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -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", "ANDROID", "yoga_dep", "cxx_library", "java_library", "java_test", "java_binary") +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", "ANDROID", "yoga_dep", "yoga_cxx_library", "yoga_java_library", "yoga_java_test", "yoga_java_binary") -cxx_library( +yoga_cxx_library( name = "jni", srcs = glob(["jni/*.cpp"]), header_namespace = "", @@ -28,7 +28,7 @@ cxx_library( ], ) -java_library( +yoga_java_library( name = "java", srcs = glob(["com/facebook/yoga/*.java"]), required_for_source_only_abi = True, @@ -47,7 +47,7 @@ java_library( ], ) -java_test( +yoga_java_test( name = "tests", srcs = glob(["tests/**/*.java"]), cxx_library_whitelist = CXX_LIBRARY_WHITELIST, @@ -59,7 +59,7 @@ java_test( ], ) -java_binary( +yoga_java_binary( name = "yoga", deps = [ ":java", 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 feb40ef7..73456365 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 @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "YOGA_ROOTS", "java_library") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "yoga_java_library") -java_library( +yoga_java_library( name = "annotations", srcs = glob(["*.java"]), source = "1.7", diff --git a/lib/android-support/BUCK b/lib/android-support/BUCK index 36596432..d104d464 100644 --- a/lib/android-support/BUCK +++ b/lib/android-support/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "yoga_prebuilt_jar") -prebuilt_jar( +yoga_prebuilt_jar( name = "android-support", binary_jar = "android-support-v4.jar", visibility = YOGA_ROOTS, diff --git a/lib/fb/BUCK b/lib/fb/BUCK index 50077d2e..f567b33c 100644 --- a/lib/fb/BUCK +++ b/lib/fb/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -include_defs("//yoga_defs.bzl") +load("//:yoga_defs.bzl", "yoga_prebuilt_cxx_library", "yoga_cxx_library", "YOGA_ROOTS", "FBJNI_JAVA_TARGET", "JNI_TARGET") -prebuilt_cxx_library( +yoga_prebuilt_cxx_library( name = "ndklog", exported_platform_linker_flags = [ ( @@ -17,7 +17,7 @@ prebuilt_cxx_library( visibility = YOGA_ROOTS, ) -cxx_library( +yoga_cxx_library( name = "fbjni", srcs = glob(["src/main/cpp/**/*.cpp"]), header_namespace = "", diff --git a/lib/fb/src/main/java/com/facebook/jni/BUCK b/lib/fb/src/main/java/com/facebook/jni/BUCK index 1b57c579..66685b4f 100644 --- a/lib/fb/src/main/java/com/facebook/jni/BUCK +++ b/lib/fb/src/main/java/com/facebook/jni/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "JSR_305_TARGET", "java_library") +load("//:yoga_defs.bzl", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "JSR_305_TARGET", "yoga_java_library") -java_library( +yoga_java_library( name = "jni", srcs = glob(["**/*.java"]), proguard_config = "fbjni.pro", diff --git a/lib/gtest/BUCK b/lib/gtest/BUCK index 6906eb1f..8c7cf926 100644 --- a/lib/gtest/BUCK +++ b/lib/gtest/BUCK @@ -3,14 +3,14 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "cxx_library", "YOGA_ROOTS") +load("//:yoga_defs.bzl", "yoga_cxx_library", "YOGA_ROOTS") COMPILER_FLAGS = [ "-std=c++11", "-Wno-missing-prototypes", ] -cxx_library( +yoga_cxx_library( name = "gtest", srcs = glob(["googletest/googletest/src/*.cc"]), header_namespace = "", diff --git a/lib/infer-annotations/BUCK b/lib/infer-annotations/BUCK index 2c828f40..3eed9328 100644 --- a/lib/infer-annotations/BUCK +++ b/lib/infer-annotations/BUCK @@ -3,14 +3,14 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar", "java_library") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "yoga_prebuilt_jar", "yoga_java_library") -prebuilt_jar( +yoga_prebuilt_jar( name = "infer-annotations-jar", binary_jar = "infer-annotations-1.4.jar", ) -java_library( +yoga_java_library( name = "infer-annotations", exported_deps = [ ":infer-annotations-jar", diff --git a/lib/jni/BUCK b/lib/jni/BUCK index 9a5652bf..9ce8bd05 100644 --- a/lib/jni/BUCK +++ b/lib/jni/BUCK @@ -3,9 +3,9 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "cxx_library") +load("//:yoga_defs.bzl", "yoga_cxx_library") -cxx_library( +yoga_cxx_library( name = "jni", header_namespace = "", exported_headers = [ diff --git a/lib/jsr-305/BUCK b/lib/jsr-305/BUCK index 7563cdcb..8a070e84 100644 --- a/lib/jsr-305/BUCK +++ b/lib/jsr-305/BUCK @@ -3,14 +3,14 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar", "java_library") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "yoga_prebuilt_jar", "yoga_java_library") -prebuilt_jar( +yoga_prebuilt_jar( name = "jsr305-jar", binary_jar = "jsr305.jar", ) -java_library( +yoga_java_library( name = "jsr-305", exported_deps = [ ":jsr305-jar", diff --git a/lib/junit/BUCK b/lib/junit/BUCK index 3ffb55ab..74265c2a 100644 --- a/lib/junit/BUCK +++ b/lib/junit/BUCK @@ -3,14 +3,14 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -load("//:yoga_defs.bzl", "YOGA_ROOTS", "prebuilt_jar", "java_library") +load("//:yoga_defs.bzl", "YOGA_ROOTS", "yoga_prebuilt_jar", "yoga_java_library") -prebuilt_jar( +yoga_prebuilt_jar( name = "junit-jar", binary_jar = "junit4.jar", ) -java_library( +yoga_java_library( name = "junit", exported_deps = [ ":junit-jar", diff --git a/yoga_defs.bzl b/yoga_defs.bzl index 4e1d472d..21e00019 100644 --- a/yoga_defs.bzl +++ b/yoga_defs.bzl @@ -21,95 +21,82 @@ ANDROID_SAMPLE_JAVA_TARGET = '//android/sample/java/com/facebook/samples/yoga:yo ANDROID_SAMPLE_RES_TARGET = '//android/sample:res' CXX_LIBRARY_WHITELIST = [ - '//:yoga', - '//lib/fb:fbjni', - '//java:jni', + '//:yoga', + '//lib/fb:fbjni', + '//java:jni', ] BASE_COMPILER_FLAGS = [ - '-fno-omit-frame-pointer', - '-fexceptions', - '-Wall', - '-Werror', - '-O3', - '-ffast-math', + '-fno-omit-frame-pointer', + '-fexceptions', + '-Wall', + '-Werror', + '-O3', + '-ffast-math', ] LIBRARY_COMPILER_FLAGS = BASE_COMPILER_FLAGS + [ - '-fPIC', + '-fPIC', ] def yoga_dep(dep): - return '//' + dep + return '//' + dep -_original_android_aar = android_aar -def android_aar(*args, **kwargs): - _original_android_aar(*args, **kwargs) +def yoga_android_aar(*args, **kwargs): + native.android_aar(*args, **kwargs) -_original_android_binary = android_binary -def android_binary(*args, **kwargs): - _original_android_binary(*args, **kwargs) +def yoga_android_binary(*args, **kwargs): + native.android_binary(*args, **kwargs) -_original_android_library = android_library -def android_library(*args, **kwargs): - _original_android_library(*args, **kwargs) +def yoga_android_library(*args, **kwargs): + native.android_library(*args, **kwargs) -_original_android_resource = android_resource -def android_resource(*args, **kwargs): - _original_android_resource(*args, **kwargs) +def yoga_android_resource(*args, **kwargs): + native.android_resource(*args, **kwargs) -_original_apple_library = apple_library -def apple_library(*args, **kwargs): - _original_apple_library(*args, **kwargs) +def yoga_apple_library(*args, **kwargs): + native.apple_library(*args, **kwargs) -_original_apple_test = apple_test -def apple_test(*args, **kwargs): - _original_apple_test(*args, **kwargs) +def yoga_apple_test(*args, **kwargs): + native.apple_test(*args, **kwargs) -_original_cxx_library = cxx_library -def cxx_library(*args, **kwargs): - # Currently unused - kwargs.pop("platforms", None) - _original_cxx_library(*args, **kwargs) +def yoga_cxx_library(*args, **kwargs): + # Currently unused + kwargs.pop("platforms", None) + native.cxx_library(*args, **kwargs) -_original_cxx_test = cxx_test -def cxx_test(*args, **kwargs): - _original_cxx_test(*args, **kwargs) +def yoga_cxx_test(*args, **kwargs): + native.cxx_test(*args, **kwargs) -_original_java_binary = java_binary -def java_binary(*args, **kwargs): - _original_java_binary(*args, **kwargs) +def yoga_java_binary(*args, **kwargs): + native.java_binary(*args, **kwargs) -_original_java_library = java_library -def java_library(*args, **kwargs): - _original_java_library(*args, **kwargs) +def yoga_java_library(*args, **kwargs): + native.java_library(*args, **kwargs) -_original_java_test = java_test -def java_test(*args, **kwargs): - _original_java_test(*args, **kwargs) +def yoga_java_test(*args, **kwargs): + native.java_test(*args, **kwargs) -_original_prebuilt_cxx_library = prebuilt_cxx_library -def prebuilt_cxx_library(*args, **kwargs): - _original_prebuilt_cxx_library(*args, **kwargs) +def yoga_prebuilt_cxx_library(*args, **kwargs): + native.prebuilt_cxx_library(*args, **kwargs) -_original_prebuilt_jar = prebuilt_jar -def prebuilt_jar(*args, **kwargs): - _original_prebuilt_jar(*args, **kwargs) +def yoga_prebuilt_jar(*args, **kwargs): + native.prebuilt_jar(*args, **kwargs) def is_apple_platform(): - return True + return True