Skip to content

Commit

Permalink
Merge pull request #4319 from wix/fix/revert-patch
Browse files Browse the repository at this point in the history
chore(iOS): revert boost.podspec patch from #4317.
  • Loading branch information
asafkorem authored Jan 2, 2024
2 parents bab6a56 + 0d24b88 commit e293d15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 58 deletions.
32 changes: 3 additions & 29 deletions detox/test/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
const fs = require('fs-extra');
const path = require('path');
const cp = require('child_process');

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://sourceforge.net/projects/boost/files/boost/1.76.0/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 podInstallIfRequired() {
if (process.platform === 'darwin' && !process.env.DETOX_DISABLE_POD_INSTALL) {
console.log('[POST-INSTALL] Running pod install...');
patchBoostPodspec();
console.log('[POST-INSTALL] Running test-app pod install...');

cp.execSync('pod install', {
cwd: `${process.cwd()}/ios`,
stdio: 'inherit'
});

console.log('[POST-INSTALL] test-app pod install completed')
}
}

console.log('[POST-INSTALL] Running Detox\'s test-app post-install script...');
podInstallIfRequired();
console.log('[POST-INSTALL] Completed!');
32 changes: 3 additions & 29 deletions examples/demo-react-native/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
const fs = require('fs-extra');
const path = require('path');
const cp = require('child_process');

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://sourceforge.net/projects/boost/files/boost/1.76.0/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 podInstallIfRequired() {
if (process.platform === 'darwin' && !process.env.DETOX_DISABLE_POD_INSTALL) {
console.log('[POST-INSTALL] Running pod install...');
patchBoostPodspec();
console.log('[POST-INSTALL] Running example-app pod install...');

cp.execSync('pod install', {
cwd: `${process.cwd()}/ios`,
stdio: 'inherit'
});

console.log('[POST-INSTALL] example-app pod install completed')
}
}

console.log('[POST-INSTALL] Running Detox\'s example-app post-install script...');
podInstallIfRequired();
console.log('[POST-INSTALL] Completed!');

0 comments on commit e293d15

Please sign in to comment.