Skip to content

Commit

Permalink
Consolidate mobile yoga into top-level xplat
Browse files Browse the repository at this point in the history
Reviewed By: emilsjolander

Differential Revision: D6494379

fbshipit-source-id: f6b78d8a1b3d4bcdeef350ad7bd097cdbe5d15b1
  • Loading branch information
Jonathan Kim authored and facebook-github-bot committed Dec 13, 2017
1 parent 836eaa6 commit 2a10337
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 18 deletions.
4 changes: 2 additions & 2 deletions BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"),
],
)
Expand Down
11 changes: 9 additions & 2 deletions YogaKit/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion android/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion android/sample/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion android/sample/java/com/facebook/samples/yoga/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/facebook/yoga/android/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion java/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/android-support/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/fb/src/main/java/com/facebook/jni/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/gtest/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/infer-annotations/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions lib/jni/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "",
Expand Down
2 changes: 1 addition & 1 deletion lib/jsr-305/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/junit/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
67 changes: 65 additions & 2 deletions yoga_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)

0 comments on commit 2a10337

Please sign in to comment.