From 5a2099fe7d1f54bede499efbcb9854d3a581166b Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Thu, 21 Jan 2021 19:02:00 -0800 Subject: [PATCH] Rename rn_codegen_modules(native_module_spec_name => name) Summary: Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D25963929 fbshipit-source-id: 4c82562404a21b5a1789d11ae2d228411329fee5 --- Libraries/BUCK | 1 - packages/react-native-codegen/BUCK | 3 +- packages/react-native-codegen/DEFS.bzl | 43 +++++++++++++------------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Libraries/BUCK b/Libraries/BUCK index 9dd9e38f5e077f..586510279a0321 100644 --- a/Libraries/BUCK +++ b/Libraries/BUCK @@ -40,7 +40,6 @@ rn_codegen_modules( name = "FBReactNativeSpec", android_package_name = "com.facebook.fbreact.specs", library_labels = ["supermodule:xplat/default/public.react_native.infra"], - native_module_spec_name = "FBReactNativeSpec", schema_target = ":FBReactNativeSpec-codegen-modules-schema", ) diff --git a/packages/react-native-codegen/BUCK b/packages/react-native-codegen/BUCK index d9da90a41f0ea3..d25c4ac87ea24a 100644 --- a/packages/react-native-codegen/BUCK +++ b/packages/react-native-codegen/BUCK @@ -27,9 +27,8 @@ rn_codegen_components( ) rn_codegen_modules( - name = "codegen_tests", + name = "FBReactNativeTestSpec", android_package_name = "com.facebook.fbreact.specs", - native_module_spec_name = "FBReactNativeTestSpec", schema_target = ":codegen_tests_schema", ) diff --git a/packages/react-native-codegen/DEFS.bzl b/packages/react-native-codegen/DEFS.bzl index 9bb04fb739cb47..6d990e65771147 100644 --- a/packages/react-native-codegen/DEFS.bzl +++ b/packages/react-native-codegen/DEFS.bzl @@ -104,17 +104,16 @@ def rn_codegen_cli(): def rn_codegen_modules( name, - native_module_spec_name, android_package_name, library_labels = [], schema_target = ""): - generate_fixtures_rule_name = "{}-codegen-modules".format(native_module_spec_name) - generate_module_hobjcpp_name = "{}-codegen-modules-hobjcpp".format(native_module_spec_name) - generate_module_mm_name = "{}-codegen-modules-mm".format(native_module_spec_name) - generate_module_java_name = "{}-codegen-modules-java".format(native_module_spec_name) - generate_module_java_zip_name = "{}-codegen-modules-java_zip".format(native_module_spec_name) - generate_module_jni_h_name = "{}-codegen-modules-jni_h".format(native_module_spec_name) - generate_module_jni_cpp_name = "{}-codegen-modules-jni_cpp".format(native_module_spec_name) + generate_fixtures_rule_name = "{}-codegen-modules".format(name) + generate_module_hobjcpp_name = "{}-codegen-modules-hobjcpp".format(name) + generate_module_mm_name = "{}-codegen-modules-mm".format(name) + generate_module_java_name = "{}-codegen-modules-java".format(name) + generate_module_java_zip_name = "{}-codegen-modules-java_zip".format(name) + generate_module_jni_h_name = "{}-codegen-modules-jni_h".format(name) + generate_module_jni_cpp_name = "{}-codegen-modules-jni_cpp".format(name) fb_native.genrule( name = generate_fixtures_rule_name, @@ -122,7 +121,7 @@ def rn_codegen_modules( cmd = "$(exe {generator_script}) $(location {schema_target}) {library_name} $OUT {android_package_name}".format( generator_script = react_native_root_target("packages/react-native-codegen:generate_all_from_schema"), schema_target = schema_target, - library_name = native_module_spec_name, + library_name = name, android_package_name = android_package_name, ), out = "codegenfiles-{}".format(name), @@ -151,20 +150,20 @@ def rn_codegen_modules( fb_native.genrule( name = generate_module_jni_h_name, - cmd = "cp $(location :{})/jni/{}.h $OUT".format(generate_fixtures_rule_name, native_module_spec_name), - out = "{}.h".format(native_module_spec_name), + cmd = "cp $(location :{})/jni/{}.h $OUT".format(generate_fixtures_rule_name, name), + out = "{}.h".format(name), labels = ["codegen_rule"], ) fb_native.genrule( name = generate_module_jni_cpp_name, - cmd = "cp $(location :{})/jni/{}-generated.cpp $OUT".format(generate_fixtures_rule_name, native_module_spec_name), - out = "{}-generated.cpp".format(native_module_spec_name), + cmd = "cp $(location :{})/jni/{}-generated.cpp $OUT".format(generate_fixtures_rule_name, name), + out = "{}-generated.cpp".format(name), labels = ["codegen_rule"], ) rn_android_library( - name = "{}".format(native_module_spec_name), + name = "{}".format(name), srcs = [ ":{}".format(generate_module_java_zip_name), ], @@ -183,7 +182,7 @@ def rn_codegen_modules( ) rn_xplat_cxx_library( - name = "{}-jni".format(native_module_spec_name), + name = "{}-jni".format(name), srcs = [ ":{}".format(generate_module_jni_cpp_name), ], @@ -192,7 +191,7 @@ def rn_codegen_modules( ":{}".format(generate_module_jni_h_name), ], exported_headers = { - "{}/{}.h".format(native_module_spec_name, native_module_spec_name): ":{}".format(generate_module_jni_h_name), + "{}/{}.h".format(name, name): ":{}".format(generate_module_jni_h_name), }, compiler_flags = [ "-fexceptions", @@ -224,20 +223,20 @@ def rn_codegen_modules( # iOS Buck build isn't fully working in OSS, so let's skip it for OSS for now. fb_native.genrule( name = generate_module_hobjcpp_name, - cmd = "cp $(location :{})/{}.h $OUT".format(generate_fixtures_rule_name, native_module_spec_name), - out = "{}.h".format(native_module_spec_name), + cmd = "cp $(location :{})/{}.h $OUT".format(generate_fixtures_rule_name, name), + out = "{}.h".format(name), labels = ["codegen_rule"], ) fb_native.genrule( name = generate_module_mm_name, - cmd = "cp $(location :{})/{}-generated.mm $OUT".format(generate_fixtures_rule_name, native_module_spec_name), - out = "{}-generated.mm".format(native_module_spec_name), + cmd = "cp $(location :{})/{}-generated.mm $OUT".format(generate_fixtures_rule_name, name), + out = "{}-generated.mm".format(name), labels = ["codegen_rule"], ) rn_apple_library( - name = "{}Apple".format(native_module_spec_name), + name = "{}Apple".format(name), extension_api_only = True, header_namespace = "", sdks = (IOS), @@ -245,7 +244,7 @@ def rn_codegen_modules( "-Wno-unused-private-field", ], exported_headers = { - "{}/{}.h".format(native_module_spec_name, native_module_spec_name): ":{}".format(generate_module_hobjcpp_name), + "{}/{}.h".format(name, name): ":{}".format(generate_module_hobjcpp_name), }, headers = [ ":{}".format(generate_module_hobjcpp_name),