From dec1172f38df8c3264a6226deb17a9252bbd5217 Mon Sep 17 00:00:00 2001 From: Taras Tsugrii Date: Mon, 27 Nov 2017 13:47:46 -0800 Subject: [PATCH] Migrate yoga defs to Skylark syntax. Summary: https://our.intern.facebook.com/intern/dex/buck/python-to-skylark/ Reviewed By: adamjernst Differential Revision: D6411822 fbshipit-source-id: 2abe2c183d1b1a28349d0c7bd765754688ec4441 --- BUCK | 2 +- YogaKit/BUCK | 2 +- android/BUCK | 2 +- android/sample/BUCK | 2 +- android/sample/java/com/facebook/samples/yoga/BUCK | 2 +- android/src/main/java/com/facebook/yoga/android/BUCK | 2 +- benchmark/BUCK | 2 +- csharp/BUCK | 2 +- java/BUCK | 2 +- .../src/main/java/com/facebook/proguard/annotations/BUCK | 2 +- lib/android-support/BUCK | 2 +- lib/appcompat/BUCK | 2 +- lib/fb/BUCK | 2 +- lib/fb/src/main/java/com/facebook/jni/BUCK | 2 +- lib/gtest/BUCK | 2 +- lib/infer-annotations/BUCK | 2 +- lib/jsr-305/BUCK | 2 +- lib/junit/BUCK | 2 +- lib/soloader/BUCK | 2 +- YOGA_DEFS => yoga_defs.bzl | 7 ++----- 20 files changed, 21 insertions(+), 24 deletions(-) rename YOGA_DEFS => yoga_defs.bzl (92%) diff --git a/BUCK b/BUCK index 8267b4e1cb..1087e7bb19 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") +include_defs("//yoga_defs.bzl") GMOCK_OVERRIDE_FLAGS = [ # gmock does not mark mocked methods as override, ignore the warnings in tests diff --git a/YogaKit/BUCK b/YogaKit/BUCK index dfb67e64d0..10c6cae3b1 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") +include_defs("//yoga_defs.bzl") COMPILER_FLAGS = [ "-fobjc-arc", diff --git a/android/BUCK b/android/BUCK index 7e02f6a513..b78e79f1bb 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "PROGRUARD_ANNOTATIONS_TARGET") android_aar( name = "android", diff --git a/android/sample/BUCK b/android/sample/BUCK index 122bfa1683..c1fa638322 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "ANDROID_SAMPLE_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_RES_TARGET") 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 ddb07ad8ce..653420bc91 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "ANDROID_JAVA_TARGET", "ANDROID_SAMPLE_RES_TARGET", "ANDROID_SUPPORT_TARGET", "APPCOMPAT_TARGET", "ANDROID_SUPPORT_TARGET", "SOLOADER_TARGET") 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 0ac32fade7..60ac213351 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "ANDROID_RES_TARGET", "INFER_ANNOTATIONS_TARGET", "JAVA_TARGET", "JSR_305_TARGET", "SOLOADER_TARGET") android_library( name = "android", diff --git a/benchmark/BUCK b/benchmark/BUCK index 7cae089185..0c77b4280d 100644 --- a/benchmark/BUCK +++ b/benchmark/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") +load("//:yoga_defs.bzl", "yoga_dep") cxx_binary( name = "benchmark", diff --git a/csharp/BUCK b/csharp/BUCK index 0cdb65325f..a28e76073b 100644 --- a/csharp/BUCK +++ b/csharp/BUCK @@ -6,7 +6,7 @@ # of patent rights can be found in the PATENTS file in the same directory. load("@xplat//configurations/buck:default_platform_defs", "is_apple_platform") -load("//:YOGA_DEFS", "BASE_COMPILER_FLAGS", "yoga_dep", "cxx_library") +load("//:yoga_defs.bzl", "BASE_COMPILER_FLAGS", "yoga_dep", "cxx_library") COMPILER_FLAGS = BASE_COMPILER_FLAGS + ["-std=c++11"] diff --git a/java/BUCK b/java/BUCK index 293da5c751..87532e01c9 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") +include_defs("//yoga_defs.bzl") 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 ce3df1310d..42e345e758 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "YOGA_ROOTS") java_library( name = "annotations", diff --git a/lib/android-support/BUCK b/lib/android-support/BUCK index a58cdb00c2..852fff247e 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "YOGA_ROOTS") prebuilt_jar( name = "android-support", diff --git a/lib/appcompat/BUCK b/lib/appcompat/BUCK index 33f15c9aa9..331f0f6631 100644 --- a/lib/appcompat/BUCK +++ b/lib/appcompat/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") +load("//:yoga_defs.bzl", "YOGA_ROOTS") android_prebuilt_aar( name = "appcompat", diff --git a/lib/fb/BUCK b/lib/fb/BUCK index ffd5b5e3f8..952e195fec 100644 --- a/lib/fb/BUCK +++ b/lib/fb/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") +include_defs("//yoga_defs.bzl") prebuilt_cxx_library( name = "ndklog", diff --git a/lib/fb/src/main/java/com/facebook/jni/BUCK b/lib/fb/src/main/java/com/facebook/jni/BUCK index 6c974999ba..2cca2f8c83 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "JSR_305_TARGET") java_library( name = "jni", diff --git a/lib/gtest/BUCK b/lib/gtest/BUCK index 9f5cce6c20..c33e38a348 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") +include_defs("//yoga_defs.bzl") COMPILER_FLAGS = [ "-std=c++11", diff --git a/lib/infer-annotations/BUCK b/lib/infer-annotations/BUCK index 9856143b0d..d6c2b7d974 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "YOGA_ROOTS") prebuilt_jar( name = "infer-annotations-jar", diff --git a/lib/jsr-305/BUCK b/lib/jsr-305/BUCK index 329e4587d2..7f576835f1 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "YOGA_ROOTS") prebuilt_jar( name = "jsr305-jar", diff --git a/lib/junit/BUCK b/lib/junit/BUCK index d29717af2a..58e584c46e 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. -include_defs("//YOGA_DEFS") +load("//:yoga_defs.bzl", "YOGA_ROOTS") prebuilt_jar( name = "junit-jar", diff --git a/lib/soloader/BUCK b/lib/soloader/BUCK index 40e15c83a6..10a5a3b676 100644 --- a/lib/soloader/BUCK +++ b/lib/soloader/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") +load("//:yoga_defs.bzl", "YOGA_ROOTS") android_prebuilt_aar( name = "soloader", diff --git a/YOGA_DEFS b/yoga_defs.bzl similarity index 92% rename from YOGA_DEFS rename to yoga_defs.bzl index 09faa1b774..58694c9568 100644 --- a/YOGA_DEFS +++ b/yoga_defs.bzl @@ -1,3 +1,4 @@ +"""Provides macros for working with yoga library.""" YOGA_ROOTS = ['//...'] JAVA_TARGET = '//java:java' @@ -38,10 +39,6 @@ LIBRARY_COMPILER_FLAGS = BASE_COMPILER_FLAGS + [ '-fPIC', ] + def yoga_dep(dep): return '//' + dep - -with allow_unsafe_import(): - import os.path -def isdir(filename): - return os.path.isdir(filename)