Files
yoga/java/BUCK
Amir Shalem e2dbff0ca6 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
2019-09-18 00:40:28 -07:00

114 lines
2.7 KiB
Python

# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "CXX_LIBRARY_WHITELIST", "FBJNI_JAVA_TARGET", "FBJNI_TARGET", "JNI_TARGET", "JSR_305_TARGET", "JUNIT_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "yoga_cxx_lib", "yoga_cxx_library", "yoga_dep", "yoga_java_binary", "yoga_java_library", "yoga_java_test")
CXX_LIBRARY_WHITELIST_FOR_TESTS = CXX_LIBRARY_WHITELIST + [
yoga_cxx_lib("testutil:jni"),
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"]),
header_namespace = "yoga/java",
exported_headers = glob(["jni/*.h"]),
allow_jni_merging = True,
compiler_flags = [
"-fno-omit-frame-pointer",
"-fexceptions",
"-fPIC",
"-Wall",
"-Werror",
"-Os",
"-std=c++11",
],
platforms = ANDROID,
preprocessor_flags = [
"-DFBJNI_WITH_FAST_CALLS",
],
soname = "libyoga.$(ext)",
visibility = ["PUBLIC"],
deps = [
FBJNI_TARGET,
JNI_TARGET,
yoga_dep(":yoga"),
],
)
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",
required_for_source_only_abi = True,
source = "1.7",
target = "1.7",
tests = [
yoga_dep("java:tests"),
],
visibility = ["PUBLIC"],
exported_deps = [
":java-impl",
":java-interface",
],
)
yoga_java_test(
name = "tests",
srcs = glob(["tests/**/*.java"]),
cxx_library_whitelist = CXX_LIBRARY_WHITELIST_FOR_TESTS,
use_cxx_libraries = True,
visibility = ["PUBLIC"],
deps = [
":java",
yoga_dep("testutil:java"),
JUNIT_TARGET,
],
)
yoga_java_binary(
name = "yoga",
deps = [
":java",
FBJNI_JAVA_TARGET,
],
)