Skip to content

Commit

Permalink
Create buck target to copy C++ files into OSS
Browse files Browse the repository at this point in the history
Summary:
This new buck target will execute the code gen and copy C++ files to the output directory. This will be used to integrate these files into RN Tester

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D23115538

fbshipit-source-id: de4135be697c36cd559edf416986299511c31744
  • Loading branch information
mdvacca authored and facebook-github-bot committed Aug 14, 2020
1 parent cc7dd18 commit 29bcb50
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/react-native-codegen/DEFS.bzl
Expand Up @@ -96,7 +96,9 @@ def rn_codegen_components(
generate_shadow_node_cpp_name = "generated_shadow_node_cpp-{}".format(name)
generate_shadow_node_h_name = "generated_shadow_node_h-{}".format(name)
copy_generated_java_files = "copy_generated_java_files-{}".format(name)
copy_generated_cxx_files = "copy_generated_cxx_files-{}".format(name)
zip_generated_java_files = "zip_generated_java_files-{}".format(name)
zip_generated_cxx_files = "zip_generated_cxx_files-{}".format(name)

fb_native.genrule(
name = generate_fixtures_rule_name,
Expand Down Expand Up @@ -162,6 +164,21 @@ def rn_codegen_components(
labels = ["codegen_rule"],
)

fb_native.genrule(
name = copy_generated_cxx_files,
cmd = "mkdir $OUT && find $(location :{}) -name '*.cpp' -o -name '*.h' -exec cp {{}} $OUT \\;".format(generate_fixtures_rule_name),
out = "cxx",
labels = ["codegen_rule"],
)

fb_native.zip_file(
name = zip_generated_cxx_files,
srcs = [":{}".format(copy_generated_cxx_files)],
out = "{}.src.zip".format(zip_generated_cxx_files),
visibility = ["PUBLIC"],
labels = ["codegen_rule"],
)

fb_native.zip_file(
name = zip_generated_java_files,
srcs = [":{}".format(copy_generated_java_files)],
Expand Down Expand Up @@ -266,6 +283,22 @@ def rn_codegen_components(
],
)

rn_android_library(
name = "generated_components_cxx-{}".format(name),
srcs = [
":{}".format(zip_generated_cxx_files),
],
labels = ["codegen_rule"],
visibility = ["PUBLIC"],
deps = [
react_native_dep("third-party/android/androidx:annotation"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/turbomodule/core:core"),
react_native_target("java/com/facebook/react/uimanager:uimanager"),
],
)

# Tests
fb_xplat_cxx_test(
name = "generated_tests-{}".format(name),
Expand Down

0 comments on commit 29bcb50

Please sign in to comment.