mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
[Download and patch Glog dependency (#49336)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49336 This change adds the step to download the glog dependency and run the prepare_glog script that we have in the codebase ## Changelog: [Internal] - Download Glog and patch it. Reviewed By: cortinico Differential Revision: D69466238 fbshipit-source-id: df0b4e29d4ff7d0d61f92a52141935472fa964fe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9f23118716
commit
7db0abf61b
@@ -140,7 +140,10 @@ vendor/
|
||||
/packages/react-native/sdks/hermes
|
||||
/packages/react-native/sdks/hermesc
|
||||
/packages/react-native/sdks/hermes-engine/hermes-engine-from-local-source-dir.tar.gz
|
||||
|
||||
# iOS prebuilds
|
||||
/packages/react-native/third-party/
|
||||
fix_glog_0.3.5_apple_silicon.patch
|
||||
|
||||
# Visual Studio Code (config dir - if present, this merges user defined
|
||||
# workspace settings on top of react-native.code-workspace)
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
|
||||
require('../babel-register').registerForScript();
|
||||
|
||||
const {execSync} = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
|
||||
/*::
|
||||
@@ -20,14 +23,26 @@ type Dependency = $ReadOnly<{
|
||||
name: string,
|
||||
version: string,
|
||||
url: URL,
|
||||
prepareScript?: string,
|
||||
}>;
|
||||
*/
|
||||
|
||||
const dependencies /*: $ReadOnlyArray<Dependency> */ = [
|
||||
{
|
||||
name: 'glog',
|
||||
version: '0.3.5',
|
||||
url: new URL(
|
||||
'https://github.com/google/glog/archive/refs/tags/v0.3.5.tar.gz',
|
||||
),
|
||||
prepareScript: './packages/react-native/scripts/ios-configure-glog.sh',
|
||||
},
|
||||
];
|
||||
|
||||
async function downloadDependency(
|
||||
dependency /*: Dependency*/,
|
||||
) /*: Promise<void> */ {
|
||||
const {name, version, url} = dependency;
|
||||
const filename = `${name}-${version}.tgz`;
|
||||
const {name, url} = dependency;
|
||||
const filename = `${name}.tgz`;
|
||||
const archiveDestination = `/tmp/${filename}`;
|
||||
const command = `curl -L ${url.toString()} --output ${archiveDestination}`;
|
||||
|
||||
@@ -38,15 +53,27 @@ async function downloadDependency(
|
||||
fs.mkdirSync(destination, {recursive: true});
|
||||
|
||||
console.log(`Extracting ${filename} to ${destination}...`);
|
||||
await exec(`tar -xzf ${archiveDestination} -C ${destination}`);
|
||||
await exec(
|
||||
`tar -xzf ${archiveDestination} -C ${destination} --strip-components 1`,
|
||||
);
|
||||
|
||||
console.log(`Cleaning up ${filename}...`);
|
||||
await exec(`rm ${archiveDestination}`);
|
||||
|
||||
if (dependency.prepareScript) {
|
||||
const scriptPath = dependency.prepareScript;
|
||||
console.log(`Running ${scriptPath}...`);
|
||||
const finalPath = path.join(destination, 'prepare.sh');
|
||||
fs.copyFileSync(scriptPath, finalPath);
|
||||
execSync('./prepare.sh', {cwd: destination, stdio: 'inherit'});
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log('Starting iOS prebuilds preparation...');
|
||||
|
||||
await Promise.all(dependencies.map(downloadDependency));
|
||||
|
||||
console.log('Done!');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user