@@ -63,14 +63,14 @@ const appSourceRepo = 'https://github.com/react-native-community/rn-diff-purge.g
6363const appRepoDir = `${ e2eDir } /react-native-versions/${ RNVersion } ` ;
6464const appName = 'RnDiffApp' ;
6565const appDir = `${ appRepoDir } /${ appName } ` ;
66- const testAppName = `${ appName } .${ platform == 'ios' ? 'app' : 'apk' } ` ;
66+ const testAppName = `${ appName } .${ platform === 'ios' ? 'app' : 'apk' } ` ;
6767const testApp = `${ e2eDir } /${ testAppName } ` ;
6868const appId = platform === 'ios' ? 'org.reactjs.native.example.RnDiffApp' : 'com.rndiffapp' ;
6969const sentryAuthToken = env . SENTRY_AUTH_TOKEN ;
7070
7171function runCodegenIfNeeded ( rnVersion , platform , appDir ) {
7272 const versionNumber = parseFloat ( rnVersion . replace ( / [ ^ \d . ] / g, '' ) ) ;
73- const shouldRunCodegen = platform === 'android' && versionNumber >= 0.79 ;
73+ const shouldRunCodegen = platform === 'android' && versionNumber >= 0.80 ;
7474
7575 if ( shouldRunCodegen ) {
7676 console . log ( `Running codegen for React Native ${ rnVersion } ...` ) ;
@@ -84,9 +84,26 @@ function runCodegenIfNeeded(rnVersion, platform, appDir) {
8484 } catch ( error ) {
8585 console . error ( 'Codegen failed:' , error . message ) ;
8686 }
87+ } else {
88+ console . log ( `Skipping codegen for React Native ${ rnVersion } ` ) ;
8789 }
8890}
8991
92+ function patchBoostIfNeeded ( rnVersion , patchScriptsDir ) {
93+ const versionNumber = parseFloat ( rnVersion . replace ( / [ ^ \d . ] / g, '' ) ) ;
94+ const shouldPatchBoost = platform === 'ios' && versionNumber <= 0.80 ;
95+
96+ if ( ! shouldPatchBoost ) {
97+ console . log ( `Skipping boost patch for React Native ${ rnVersion } ` ) ;
98+ return ;
99+ }
100+ execSync ( `${ patchScriptsDir } /rn.patch.boost.js --podspec node_modules/react-native/third-party-podspecs/boost.podspec` , {
101+ stdio : 'inherit' ,
102+ cwd : appDir ,
103+ env : env ,
104+ } ) ;
105+ }
106+
90107// Build and publish the SDK - we only need to do this once in CI.
91108// Locally, we may want to get updates from the latest build so do it on every app build.
92109if ( actions . includes ( 'create' ) || ( env . CI === undefined && actions . includes ( 'build' ) ) ) {
@@ -152,8 +169,11 @@ if (actions.includes('create')) {
152169 env : env ,
153170 } ) ;
154171
172+ // Patch boost
173+ patchBoostIfNeeded ( RNVersion , patchScriptsDir ) ;
174+
155175 // Set up platform-specific app configuration
156- if ( platform == 'ios' ) {
176+ if ( platform === 'ios' ) {
157177 execSync ( 'ruby --version' , { stdio : 'inherit' , cwd : `${ appDir } ` , env : env } ) ;
158178
159179 execSync ( `${ patchScriptsDir } /rn.patch.podfile.js --pod-file Podfile --engine ${ RNEngine } ` , {
@@ -174,7 +194,7 @@ if (actions.includes('create')) {
174194 `${ patchScriptsDir } /rn.patch.xcode.js --project ios/${ appName } .xcodeproj/project.pbxproj --rn-version ${ RNVersion } ` ,
175195 { stdio : 'inherit' , cwd : appDir , env : env } ,
176196 ) ;
177- } else if ( platform == 'android' ) {
197+ } else if ( platform === 'android' ) {
178198 execSync (
179199 `${ patchScriptsDir } //rn.patch.gradle.properties.js --gradle-properties android/gradle.properties --engine ${ RNEngine } ` ,
180200 { stdio : 'inherit' , cwd : appDir , env : env } ,
@@ -200,7 +220,7 @@ if (actions.includes('build')) {
200220 console . log ( `Building ${ platform } : ${ buildType } ` ) ;
201221 var appProduct ;
202222
203- if ( platform == 'ios' ) {
223+ if ( platform === 'ios' ) {
204224 // Build iOS test app
205225 execSync (
206226 `set -o pipefail && xcodebuild \
@@ -216,7 +236,7 @@ if (actions.includes('build')) {
216236 ) ;
217237
218238 appProduct = `${ appDir } /ios/DerivedData/Build/Products/${ buildType } -iphonesimulator/${ appName } .app` ;
219- } else if ( platform == 'android' ) {
239+ } else if ( platform === 'android' ) {
220240 runCodegenIfNeeded ( RNVersion , platform , appDir ) ;
221241
222242 execSync ( `./gradlew assemble${ buildType } -PreactNativeArchitectures=x86 --no-daemon` , {
@@ -234,15 +254,15 @@ if (actions.includes('build')) {
234254
235255if ( actions . includes ( 'test' ) ) {
236256 // Run e2e tests
237- if ( platform == 'ios' ) {
257+ if ( platform === 'ios' ) {
238258 try {
239259 execSync ( 'xcrun simctl list devices | grep -q "(Booted)"' ) ;
240260 } catch ( error ) {
241261 throw new Error ( 'No simulator is currently booted. Please boot a simulator before running this script.' ) ;
242262 }
243263
244264 execFileSync ( 'xcrun' , [ 'simctl' , 'install' , 'booted' , testApp ] ) ;
245- } else if ( platform == 'android' ) {
265+ } else if ( platform === 'android' ) {
246266 try {
247267 execSync ( 'adb devices | grep -q "emulator"' ) ;
248268 } catch ( error ) {
0 commit comments