Skip to content

Commit

Permalink
Rename React-Codegen to ReactCodegen
Browse files Browse the repository at this point in the history
Summary:
This diff renames React-Codegen to ReactCodegen. This way we'll no longer have to try both
```
#include <React-Codegen/MyModule.h>
```
and additionally
```
#include <React_Codegen/MyModule.h>
```
for cases with `use_frameworks`.

Changelog: [iOS][Breaking] - Rename React-Codegen to ReactCodegen

Reviewed By: cipolleschi

Differential Revision: D54068492

fbshipit-source-id: dab8ea2034d299266482929061caa14397421445
  • Loading branch information
dmytrorykun authored and facebook-github-bot committed Feb 22, 2024
1 parent e33767a commit 6549216
Show file tree
Hide file tree
Showing 25 changed files with 152 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@
// jsinspector-modern
#import <jsinspector-modern/InspectorFlags.h>

#if __has_include(<React-Codegen/RCTModulesConformingToProtocolsProvider.h>)
#if __has_include(<ReactCodegen/RCTModulesConformingToProtocolsProvider.h>)
#define USE_OSS_CODEGEN 1
#import <React-Codegen/RCTModulesConformingToProtocolsProvider.h>
#elif __has_include(<React_Codegen/RCTModulesConformingToProtocolsProvider.h>)
#define USE_OSS_CODEGEN 1
#import <React_Codegen/RCTModulesConformingToProtocolsProvider.h>
#import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
#else
// Meta internal system do not generate the RCTModulesConformingToProtocolsProvider.h file
#define USE_OSS_CODEGEN 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Pod::Spec.new do |s|
s.dependency "React-RCTImage"
s.dependency "React-CoreModules"
s.dependency "React-nativeconfig"
s.dependency "React-Codegen"
s.dependency "ReactCodegen"

add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple")
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Blob/React-RCTBlob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ header_search_paths = [
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/DoubleConversion\"",
"\"$(PODS_ROOT)/fmt/include\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -55,7 +55,7 @@ Pod::Spec.new do |s|
s.dependency "React-Core/RCTWebSocket"
s.dependency "React-RCTNetwork"

add_dependency(s, "React-Codegen")
add_dependency(s, "ReactCodegen")
add_dependency(s, "React-NativeModulesApple")
add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Image/React-RCTImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]


Expand Down Expand Up @@ -53,7 +53,7 @@ Pod::Spec.new do |s|
s.dependency "React-Core/RCTImageHeaders"
s.dependency "React-RCTNetwork"

add_dependency(s, "React-Codegen")
add_dependency(s, "ReactCodegen")
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand All @@ -49,7 +49,7 @@ Pod::Spec.new do |s|
s.dependency "ReactCommon/turbomodule/core", version
s.dependency "React-jsi", version

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand All @@ -49,7 +49,7 @@ Pod::Spec.new do |s|
s.dependency "React-jsi"
s.dependency "React-Core/RCTAnimationHeaders"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple")
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -50,7 +50,7 @@ Pod::Spec.new do |s|
s.dependency "React-jsi"
s.dependency "React-Core/RCTNetworkHeaders"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -50,7 +50,7 @@ Pod::Spec.new do |s|
s.dependency "React-Core/RCTPushNotificationHeaders"
s.dependency "React-jsi"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple")
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -50,7 +50,7 @@ Pod::Spec.new do |s|
s.dependency "React-jsi"
s.dependency "React-Core/RCTSettingsHeaders"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -50,7 +50,7 @@ Pod::Spec.new do |s|
s.dependency "React-jsi"
s.dependency "React-Core/RCTVibrationHeaders"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple")
end
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"$(PODS_ROOT)/DoubleConversion\"",
"\"$(PODS_ROOT)/fmt/include\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -59,7 +59,7 @@ Pod::Spec.new do |s|
s.dependency "SocketRocket", socket_rocket_version
add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')

add_dependency(s, "React-Codegen")
add_dependency(s, "ReactCodegen")
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple")
end
2 changes: 1 addition & 1 deletion packages/react-native/React/React-RCTFabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"$(PODS_ROOT)/Headers/Private/React-Core\"",
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
"\"$(PODS_ROOT)/Headers/Public/React-Codegen\"",
"\"$(PODS_ROOT)/Headers/Public/ReactCodegen\"",
]

if ENV['USE_FRAMEWORKS']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if ENV['USE_FRAMEWORKS']
"\"$(PODS_TARGET_SRCROOT)\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/textlayoutmanager/platform/ios\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/components/textinput/platform/ios\"",
# "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers\"",
# "\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCodegen/ReactCodegen.framework/Headers\"",
]
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Pod::Spec.new do |s|
s.dependency "React-Core"
s.dependency "React-cxxreact"
s.dependency "React-jsi"
add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def testGenerateReactCodegenPodspec_whenItHasBeenAlreadyGenerated_doesNothing
CodegenUtils.new().generate_react_codegen_podspec!(spec, codegen_output_dir, file_manager: FileMock)

# Assert
assert_equal(Pod::UI.collected_messages, ["[Codegen] Skipping React-Codegen podspec generation."])
assert_equal(Pod::UI.collected_messages, ["[Codegen] Skipping ReactCodegen podspec generation."])
assert_equal(Pathname.pwd_invocation_count, 0)
assert_equal(Pod::Executable.executed_commands, [])
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 0)
Expand All @@ -83,8 +83,8 @@ def testGenerateReactCodegenPodspec_whenItHasNotBeenAlreadyGenerated_generatesIt
assert_equal(Pathname.pwd_invocation_count, 1)
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
assert_equal(Pod::Executable.executed_commands, [{ "command" => 'mkdir', "arguments" => ["-p", "~/app/ios/build"]}])
assert_equal(Pod::UI.collected_messages, ["[Codegen] Generating ~/app/ios/build/React-Codegen.podspec.json"])
assert_equal(FileMock.open_files_with_mode["~/app/ios/build/React-Codegen.podspec.json"], 'w')
assert_equal(Pod::UI.collected_messages, ["[Codegen] Generating ~/app/ios/build/ReactCodegen.podspec.json"])
assert_equal(FileMock.open_files_with_mode["~/app/ios/build/ReactCodegen.podspec.json"], 'w')
assert_equal(FileMock.open_files[0].collected_write, ['{"name":"Test Podspec"}'])
assert_equal(FileMock.open_files[0].fsync_invocation_count, 1)

Expand All @@ -108,7 +108,7 @@ def testGetReactCodegenSpec_whenFabricEnabledAndScriptPhases_generatesAPodspec

# Assert
assert_equal(podspec, get_podspec_fabric_and_script_phases("echo Test Script Phase"))
assert_equal(Pod::UI.collected_messages, ["[Codegen] Adding script_phases to React-Codegen."])
assert_equal(Pod::UI.collected_messages, ["[Codegen] Adding script_phases to ReactCodegen."])
end

def testGetReactCodegenSpec_whenUseFrameworksAndNewArch_generatesAPodspec
Expand Down Expand Up @@ -337,7 +337,7 @@ def testUseReactCodegenDiscovery_whenParametersAreGood_executeCodegen
# Arrange
app_path = "~/app"
computed_script = "echo TestScript"
codegen_spec = {"name" => "React-Codegen"}
codegen_spec = {"name" => "ReactCodegen"}

codegen_utils_mock = CodegenUtilsMock.new(
:react_codegen_script_phases => computed_script,
Expand Down Expand Up @@ -370,7 +370,7 @@ def testUseReactCodegenDiscovery_whenParametersAreGood_executeCodegen
}])
assert_equal(codegen_utils_mock.generate_react_codegen_spec_params, [{
:codegen_output_dir=>"build/generated/ios",
:react_codegen_spec=>{"name"=>"React-Codegen"}
:react_codegen_spec=>{"name"=>"ReactCodegen"}
}])
assert_equal(Pod::Executable.executed_commands, [
{
Expand Down Expand Up @@ -501,7 +501,7 @@ def test_assertCodegenFolderIsEmpty_whenItIsNotEmpty_itAborts

def get_podspec_no_fabric_no_script
spec = {
'name' => "React-Codegen",
'name' => "ReactCodegen",
'version' => "99.98.97",
'summary' => 'Temp pod for generated files for React Native',
'homepage' => 'https://facebook.com/',
Expand All @@ -522,7 +522,7 @@ def get_podspec_no_fabric_no_script
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"$(PODS_ROOT)/DoubleConversion\"",
"\"$(PODS_ROOT)/fmt/include\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths
{ :dependency_name => "RCT-Folly", "version"=>"2024.01.01.00" },
{ :dependency_name => "glog" },
{ :dependency_name => "React-RCTFabric" },
{ :dependency_name => "React-Codegen" },
{ :dependency_name => "ReactCodegen" },
{ :dependency_name => "RCTRequired" },
{ :dependency_name => "RCTTypeSafety" },
{ :dependency_name => "ReactCommon/turbomodule/bridging" },
Expand All @@ -184,7 +184,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler
# Arrange
spec = SpecMock.new
spec.compiler_flags = ''
other_flags = "\"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
other_flags = "\"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCodegen/ReactCodegen.framework/Headers\""
spec.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => other_flags
}
Expand All @@ -203,7 +203,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler
{ :dependency_name => "RCT-Folly", "version"=>"2024.01.01.00" },
{ :dependency_name => "glog" },
{ :dependency_name => "React-RCTFabric" },
{ :dependency_name => "React-Codegen" },
{ :dependency_name => "ReactCodegen" },
{ :dependency_name => "RCTRequired" },
{ :dependency_name => "RCTTypeSafety" },
{ :dependency_name => "ReactCommon/turbomodule/bridging" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def test_updateSearchPaths_whenUseFrameworks_addsSearchPaths
first_target = prepare_target("FirstTarget")
second_target = prepare_target("SecondTarget", nil, [
DependencyMock.new("RCT-Folly"),
DependencyMock.new("React-Codegen"),
DependencyMock.new("ReactCodegen"),
DependencyMock.new("ReactCommon"),
DependencyMock.new("React-RCTFabric"),
DependencyMock.new("React-ImageManager"),
Expand Down Expand Up @@ -798,7 +798,7 @@ def test_updateSearchPaths_whenUseFrameworks_addsSearchPaths
if pod_name == "SecondTarget"
target_installation_result.native_target.build_configurations.each do |config|
received_search_path = config.build_settings["HEADER_SEARCH_PATHS"]
expected_Search_path = "$(inherited) \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fmt/include\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/imagemanager/platform/ios\""
expected_Search_path = "$(inherited) \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fmt/include\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCodegen/ReactCodegen.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/imagemanager/platform/ios\""
assert_equal(received_search_path, expected_Search_path)
end
else
Expand Down
Loading

0 comments on commit 6549216

Please sign in to comment.