Summary: cute-jumper suggested the layout preview move out of fbandroid4idea plugin because 1. Litho layout preview requires Yoga library and Yoga native library, which requires bundling. Bundling isn't supported by fbandroid4idea, and changing the plugin would be complicated. 2. We have more control in releasing our features for layout preview in a separate plugin as opposed to in fbandroid4idea. As a result, this diff creates a new plugin for layout preview. Note that this diff creates only placeholder as moving the whole part might be too big for one diff Reviewed By: cute-jumper Differential Revision: D39974345 fbshipit-source-id: e3f579f700eafc9413562abed923da1ca3135fba
129 lines
3.1 KiB
Python
129 lines
3.1 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", "CXX_LIBRARY_WHITELIST", "JNI_TARGET", "JSR_305_TARGET", "JUNIT_TARGET", "PROGUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "YOGA_ROOTS", "yoga_android_dep", "yoga_cxx_library", "yoga_dep", "yoga_java_binary", "yoga_java_library", "yoga_java_test", "yoga_prebuilt_cxx_library")
|
|
|
|
CXX_LIBRARY_WHITELIST_FOR_TESTS = CXX_LIBRARY_WHITELIST + [
|
|
yoga_android_dep("testutil:jni"),
|
|
yoga_android_dep("testutil:testutil-jni"),
|
|
]
|
|
|
|
YOGA_JAVA_IMPLEMENTATION_FILES = [
|
|
"com/facebook/yoga/*JNI*.java",
|
|
"com/facebook/yoga/*Factory.java",
|
|
"com/facebook/yoga/YogaNative.java",
|
|
]
|
|
|
|
yoga_prebuilt_cxx_library(
|
|
name = "ndklog",
|
|
exported_platform_linker_flags = [
|
|
(
|
|
"^android.*",
|
|
["-llog"],
|
|
),
|
|
],
|
|
header_only = True,
|
|
visibility = YOGA_ROOTS,
|
|
)
|
|
|
|
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",
|
|
"-fvisibility=hidden",
|
|
"-ffunction-sections",
|
|
"-fdata-sections",
|
|
"-fPIC",
|
|
"-Wall",
|
|
"-Werror",
|
|
"-Os",
|
|
"-std=c++11",
|
|
],
|
|
platforms = (CXX, ANDROID),
|
|
preprocessor_flags = [
|
|
"-DFBJNI_WITH_FAST_CALLS",
|
|
],
|
|
soname = "libyoga.$(ext)",
|
|
visibility = ["PUBLIC"],
|
|
deps = [
|
|
JNI_TARGET,
|
|
yoga_dep(":yoga-static"),
|
|
":ndklog",
|
|
],
|
|
)
|
|
|
|
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,
|
|
PROGUARD_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",
|
|
JSR_305_TARGET,
|
|
PROGUARD_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"]),
|
|
contacts = ["oncall+yoga@xmail.facebook.com"],
|
|
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",
|
|
visibility = ["PUBLIC"],
|
|
deps = [
|
|
":java",
|
|
],
|
|
)
|