Files
react-native/packages/react-native-codegen/BUCK
T
Rick Hanlon 98b03fa1b9 Switch native codegen over to flow parser
Summary:
This diff switches the native codegen over to the flow parser

It does this by:
- Creating a new e2e directory
- Migrating the schema.js fixtures to flow types in  e2e/
- Updating the buck tests to use the flow type fixtures
- Finally, updating the rest of rn_codegen to use *NativeComponent instead of *Schema.js

Removing all of the schemas in the next diff to keep this one clean

Reviewed By: cpojer

Differential Revision: D15960603

fbshipit-source-id: 3df28b31e618491301578ab7f6e28a80f55404b2
2019-06-27 08:04:13 -07:00

116 lines
3.0 KiB
Python

load("@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", "APPLE")
load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary")
load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "rn_xplat_cxx_library")
load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace")
load("@fbsource//xplat/js/react-native-github/packages/react-native-codegen:DEFS.bzl", "rn_codegen")
fb_native.sh_binary(
name = "write_to_json",
main = "src/cli/combine/combine_js_to_schema.sh",
resources = [
"fbsource//xplat/js:setup_env",
"src/cli/combine/combine-js-to-schema.js",
"src/cli/combine/combine_js_to_schema.sh",
],
visibility = ["PUBLIC"],
)
fb_native.sh_binary(
name = "rn_codegen",
main = "buck_tests/generate-tests.sh",
resources = glob(
[
"buck_tests/**/*.js",
"src/**/*.js",
],
) + [
"buck_tests/generate-tests.js",
"package.json",
"fbsource//xplat/js:setup_env",
"yarn.lock",
],
visibility = ["PUBLIC"],
)
fb_native.genrule(
name = "codegen_tests_schema",
srcs = glob(
[
"**/e2e/__test_fixtures__/*NativeComponent.js",
],
),
cmd = "$(exe fbsource//xplat/js/react-native-github/packages/react-native-codegen:write_to_json) $OUT $SRCS",
out = "schema-codegen_tests.json",
)
rn_codegen(
name = "codegen_tests",
schema_target = ":codegen_tests_schema",
)
fb_xplat_cxx_binary(
name = "rn_codegen_binary",
srcs = ["buck_tests/emptyFile.cpp"],
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
platforms = (ANDROID, APPLE),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
visibility = ["PUBLIC"],
deps = [
":generated_components-codegen_tests",
],
)
rn_xplat_cxx_library(
name = "rn_codegen_library",
srcs = ["buck_tests/emptyFile.cpp"],
headers = [],
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wall",
],
platforms = (ANDROID, APPLE),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",
],
visibility = [
"PUBLIC",
],
deps = [
":generated_components-codegen_tests",
],
)
yarn_workspace(
name = "yarn-workspace",
srcs = glob(
["**/*.js"],
exclude = [
"**/__fixtures__/**",
"**/__flowtests__/**",
"**/__mocks__/**",
"**/__server_snapshot_tests__/**",
"**/__tests__/**",
"**/node_modules/**",
"**/node_modules/.bin/**",
"**/.*",
"**/.*/**",
"**/.*/.*",
"**/*.xcodeproj/**",
"**/*.xcworkspace/**",
],
),
visibility = ["PUBLIC"],
)