2020-10-27 07:59:20 +03:00
|
|
|
# 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:fb_native_wrapper.bzl", "fb_native")
|
|
|
|
load(
|
|
|
|
"//tools/build_defs/oss:rn_codegen_defs.bzl",
|
2020-12-09 20:16:41 +03:00
|
|
|
"rn_codegen_components",
|
2020-10-27 07:59:20 +03:00
|
|
|
"rn_codegen_modules",
|
|
|
|
)
|
|
|
|
load(
|
|
|
|
"//tools/build_defs/oss:rn_defs.bzl",
|
|
|
|
"react_native_root_target",
|
|
|
|
)
|
|
|
|
|
|
|
|
fb_native.genrule(
|
2021-01-22 06:02:00 +03:00
|
|
|
# The schema name must have the following format: "{name}-codegen-modules-schema"
|
|
|
|
# Why: Internally, we have build scripts that find all NativeModule schemas in the
|
|
|
|
# dependencies of an app, and build TurboModuleManager delegates. Those scripts assume
|
|
|
|
# that all schema targets have the aforementioned naming scheme.
|
|
|
|
name = "FBReactNativeSpec-codegen-modules-schema",
|
2020-10-27 07:59:20 +03:00
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"**/*.js",
|
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"**/__tests__/**/*",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
cmd = "$(exe {}) $OUT $SRCS".format(react_native_root_target("packages/react-native-codegen:write_to_json")),
|
|
|
|
out = "schema.json",
|
2021-01-09 01:41:38 +03:00
|
|
|
labels = [
|
|
|
|
"codegen_rule",
|
|
|
|
"react_native_schema_target",
|
|
|
|
],
|
2020-10-27 07:59:20 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
rn_codegen_modules(
|
|
|
|
name = "FBReactNativeSpec",
|
2020-12-30 00:01:55 +03:00
|
|
|
android_package_name = "com.facebook.fbreact.specs",
|
2020-10-27 07:59:20 +03:00
|
|
|
library_labels = ["supermodule:xplat/default/public.react_native.infra"],
|
2021-01-22 06:02:00 +03:00
|
|
|
schema_target = ":FBReactNativeSpec-codegen-modules-schema",
|
2020-10-27 07:59:20 +03:00
|
|
|
)
|
2020-12-09 20:16:41 +03:00
|
|
|
|
|
|
|
rn_codegen_components(
|
|
|
|
name = "FBReactNativeComponentSpec",
|
|
|
|
library_labels = ["supermodule:xplat/default/public.react_native.infra"],
|
2021-01-22 06:02:00 +03:00
|
|
|
# Why does FBReactNativeComponentSpec depend on -codegen-modules-schema?
|
|
|
|
# The module codegen schema also contains components. We cannot change the name
|
|
|
|
# of the schema target, because internally, we have infra that depends on how
|
|
|
|
# it's named.
|
|
|
|
#
|
|
|
|
# TODO(T83341482): Clean up how OSS NativeModule codegen is declared
|
|
|
|
schema_target = ":FBReactNativeSpec-codegen-modules-schema",
|
2020-12-09 20:16:41 +03:00
|
|
|
)
|