Files
react-native/packages/react-native-codegen/BUCK
T
Michał Osadnik d6722477c4 Add e2e tests skeleton for generated cpp code (#25673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/25673

This diff add e2e code generator validation. I added proper buck rule which compiles cpp code and test if it really compiles.

While testing I faced few minor issues:

- `getBool` and `getNumber` shouldn't have `rt` param.

- Generators now start considering whole module name instead of sliced part of their name.

- Fixed import structure in generated cpp.

- renamed `jsireact` to `ReactCommon` following D16231697

Reviewed By: rickhanlonii

Differential Revision: D16221277

fbshipit-source-id: aff4011ad52dd5e16546ffdb709d6a751ebfaced
2019-07-17 06:21:48 -07:00

119 lines
3.1 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",
"**/e2e/__test_fixtures__/Native*.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",
":generated_modules-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",
":generated_modules-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"],
)