Update RCTFabric to generate headers in the `React` folder when using Frameworks
Summary: By leveraging the `PUBLIC_HEADERS_FOLDER_PATH` build settings of Xcode, we can instruct cocoapods to generate the frameworks Headers in a specific folder, for example the `React` folder. This allows us to maintain the `#include`/`#import` structure, even if the framework has a different name. However, we need to update the search paths to take into account this extra folder. ## Changelog: [iOS][Changed] - Generate RCTFabric framework's headers in the React folder Reviewed By: sammy-SC, dmytrorykun Differential Revision: D43425677 fbshipit-source-id: 94a4f3a3c7de86341b3ce3457704e6b8fb9a588e
This commit is contained in:
Родитель
5d175c6775
Коммит
e7becb06c1
|
@ -123,6 +123,7 @@ package-lock.json
|
||||||
/packages/react-native-codegen/tmp/
|
/packages/react-native-codegen/tmp/
|
||||||
/ReactCommon/react/renderer/components/rncore/
|
/ReactCommon/react/renderer/components/rncore/
|
||||||
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
||||||
|
/**/RCTThirdPartyFabricComponentsProvider.*
|
||||||
|
|
||||||
|
|
||||||
# Additional SDKs
|
# Additional SDKs
|
||||||
|
|
|
@ -43,7 +43,8 @@ header_search_paths = [
|
||||||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.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-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios",
|
||||||
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core",
|
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core",
|
||||||
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios"
|
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios",
|
||||||
|
"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers/",
|
||||||
] : []).map{|p| "\"#{p}\""}.join(" ")
|
] : []).map{|p| "\"#{p}\""}.join(" ")
|
||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
// OSS-compatibility layer
|
// OSS-compatibility layer
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <RCTThirdPartyFabricComponentsProvider.h>
|
#import <React/RCTThirdPartyFabricComponentsProvider.h>
|
||||||
#import <React/RCTComponentViewProtocol.h>
|
#import <React/RCTComponentViewProtocol.h>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
|
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
|
||||||
#import <RCTFabricComponentPlugin/RCTFabricPluginProvider.h>
|
#import <RCTFabricComponentPlugin/RCTFabricPluginProvider.h>
|
||||||
#else
|
#else
|
||||||
#import "RCTFabricComponentsPlugins.h"
|
#import <React/RCTFabricComponentsPlugins.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import "RCTComponentViewClassDescriptor.h"
|
#import <React/RCTComponentViewClassDescriptor.h>
|
||||||
#import "RCTFabricComponentsPlugins.h"
|
#import <React/RCTFabricComponentsPlugins.h>
|
||||||
#import "RCTImageComponentView.h"
|
#import <React/RCTImageComponentView.h>
|
||||||
#import "RCTLegacyViewManagerInteropComponentView.h"
|
#import <React/RCTLegacyViewManagerInteropComponentView.h>
|
||||||
#import "RCTMountingTransactionObserving.h"
|
#import <React/RCTMountingTransactionObserving.h>
|
||||||
#import "RCTParagraphComponentView.h"
|
#import <React/RCTParagraphComponentView.h>
|
||||||
#import "RCTRootComponentView.h"
|
#import <React/RCTRootComponentView.h>
|
||||||
#import "RCTTextInputComponentView.h"
|
#import <React/RCTTextInputComponentView.h>
|
||||||
#import "RCTUnimplementedViewComponentView.h"
|
#import <React/RCTUnimplementedViewComponentView.h>
|
||||||
#import "RCTViewComponentView.h"
|
#import <React/RCTViewComponentView.h>
|
||||||
|
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
#import <React/RCTAssert.h>
|
#import <React/RCTAssert.h>
|
||||||
#import <React/RCTConstants.h>
|
#import <React/RCTConstants.h>
|
||||||
|
|
||||||
#import "RCTImageComponentView.h"
|
#import <React/RCTImageComponentView.h>
|
||||||
#import "RCTParagraphComponentView.h"
|
#import <React/RCTParagraphComponentView.h>
|
||||||
#import "RCTViewComponentView.h"
|
#import <React/RCTViewComponentView.h>
|
||||||
|
|
||||||
#import <butter/map.h>
|
#import <butter/map.h>
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
#import <react/renderer/debug/SystraceSection.h>
|
#import <react/renderer/debug/SystraceSection.h>
|
||||||
#import <react/renderer/mounting/TelemetryController.h>
|
#import <react/renderer/mounting/TelemetryController.h>
|
||||||
|
|
||||||
#import "RCTComponentViewProtocol.h"
|
#import <React/RCTComponentViewProtocol.h>
|
||||||
#import "RCTComponentViewRegistry.h"
|
#import <React/RCTComponentViewRegistry.h>
|
||||||
#import "RCTConversions.h"
|
#import <React/RCTConversions.h>
|
||||||
#import "RCTMountingTransactionObserverCoordinator.h"
|
#import <React/RCTMountingTransactionObserverCoordinator.h>
|
||||||
|
|
||||||
using namespace facebook::react;
|
using namespace facebook::react;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ if ENV['USE_FRAMEWORKS']
|
||||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\""
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\""
|
||||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\""
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\""
|
||||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\""
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\""
|
||||||
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""
|
||||||
end
|
end
|
||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
|
@ -62,7 +63,9 @@ Pod::Spec.new do |s|
|
||||||
"HEADER_SEARCH_PATHS" => header_search_paths,
|
"HEADER_SEARCH_PATHS" => header_search_paths,
|
||||||
"OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags,
|
"OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags,
|
||||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
||||||
}
|
}.merge!(ENV['USE_FRAMEWORKS'] != nil ? {
|
||||||
|
"PUBLIC_HEADERS_FOLDER_PATH" => "$(CONTENTS_FOLDER_PATH)/Headers/React"
|
||||||
|
}: {})
|
||||||
|
|
||||||
s.dependency "React-Core", version
|
s.dependency "React-Core", version
|
||||||
s.dependency "React-Fabric", version
|
s.dependency "React-Fabric", version
|
||||||
|
|
|
@ -24,7 +24,7 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
|
|
||||||
@prefix = "../.."
|
@prefix = "../.."
|
||||||
@third_party_provider_header = "RCTThirdPartyFabricComponentsProvider.h"
|
@third_party_provider_header = "RCTThirdPartyFabricComponentsProvider.h"
|
||||||
@third_party_provider_implementation = "RCTThirdPartyFabricComponentsProvider.cpp"
|
@third_party_provider_implementation = "RCTThirdPartyFabricComponentsProvider.mm"
|
||||||
@base_path = "~/app/ios"
|
@base_path = "~/app/ios"
|
||||||
@tmp_schema_list_file = "tmpSchemaList.txt"
|
@tmp_schema_list_file = "tmpSchemaList.txt"
|
||||||
Pathname.pwd!(@base_path)
|
Pathname.pwd!(@base_path)
|
||||||
|
@ -47,19 +47,19 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
|
|
||||||
# Arrange
|
# Arrange
|
||||||
FileMock.mocked_existing_files([
|
FileMock.mocked_existing_files([
|
||||||
@base_path + "/build/" + @third_party_provider_header,
|
@prefix + "/React/Fabric/" + @third_party_provider_header,
|
||||||
@base_path + "/build/" + @third_party_provider_implementation,
|
@prefix + "/React/Fabric/" + @third_party_provider_implementation,
|
||||||
])
|
])
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock)
|
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(Pathname.pwd_invocation_count, 1)
|
assert_equal(Pathname.pwd_invocation_count, 1)
|
||||||
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
||||||
assert_equal(FileMock.exist_invocation_params, [
|
assert_equal(FileMock.exist_invocation_params, [
|
||||||
@base_path + "/build/" + @third_party_provider_header,
|
@prefix + "/React/Fabric/" + @third_party_provider_header,
|
||||||
@base_path + "/build/" + @third_party_provider_implementation,
|
@prefix + "/React/Fabric/" + @third_party_provider_implementation,
|
||||||
])
|
])
|
||||||
assert_equal(DirMock.exist_invocation_params, [])
|
assert_equal(DirMock.exist_invocation_params, [])
|
||||||
assert_equal(Pod::UI.collected_messages, [])
|
assert_equal(Pod::UI.collected_messages, [])
|
||||||
|
@ -77,14 +77,14 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
assert_raise {
|
assert_raise {
|
||||||
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock)
|
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(Pathname.pwd_invocation_count, 1)
|
assert_equal(Pathname.pwd_invocation_count, 1)
|
||||||
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
||||||
assert_equal(FileMock.exist_invocation_params, [
|
assert_equal(FileMock.exist_invocation_params, [
|
||||||
@base_path + "/build/" + @third_party_provider_header
|
@prefix + "/React/Fabric/" + @third_party_provider_header
|
||||||
])
|
])
|
||||||
assert_equal(DirMock.exist_invocation_params, [
|
assert_equal(DirMock.exist_invocation_params, [
|
||||||
@base_path + "/"+ @prefix + "/packages/react-native-codegen",
|
@base_path + "/"+ @prefix + "/packages/react-native-codegen",
|
||||||
|
@ -100,8 +100,8 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
|
|
||||||
# Arrange
|
# Arrange
|
||||||
FileMock.mocked_existing_files([
|
FileMock.mocked_existing_files([
|
||||||
@base_path + "/build/" + @third_party_provider_header,
|
@prefix + "/React/Fabric/" + @third_party_provider_header,
|
||||||
@base_path + "/build/tmpSchemaList.txt"
|
@prefix + "/React/Fabric/tmpSchemaList.txt"
|
||||||
])
|
])
|
||||||
|
|
||||||
DirMock.mocked_existing_dirs([
|
DirMock.mocked_existing_dirs([
|
||||||
|
@ -110,15 +110,15 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
])
|
])
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock)
|
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(Pathname.pwd_invocation_count, 1)
|
assert_equal(Pathname.pwd_invocation_count, 1)
|
||||||
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
||||||
assert_equal(FileMock.exist_invocation_params, [
|
assert_equal(FileMock.exist_invocation_params, [
|
||||||
@base_path + "/build/" + @third_party_provider_header,
|
@prefix + "/React/Fabric/" + @third_party_provider_header,
|
||||||
@base_path + "/build/" + @third_party_provider_implementation,
|
@prefix + "/React/Fabric/" + @third_party_provider_implementation,
|
||||||
@base_path + "/build/tmpSchemaList.txt",
|
@prefix + "/React/Fabric/tmpSchemaList.txt",
|
||||||
])
|
])
|
||||||
assert_equal(DirMock.exist_invocation_params, [
|
assert_equal(DirMock.exist_invocation_params, [
|
||||||
@base_path + "/"+ @prefix + "/packages/react-native-codegen",
|
@base_path + "/"+ @prefix + "/packages/react-native-codegen",
|
||||||
|
@ -127,7 +127,7 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
assert_equal(Pod::UI.collected_messages, ["[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider"])
|
assert_equal(Pod::UI.collected_messages, ["[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider"])
|
||||||
assert_equal($collected_commands, [])
|
assert_equal($collected_commands, [])
|
||||||
assert_equal(FileMock.open_invocation_count, 1)
|
assert_equal(FileMock.open_invocation_count, 1)
|
||||||
assert_equal(FileMock.open_files_with_mode[@base_path + "/build/tmpSchemaList.txt"], 'w')
|
assert_equal(FileMock.open_files_with_mode[@prefix + "/React/Fabric/tmpSchemaList.txt"], 'w')
|
||||||
assert_equal(FileMock.open_files[0].collected_write, ["[]"])
|
assert_equal(FileMock.open_files[0].collected_write, ["[]"])
|
||||||
assert_equal(FileMock.open_files[0].fsync_invocation_count, 1)
|
assert_equal(FileMock.open_files[0].fsync_invocation_count, 1)
|
||||||
assert_equal(Pod::Executable.executed_commands[0], {
|
assert_equal(Pod::Executable.executed_commands[0], {
|
||||||
|
@ -135,12 +135,12 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
"arguments" => [
|
"arguments" => [
|
||||||
@base_path + "/" + @prefix + "/scripts/generate-provider-cli.js",
|
@base_path + "/" + @prefix + "/scripts/generate-provider-cli.js",
|
||||||
"--platform", 'ios',
|
"--platform", 'ios',
|
||||||
"--schemaListPath", @base_path + "/build/tmpSchemaList.txt",
|
"--schemaListPath", @prefix + "/React/Fabric/tmpSchemaList.txt",
|
||||||
"--outputDir", @base_path + "/build"
|
"--outputDir", @prefix + "/React/Fabric"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
assert_equal(FileMock.delete_invocation_count, 1)
|
assert_equal(FileMock.delete_invocation_count, 1)
|
||||||
assert_equal(FileMock.deleted_files, [@base_path + "/build/tmpSchemaList.txt"])
|
assert_equal(FileMock.deleted_files, [ @prefix + "/React/Fabric/tmpSchemaList.txt"])
|
||||||
end
|
end
|
||||||
|
|
||||||
def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen()
|
def testCheckAndGenerateEmptyThirdPartyProvider_whenBothMissing_buildCodegen()
|
||||||
|
@ -150,14 +150,14 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
codegen_cli_path,
|
codegen_cli_path,
|
||||||
])
|
])
|
||||||
# Act
|
# Act
|
||||||
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, 'build', dir_manager: DirMock, file_manager: FileMock)
|
checkAndGenerateEmptyThirdPartyProvider!(@prefix, false, dir_manager: DirMock, file_manager: FileMock)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(Pathname.pwd_invocation_count, 1)
|
assert_equal(Pathname.pwd_invocation_count, 1)
|
||||||
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
|
||||||
assert_equal(FileMock.exist_invocation_params, [
|
assert_equal(FileMock.exist_invocation_params, [
|
||||||
@base_path + "/build/" + @third_party_provider_header,
|
@prefix + "/React/Fabric/" + @third_party_provider_header,
|
||||||
@base_path + "/build/" + @tmp_schema_list_file
|
@prefix + "/React/Fabric/" + @tmp_schema_list_file
|
||||||
])
|
])
|
||||||
assert_equal(DirMock.exist_invocation_params, [
|
assert_equal(DirMock.exist_invocation_params, [
|
||||||
@base_path + "/" + @prefix + "/packages/react-native-codegen",
|
@base_path + "/" + @prefix + "/packages/react-native-codegen",
|
||||||
|
@ -176,8 +176,8 @@ class CodegenTests < Test::Unit::TestCase
|
||||||
"arguments" => [
|
"arguments" => [
|
||||||
@base_path + "/" + @prefix + "/scripts/generate-provider-cli.js",
|
@base_path + "/" + @prefix + "/scripts/generate-provider-cli.js",
|
||||||
"--platform", 'ios',
|
"--platform", 'ios',
|
||||||
"--schemaListPath", @base_path + "/build/" + @tmp_schema_list_file,
|
"--schemaListPath", @prefix + "/React/Fabric/" + @tmp_schema_list_file,
|
||||||
"--outputDir", @base_path + "/build"
|
"--outputDir", @prefix + "/React/Fabric"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -417,9 +417,10 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||||
CodegenUtils.set_cleanup_done(false)
|
CodegenUtils.set_cleanup_done(false)
|
||||||
codegen_dir = "build/generated/ios"
|
codegen_dir = "build/generated/ios"
|
||||||
ios_folder = '.'
|
ios_folder = '.'
|
||||||
|
rn_path = '../node_modules/react-native'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
CodegenUtils.clean_up_build_folder(@base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
|
CodegenUtils.clean_up_build_folder(rn_path, @base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0)
|
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0)
|
||||||
|
@ -440,17 +441,23 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||||
"#{codegen_path}/react/components/MyComponent/ShadowNode.h",
|
"#{codegen_path}/react/components/MyComponent/ShadowNode.h",
|
||||||
"#{codegen_path}/react/components/MyComponent/ShadowNode.mm",
|
"#{codegen_path}/react/components/MyComponent/ShadowNode.mm",
|
||||||
]
|
]
|
||||||
|
rn_path = '../node_modules/react-native'
|
||||||
|
|
||||||
DirMock.mocked_existing_dirs(codegen_path)
|
DirMock.mocked_existing_dirs(codegen_path)
|
||||||
DirMock.mocked_existing_globs(globs, "#{codegen_path}/*")
|
DirMock.mocked_existing_globs(globs, "#{codegen_path}/*")
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
CodegenUtils.clean_up_build_folder(@base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
|
CodegenUtils.clean_up_build_folder(rn_path, @base_path, ios_folder, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(DirMock.exist_invocation_params, [codegen_path, codegen_path])
|
assert_equal(DirMock.exist_invocation_params, [codegen_path, codegen_path])
|
||||||
assert_equal(DirMock.glob_invocation, ["#{codegen_path}/*", "#{codegen_path}/*"])
|
assert_equal(DirMock.glob_invocation, ["#{codegen_path}/*", "#{codegen_path}/*"])
|
||||||
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 1)
|
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 3)
|
||||||
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [globs])
|
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [
|
||||||
|
globs,
|
||||||
|
"#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.h",
|
||||||
|
"#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm",
|
||||||
|
])
|
||||||
assert_equal(CodegenUtils.cleanup_done(), true)
|
assert_equal(CodegenUtils.cleanup_done(), true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -566,8 +573,8 @@ class CodegenUtilsTests < Test::Unit::TestCase
|
||||||
def get_podspec_when_use_frameworks
|
def get_podspec_when_use_frameworks
|
||||||
specs = get_podspec_no_fabric_no_script()
|
specs = get_podspec_no_fabric_no_script()
|
||||||
|
|
||||||
specs["pod_target_xcconfig"]["FRAMEWORK_SEARCH_PATHS"].concat(["\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric\""])
|
specs["pod_target_xcconfig"]["FRAMEWORK_SEARCH_PATHS"].concat([])
|
||||||
specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.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)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\"")
|
specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.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)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"")
|
||||||
|
|
||||||
specs[:dependencies].merge!({
|
specs[:dependencies].merge!({
|
||||||
'React-graphics': [],
|
'React-graphics': [],
|
||||||
|
|
|
@ -159,7 +159,7 @@ class NewArchitectureTests < Test::Unit::TestCase
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
|
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
|
||||||
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"${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\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"")
|
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"${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\" \"${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\"")
|
||||||
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
||||||
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
||||||
assert_equal(
|
assert_equal(
|
||||||
|
@ -190,7 +190,7 @@ class NewArchitectureTests < Test::Unit::TestCase
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}")
|
assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}")
|
||||||
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"${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\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"")
|
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"${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\" \"${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\"")
|
||||||
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
||||||
assert_equal(
|
assert_equal(
|
||||||
spec.dependencies,
|
spec.dependencies,
|
||||||
|
|
|
@ -34,18 +34,17 @@ def build_codegen!(react_native_path, relative_installation_root, dir_manager: D
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# - react_native_path: path to the react native framework
|
# - react_native_path: path to the react native framework
|
||||||
# - new_arch_enabled: whether the New Architecture is enabled or not
|
# - new_arch_enabled: whether the New Architecture is enabled or not
|
||||||
# - codegen_output_dir: the output directory for the codegen
|
|
||||||
# - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes.
|
# - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes.
|
||||||
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
||||||
def checkAndGenerateEmptyThirdPartyProvider!(react_native_path, new_arch_enabled, codegen_output_dir, dir_manager: Dir, file_manager: File)
|
def checkAndGenerateEmptyThirdPartyProvider!(react_native_path, new_arch_enabled, dir_manager: Dir, file_manager: File)
|
||||||
return if new_arch_enabled
|
return if new_arch_enabled
|
||||||
|
|
||||||
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
||||||
|
|
||||||
output_dir = "#{relative_installation_root}/#{codegen_output_dir}"
|
output_dir = "#{react_native_path}/React/Fabric"
|
||||||
|
|
||||||
provider_h_path = "#{output_dir}/RCTThirdPartyFabricComponentsProvider.h"
|
provider_h_path = "#{output_dir}/RCTThirdPartyFabricComponentsProvider.h"
|
||||||
provider_cpp_path ="#{output_dir}/RCTThirdPartyFabricComponentsProvider.cpp"
|
provider_cpp_path ="#{output_dir}/RCTThirdPartyFabricComponentsProvider.mm"
|
||||||
|
|
||||||
if(!file_manager.exist?(provider_h_path) || !file_manager.exist?(provider_cpp_path))
|
if(!file_manager.exist?(provider_h_path) || !file_manager.exist?(provider_cpp_path))
|
||||||
# build codegen
|
# build codegen
|
||||||
|
|
|
@ -95,10 +95,9 @@ class CodegenUtils
|
||||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"",
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"",
|
||||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.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)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
||||||
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\""
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core/platform/ios\"",
|
||||||
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"",
|
||||||
])
|
])
|
||||||
|
|
||||||
framework_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric\""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
spec = {
|
spec = {
|
||||||
|
@ -127,7 +126,7 @@ class CodegenUtils
|
||||||
"React-Core": [],
|
"React-Core": [],
|
||||||
"React-jsi": [],
|
"React-jsi": [],
|
||||||
"ReactCommon/turbomodule/bridging": [],
|
"ReactCommon/turbomodule/bridging": [],
|
||||||
"ReactCommon/turbomodule/core": []
|
"ReactCommon/turbomodule/core": [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +338,7 @@ class CodegenUtils
|
||||||
return @@CLEANUP_DONE
|
return @@CLEANUP_DONE
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.clean_up_build_folder(app_path, ios_folder, codegen_dir, dir_manager: Dir, file_manager: File)
|
def self.clean_up_build_folder(rn_path, app_path, ios_folder, codegen_dir, dir_manager: Dir, file_manager: File)
|
||||||
return if CodegenUtils.cleanup_done()
|
return if CodegenUtils.cleanup_done()
|
||||||
CodegenUtils.set_cleanup_done(true)
|
CodegenUtils.set_cleanup_done(true)
|
||||||
|
|
||||||
|
@ -347,6 +346,9 @@ class CodegenUtils
|
||||||
return if !dir_manager.exist?(codegen_path)
|
return if !dir_manager.exist?(codegen_path)
|
||||||
|
|
||||||
FileUtils.rm_rf(dir_manager.glob("#{codegen_path}/*"))
|
FileUtils.rm_rf(dir_manager.glob("#{codegen_path}/*"))
|
||||||
|
base_provider_path = file_manager.join(rn_path, 'React', 'Fabric', 'RCTThirdPartyFabricComponentsProvider')
|
||||||
|
FileUtils.rm_rf("#{base_provider_path}.h")
|
||||||
|
FileUtils.rm_rf("#{base_provider_path}.mm")
|
||||||
CodegenUtils.assert_codegen_folder_is_empty(app_path, ios_folder, codegen_dir, dir_manager: dir_manager, file_manager: file_manager)
|
CodegenUtils.assert_codegen_folder_is_empty(app_path, ios_folder, codegen_dir, dir_manager: dir_manager, file_manager: file_manager)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,4 @@ def setup_fabric!(react_native_path: "../node_modules/react-native", new_arch_en
|
||||||
pod 'React-RCTFabric', :path => "#{react_native_path}/React", :modular_headers => true
|
pod 'React-RCTFabric', :path => "#{react_native_path}/React", :modular_headers => true
|
||||||
pod 'React-ImageManager', :path => "#{react_native_path}/ReactCommon/react/renderer/imagemanager/platform/ios"
|
pod 'React-ImageManager', :path => "#{react_native_path}/ReactCommon/react/renderer/imagemanager/platform/ios"
|
||||||
pod 'RCT-Folly/Fabric', :podspec => "#{react_native_path}/third-party-podspecs/RCT-Folly.podspec"
|
pod 'RCT-Folly/Fabric', :podspec => "#{react_native_path}/third-party-podspecs/RCT-Folly.podspec"
|
||||||
|
|
||||||
pod 'React-rncore', :path => "#{react_native_path}/ReactCommon" if !new_arch_enabled
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,6 +87,7 @@ class NewArchitectureHelper
|
||||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""
|
||||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\""
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\""
|
||||||
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\""
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\""
|
||||||
|
header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""
|
||||||
end
|
end
|
||||||
header_search_paths_string = header_search_paths.join(" ")
|
header_search_paths_string = header_search_paths.join(" ")
|
||||||
spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
|
spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
|
||||||
|
|
|
@ -401,6 +401,8 @@ function createComponentProvider(
|
||||||
fs.closeSync(fd);
|
fs.closeSync(fd);
|
||||||
console.log(`Generated schema list: ${schemaListTmpPath}`);
|
console.log(`Generated schema list: ${schemaListTmpPath}`);
|
||||||
|
|
||||||
|
const outputDir = path.join(RN_ROOT, 'React', 'Fabric');
|
||||||
|
|
||||||
// Generate FabricComponentProvider.
|
// Generate FabricComponentProvider.
|
||||||
// Only for iOS at this moment.
|
// Only for iOS at this moment.
|
||||||
executeNodeScript(
|
executeNodeScript(
|
||||||
|
@ -409,9 +411,9 @@ function createComponentProvider(
|
||||||
RN_ROOT,
|
RN_ROOT,
|
||||||
'scripts',
|
'scripts',
|
||||||
'generate-provider-cli.js',
|
'generate-provider-cli.js',
|
||||||
)} --platform ios --schemaListPath "${schemaListTmpPath}" --outputDir ${iosOutputDir}`,
|
)} --platform ios --schemaListPath "${schemaListTmpPath}" --outputDir ${outputDir}`,
|
||||||
);
|
);
|
||||||
console.log(`Generated provider in: ${iosOutputDir}`);
|
console.log(`Generated provider in: ${outputDir}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ def use_react_native! (
|
||||||
# that has invoked the `use_react_native!` function.
|
# that has invoked the `use_react_native!` function.
|
||||||
ReactNativePodsUtils.detect_use_frameworks(current_target_definition)
|
ReactNativePodsUtils.detect_use_frameworks(current_target_definition)
|
||||||
|
|
||||||
CodegenUtils.clean_up_build_folder(app_path, ios_folder, $CODEGEN_OUTPUT_DIR)
|
CodegenUtils.clean_up_build_folder(path, app_path, ios_folder, $CODEGEN_OUTPUT_DIR)
|
||||||
|
|
||||||
# We are relying on this flag also in third parties libraries to proper install dependencies.
|
# We are relying on this flag also in third parties libraries to proper install dependencies.
|
||||||
# Better to rely and enable this environment flag if the new architecture is turned on using flags.
|
# Better to rely and enable this environment flag if the new architecture is turned on using flags.
|
||||||
|
@ -139,7 +139,7 @@ def use_react_native! (
|
||||||
pod 'React-Codegen', :path => $CODEGEN_OUTPUT_DIR, :modular_headers => true
|
pod 'React-Codegen', :path => $CODEGEN_OUTPUT_DIR, :modular_headers => true
|
||||||
|
|
||||||
if fabric_enabled
|
if fabric_enabled
|
||||||
checkAndGenerateEmptyThirdPartyProvider!(prefix, new_arch_enabled, $CODEGEN_OUTPUT_DIR)
|
checkAndGenerateEmptyThirdPartyProvider!(prefix, new_arch_enabled)
|
||||||
setup_fabric!(:react_native_path => prefix, new_arch_enabled: new_arch_enabled)
|
setup_fabric!(:react_native_path => prefix, new_arch_enabled: new_arch_enabled)
|
||||||
else
|
else
|
||||||
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче