Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(playground): patch boost podspec on post-install. #7829

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"main": "lib/dist/src/index.js",
"typings": "lib/dist/src/index.d.ts",
"scripts": {
"postinstall": "node scripts/postinstall.js",
"build": "node ./scripts/build",
"watch": "node ./scripts/watch",
"xcode": "open playground/ios/playground.xcworkspace",
Expand Down
33 changes: 33 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const fs = require('fs');

const patchBoostPodspec = () => {
const log = message => console.log(`[POST-INSTALL] ${message}`);
const boostPodspecPath = `${process.cwd()}/node_modules/react-native/third-party-podspecs/boost.podspec`;
const originalUrl = 'https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2';
const patchedUrl = 'https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2';

if (!fs.existsSync(boostPodspecPath)) {
log('boost.podspec does not exist, skipping patch...');
return;
}

let boostPodspec = fs.readFileSync(boostPodspecPath, 'utf8');

if (!boostPodspec.includes(originalUrl)) {
log('boost.podspec is already patched or the URL is different, skipping patch...');
return;
}

log('Applying boost.podspec patch...');
boostPodspec = boostPodspec.replace(originalUrl, patchedUrl);
fs.writeFileSync(boostPodspecPath, boostPodspec, 'utf8');
};

function patchBoostPodspecIfNeeded() {
if (process.platform === 'darwin') {
console.log('[POST-INSTALL] Running boost.io podspec patch...');
patchBoostPodspec();
}
}

patchBoostPodspecIfNeeded();
Loading