Skip to content

Commit 4a57918

Browse files
committed
Boost patch
1 parent ecf3620 commit 4a57918

File tree

4 files changed

+68
-29
lines changed

4 files changed

+68
-29
lines changed

.github/workflows/e2e-v2.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
strategy:
165165
fail-fast: false # keeps matrix running if one fails
166166
matrix:
167-
rn-version: ['0.69.12', '0.81.0']
167+
rn-version: ['0.71.11', '0.81.0']
168168
rn-architecture: ['legacy', 'new']
169169
platform: ['android', 'ios']
170170
build-type: ['production']
@@ -176,7 +176,7 @@ jobs:
176176
xcode-version: '16.2'
177177
runs-on: macos-14
178178
- platform: ios
179-
rn-version: '0.69.12'
179+
rn-version: '0.71.11'
180180
xcode-version: '14.2'
181181
runs-on: macos-13
182182
- platform: android
@@ -185,14 +185,14 @@ jobs:
185185
# exclude JSC for new RN versions (keeping the matrix manageable)
186186
- rn-version: '0.81.0'
187187
engine: 'jsc'
188-
# exclude all rn versions lower than 0.70.0 for new architecture
189-
- rn-version: '0.69.12'
188+
# exclude all rn versions lower than 0.80.0 for new architecture
189+
- rn-version: '0.71.11'
190190
rn-architecture: 'new'
191191
# exlude old rn version for use frameworks builds (to minimalize the matrix)
192-
- rn-version: '0.69.12'
192+
- rn-version: '0.71.11'
193193
platform: 'ios'
194194
ios-use-frameworks: 'static'
195-
- rn-version: '0.69.12'
195+
- rn-version: '0.71.11'
196196
platform: 'ios'
197197
ios-use-frameworks: 'dynamic'
198198
# use frameworks is ios only feature
@@ -238,7 +238,7 @@ jobs:
238238

239239
- uses: actions/setup-java@v5
240240
with:
241-
java-version: ${{ matrix.rn-version == '0.69.12' && '11' || '17' }}
241+
java-version: '17'
242242
distribution: 'adopt'
243243

244244
- name: Gradle cache
@@ -258,15 +258,6 @@ jobs:
258258
- name: Setup Plain RN ${{ matrix.rn-version }} App
259259
run: ./dev-packages/e2e-tests/cli.mjs ${{ matrix.platform }} --create
260260

261-
# The old node has to be enabled after creating the test app
262-
# to avoid issues with the old node version
263-
- run: corepack disable
264-
- uses: actions/setup-node@v6
265-
if: ${{ matrix.rn-version == '0.69.12' }}
266-
with:
267-
package-manager-cache: false
268-
node-version: 16
269-
270261
- uses: ruby/setup-ruby@v1
271262
if: ${{ matrix.platform == 'ios' }}
272263
with:
@@ -304,7 +295,7 @@ jobs:
304295
strategy:
305296
fail-fast: false # keeps matrix running if one fails
306297
matrix:
307-
rn-version: ['0.69.12', '0.81.0']
298+
rn-version: ['0.71.11', '0.81.0']
308299
rn-architecture: ['legacy', 'new']
309300
platform: ['android', 'ios']
310301
build-type: ['production']
@@ -315,16 +306,16 @@ jobs:
315306
rn-version: '0.81.0'
316307
runs-on: macos-14
317308
- platform: ios
318-
rn-version: '0.69.12'
309+
rn-version: '0.71.11'
319310
runs-on: macos-14
320311
- platform: android
321312
runs-on: ubuntu-latest
322313
exclude:
323-
# exclude all rn versions lower than 0.70.0 for new architecture
324-
- rn-version: '0.69.12'
314+
# exclude all rn versions lower than 0.80.0 for new architecture
315+
- rn-version: '0.71.11'
325316
rn-architecture: 'new'
326317
# e2e test only the default combinations
327-
- rn-version: '0.69.12'
318+
- rn-version: '0.71.11'
328319
engine: 'hermes'
329320
- rn-version: '0.81.0'
330321
engine: 'jsc'

dev-packages/e2e-tests/cli.mjs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ const appSourceRepo = 'https://github.com/react-native-community/rn-diff-purge.g
6363
const appRepoDir = `${e2eDir}/react-native-versions/${RNVersion}`;
6464
const appName = 'RnDiffApp';
6565
const appDir = `${appRepoDir}/${appName}`;
66-
const testAppName = `${appName}.${platform == 'ios' ? 'app' : 'apk'}`;
66+
const testAppName = `${appName}.${platform === 'ios' ? 'app' : 'apk'}`;
6767
const testApp = `${e2eDir}/${testAppName}`;
6868
const appId = platform === 'ios' ? 'org.reactjs.native.example.RnDiffApp' : 'com.rndiffapp';
6969
const sentryAuthToken = env.SENTRY_AUTH_TOKEN;
7070

7171
function 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.
92109
if (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

235255
if (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) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const { argv } = require('process');
5+
6+
const parseArgs = require('minimist');
7+
const { debug } = require('@sentry/core');
8+
debug.enable();
9+
10+
const args = parseArgs(argv.slice(2));
11+
if (!args.podspec) {
12+
throw new Error('Missing --podspec');
13+
}
14+
15+
// The reason behind this patch is that the boost podspec is pointing to an archive with the wrong hashsum.
16+
// The official workaround is to patch the URL as described here:
17+
// https://github.com/facebook/react-native/issues/42180
18+
19+
debug.log('Patching Boost podspec: ', args.podspec);
20+
21+
let content = fs.readFileSync(args.podspec, 'utf8');
22+
content = content.replace(
23+
"https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2",
24+
"https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2"
25+
);
26+
fs.writeFileSync(args.podspec, content);
27+
28+
debug.log('Patched Boost podspec successfully!');
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)