Skip to content

Commit 4118d79

Browse files
alloyfacebook-github-bot
authored andcommitted
Rename autolinking-ios.rb script and bring RNTester and template in line. (#28077)
Summary: Make the script ready for picking in 0.62.0-rc.3. * Rename the script to remove ambiguity. “autolinking” is a CLI feature where 3rd-party pods are automatically discovered: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md * Make the Flipper version of the pods configurable, as requested [here](#28044 (comment)). * Make RNTester’s Podfile use the same form as the template–including enabling Flipper by moving the CPP define into the right place in the Xcode project and out of the Podfile. * Get rid of Podfile.lock thrashing by making the default CDN spec source explicit. ## Changelog [iOS] [Changed] - Disambiguate autolinking-ios.rb script from CLI’s “autolinking” feature and bring RNTester & template in line. Pull Request resolved: #28077 Test Plan: RNTester builds, as does a new application. Reviewed By: PeteTheHeat Differential Revision: D19956392 Pulled By: TheSavior fbshipit-source-id: 6c800ddb646b49fc45c088978e2794cd7b60ea48
1 parent 60c1507 commit 4118d79

File tree

6 files changed

+51
-85
lines changed

6 files changed

+51
-85
lines changed

RNTester/Podfile

+22-52
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
platform :ios, '10.0'
1+
require_relative '../scripts/react_native_pods'
22

3-
require_relative '../scripts/autolink-ios'
3+
source 'https://cdn.cocoapods.org/'
4+
platform :ios, '10.0'
45

56
if ENV['USE_FRAMEWORKS'] == '1'
67
puts "Installing pods with use_frameworks!"
@@ -24,55 +25,9 @@ def pods()
2425
# use_react_native!(path: "..", fabric_enabled: true)
2526
end
2627

27-
28-
def flipper_pods()
29-
flipperkit_version = '0.30.1'
30-
pod 'FlipperKit', '~>' + flipperkit_version, :configuration => 'Debug'
31-
pod 'FlipperKit/FlipperKitLayoutPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
32-
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
33-
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
34-
pod 'FlipperKit/FlipperKitReactPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
35-
36-
if ENV['USE_FRAMEWORKS'] == '1'
37-
$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
38-
'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
39-
'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket',
40-
'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
41-
42-
pre_install do |installer|
43-
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
44-
installer.pod_targets.each do |pod|
45-
if $static_framework.include?(pod.name)
46-
def pod.build_type;
47-
Pod::Target::BuildType.static_library
48-
end
49-
end
50-
end
51-
end
52-
end
53-
end
54-
55-
# Post Install processing for Flipper
56-
def flipper_post_install(installer)
57-
file_name = Dir.glob("*.xcodeproj")[0]
58-
app_project = Xcodeproj::Project.open(file_name)
59-
app_project.native_targets.each do |target|
60-
target.build_configurations.each do |config|
61-
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
62-
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
63-
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
64-
cflags << ' -DFB_SONARKIT_ENABLED=1 '
65-
end
66-
config.build_settings['OTHER_CFLAGS'] = cflags
67-
end
68-
app_project.save
69-
end
70-
installer.pods_project.save
71-
end
72-
7328
target 'RNTester' do
7429
pods()
75-
flipper_pods()
30+
use_flipper!
7631
end
7732

7833
target 'RNTesterUnitTests' do
@@ -85,9 +40,24 @@ target 'RNTesterIntegrationTests' do
8540
pod 'React-RCTTest', :path => "./RCTTest"
8641
end
8742

43+
if ENV['USE_FRAMEWORKS'] == '1'
44+
static_frameworks = ['FlipperKit', 'Flipper', 'Flipper-Folly',
45+
'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
46+
'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket',
47+
'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
48+
49+
pre_install do |installer|
50+
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
51+
installer.pod_targets.each do |pod|
52+
if static_frameworks.include?(pod.name)
53+
def pod.build_type
54+
Pod::Target::BuildType.static_library
55+
end
56+
end
57+
end
58+
end
59+
end
60+
8861
post_install do |installer|
8962
flipper_post_install(installer)
90-
installer.pods_project.targets.each do |target|
91-
puts target.name
92-
end
9363
end

RNTester/Podfile.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,11 @@ DEPENDENCIES:
338338
- DoubleConversion (from `../third-party-podspecs/DoubleConversion.podspec`)
339339
- FBLazyVector (from `../Libraries/FBLazyVector`)
340340
- FBReactNativeSpec (from `../Libraries/FBReactNativeSpec`)
341-
- FlipperKit (~> 0.30.1)
342-
- FlipperKit/FlipperKitLayoutPlugin (~> 0.30.1)
343-
- FlipperKit/FlipperKitReactPlugin (~> 0.30.1)
344-
- FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.30.1)
345-
- FlipperKit/SKIOSNetworkPlugin (~> 0.30.1)
341+
- FlipperKit (~> 0.30.2)
342+
- FlipperKit/FlipperKitLayoutPlugin (~> 0.30.2)
343+
- FlipperKit/FlipperKitReactPlugin (~> 0.30.2)
344+
- FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.30.2)
345+
- FlipperKit/SKIOSNetworkPlugin (~> 0.30.2)
346346
- Folly (from `../third-party-podspecs/Folly.podspec`)
347347
- glog (from `../third-party-podspecs/glog.podspec`)
348348
- RCTRequired (from `../Libraries/RCTRequired`)
@@ -488,6 +488,6 @@ SPEC CHECKSUMS:
488488
Yoga: f7fa200d8c49f97b54c9421079e781fb900b5cae
489489
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
490490

491-
PODFILE CHECKSUM: 317625c4a1217b69f61b4979b58e9ef2f376f583
491+
PODFILE CHECKSUM: 5f0be4be03d6934478b9dd621bfbab4383b8c85d
492492

493493
COCOAPODS: 1.8.4

RNTester/RNTesterPods.xcodeproj/project.pbxproj

+16-20
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; };
1414
2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */; };
1515
3D2AFAF51D646CF80089D1A3 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* [email protected] */; };
16-
442B673CCEF28320AE16877B /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3C8BDC1E54DFC8EB0F67828 /* libPods-RNTester.a */; };
1716
5C60EB1C226440DB0018C04F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C60EB1B226440DB0018C04F /* AppDelegate.mm */; };
1817
5CB07C9B226467E60039471C /* RNTesterTurboModuleProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */; };
19-
AB71F075B51B1FA0C65DCF39 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2723489EF058D50FF7217FD9 /* libPods-RNTesterUnitTests.a */; };
20-
CBC719CA19D2FD9247BD28F1 /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 67373A0E14C242E758EE729F /* libPods-RNTesterIntegrationTests.a */; };
18+
6766440649168A1FAD1DB4A4 /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F836A7C97EC1BA121BA5A2A /* libPods-RNTesterIntegrationTests.a */; };
19+
6ABAB5205C9B8E0726E12033 /* libPods-RNTester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B5C8E567A4E6281113811CB1 /* libPods-RNTester.a */; };
20+
85C7978AB28C149170A56955 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 11941849F77C552FDC3EED77 /* libPods-RNTesterUnitTests.a */; };
2121
E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */; };
2222
E7DB20D122B2BAA6005AC45F /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */; };
2323
E7DB20D222B2BAA6005AC45F /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */; };
@@ -69,12 +69,12 @@
6969
/* End PBXContainerItemProxy section */
7070

7171
/* Begin PBXFileReference section */
72+
11941849F77C552FDC3EED77 /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
7273
13B07F961A680F5B00A75B9A /* RNTester.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNTester.app; sourceTree = BUILT_PRODUCTS_DIR; };
7374
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = RNTester/AppDelegate.h; sourceTree = "<group>"; };
7475
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
7576
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = "<group>"; };
7677
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNTester/main.m; sourceTree = "<group>"; };
77-
2723489EF058D50FF7217FD9 /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
7878
272E6B3B1BEA849E001FCF37 /* UpdatePropertiesExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UpdatePropertiesExampleView.h; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.h; sourceTree = "<group>"; };
7979
272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UpdatePropertiesExampleView.m; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.m; sourceTree = "<group>"; };
8080
27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlexibleSizeExampleView.m; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.m; sourceTree = "<group>"; };
@@ -86,11 +86,11 @@
8686
5C60EB1B226440DB0018C04F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = RNTester/AppDelegate.mm; sourceTree = "<group>"; };
8787
5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RNTesterTurboModuleProvider.mm; path = RNTester/RNTesterTurboModuleProvider.mm; sourceTree = "<group>"; };
8888
5CB07C9A226467E60039471C /* RNTesterTurboModuleProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNTesterTurboModuleProvider.h; path = RNTester/RNTesterTurboModuleProvider.h; sourceTree = "<group>"; };
89-
67373A0E14C242E758EE729F /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
89+
5F836A7C97EC1BA121BA5A2A /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9090
7D51F73F0DA20287418D98BD /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = "<group>"; };
9191
972A459EE6CF8CC63531A088 /* Pods-RNTesterIntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.debug.xcconfig"; sourceTree = "<group>"; };
9292
98233960D1D6A1977D1C7EAF /* Pods-RNTester.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RNTester/Pods-RNTester.debug.xcconfig"; sourceTree = "<group>"; };
93-
D3C8BDC1E54DFC8EB0F67828 /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; };
93+
B5C8E567A4E6281113811CB1 /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; };
9494
E771AEEA22B44E3100EA1189 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = "<group>"; };
9595
E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests.m; sourceTree = "<group>"; };
9696
E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -171,7 +171,7 @@
171171
isa = PBXFrameworksBuildPhase;
172172
buildActionMask = 2147483647;
173173
files = (
174-
442B673CCEF28320AE16877B /* libPods-RNTester.a in Frameworks */,
174+
6ABAB5205C9B8E0726E12033 /* libPods-RNTester.a in Frameworks */,
175175
);
176176
runOnlyForDeploymentPostprocessing = 0;
177177
};
@@ -181,7 +181,7 @@
181181
files = (
182182
E7DB213122B2C649005AC45F /* JavaScriptCore.framework in Frameworks */,
183183
E7DB213222B2C67D005AC45F /* libOCMock.a in Frameworks */,
184-
AB71F075B51B1FA0C65DCF39 /* libPods-RNTesterUnitTests.a in Frameworks */,
184+
85C7978AB28C149170A56955 /* libPods-RNTesterUnitTests.a in Frameworks */,
185185
);
186186
runOnlyForDeploymentPostprocessing = 0;
187187
};
@@ -191,7 +191,7 @@
191191
files = (
192192
E7DB218C22B41FCD005AC45F /* XCTest.framework in Frameworks */,
193193
E7DB216722B2F69F005AC45F /* JavaScriptCore.framework in Frameworks */,
194-
CBC719CA19D2FD9247BD28F1 /* libPods-RNTesterIntegrationTests.a in Frameworks */,
194+
6766440649168A1FAD1DB4A4 /* libPods-RNTesterIntegrationTests.a in Frameworks */,
195195
);
196196
runOnlyForDeploymentPostprocessing = 0;
197197
};
@@ -261,9 +261,9 @@
261261
E7DB211822B2BD53005AC45F /* libReact-RCTText.a */,
262262
E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */,
263263
E7DB212222B2BD53005AC45F /* libyoga.a */,
264-
D3C8BDC1E54DFC8EB0F67828 /* libPods-RNTester.a */,
265-
67373A0E14C242E758EE729F /* libPods-RNTesterIntegrationTests.a */,
266-
2723489EF058D50FF7217FD9 /* libPods-RNTesterUnitTests.a */,
264+
B5C8E567A4E6281113811CB1 /* libPods-RNTester.a */,
265+
5F836A7C97EC1BA121BA5A2A /* libPods-RNTesterIntegrationTests.a */,
266+
11941849F77C552FDC3EED77 /* libPods-RNTesterUnitTests.a */,
267267
);
268268
name = Frameworks;
269269
sourceTree = "<group>";
@@ -692,6 +692,10 @@
692692
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
693693
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
694694
DEVELOPMENT_TEAM = "";
695+
GCC_PREPROCESSOR_DEFINITIONS = (
696+
"$(inherited)",
697+
"FB_SONARKIT_ENABLED=1",
698+
);
695699
HEADER_SEARCH_PATHS = (
696700
"$(inherited)",
697701
"\"${PODS_ROOT}/Headers/Public\"",
@@ -734,10 +738,6 @@
734738
"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)",
735739
);
736740
"LIBRARY_SEARCH_PATHS[arch=*]" = "$(inherited)";
737-
OTHER_CFLAGS = (
738-
"$(inherited)",
739-
"-DFB_SONARKIT_ENABLED=1",
740-
);
741741
OTHER_LDFLAGS = (
742742
"$(inherited)",
743743
"-ObjC",
@@ -799,10 +799,6 @@
799799
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
800800
"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)",
801801
);
802-
OTHER_CFLAGS = (
803-
"$(inherited)",
804-
"-DFB_SONARKIT_ENABLED=1",
805-
);
806802
OTHER_LDFLAGS = (
807803
"$(inherited)",
808804
"-ObjC",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"ReactCommon",
4343
"README.md",
4444
"rn-get-polyfills.js",
45-
"scripts/autolink-ios.rb",
45+
"scripts/react_native_pods.rb",
4646
"scripts/compose-source-maps.js",
4747
"scripts/ios-configure-glog.sh",
4848
"scripts/launchPackager.bat",

scripts/autolink-ios.rb scripts/react_native_pods.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def use_react_native! (options={})
5757
end
5858
end
5959

60-
def add_flipper_pods!
61-
version = '~> 0.30.0'
60+
def use_flipper!(version = '~> 0.30.2')
6261
pod 'FlipperKit', version, :configuration => 'Debug'
6362
pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug'
6463
pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug'
@@ -75,4 +74,4 @@ def flipper_post_install(installer)
7574
end
7675
end
7776
end
78-
end
77+
end

template/ios/Podfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
platform :ios, '10.0'
2-
require_relative '../node_modules/react-native/scripts/autolink-ios'
1+
require_relative '../node_modules/react-native/scripts/react_native_pods'
32
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
43

4+
platform :ios, '10.0'
5+
56
target 'HelloWorld' do
67
# Pods for HelloWorld
78
use_react_native!
@@ -17,7 +18,7 @@ target 'HelloWorld' do
1718
#
1819
# Note that if you have use_frameworks! enabled, Flipper will not work and
1920
# you should disable these next few lines.
20-
add_flipper_pods!
21+
use_flipper!
2122
post_install do |installer|
2223
flipper_post_install(installer)
2324
end

0 commit comments

Comments
 (0)