mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add function to sign XCFramework (#49863)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49863 After the creation of the XCFramework, that needs to be signed. After the XCFramework is signed, no further modification can happen or they would break the signature. ## Changelog: [Internal] - Add function to sign the XCFramework Reviewed By: cortinico Differential Revision: D70697279 fbshipit-source-id: c2411ca7d12d4679ba55f124cbb445367b15945a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c08e16afee
commit
e23d7106d5
@@ -75,6 +75,12 @@ const cli = yargs
|
||||
default: 'Debug',
|
||||
describe: 'Specify the configuration to build, Release or Debug (default).',
|
||||
})
|
||||
.option('identity', {
|
||||
alias: 'i',
|
||||
type: 'string',
|
||||
describe:
|
||||
'Specify the code signing identity to use for signing the frameworks.',
|
||||
})
|
||||
.help();
|
||||
|
||||
/**
|
||||
@@ -90,6 +96,7 @@ async function getCLIConfiguration() /*: Promise<?{|
|
||||
destinations: $ReadOnlyArray<Destination>,
|
||||
dependencies: $ReadOnlyArray<Dependency>,
|
||||
configuration: string,
|
||||
identity: ?string,
|
||||
|}> */ {
|
||||
// Run input parsing
|
||||
const argv = await cli.argv;
|
||||
@@ -139,6 +146,7 @@ async function getCLIConfiguration() /*: Promise<?{|
|
||||
destinations: resolvedPlatforms,
|
||||
dependencies: resolvedDependencies,
|
||||
configuration: argv.configuration,
|
||||
identity: argv.identity,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ async function createFramework(
|
||||
dependencies /*: $ReadOnlyArray<Dependency> */,
|
||||
rootFolder /*: string */,
|
||||
buildFolder /*: string */,
|
||||
identity /*: ?string */,
|
||||
) {
|
||||
console.log('✅ Composing iOS XCFramework...');
|
||||
|
||||
@@ -71,6 +72,10 @@ async function createFramework(
|
||||
const symbolOutput = path.join(rootFolder, 'Symbols');
|
||||
fs.mkdirSync(symbolOutput, {recursive: true});
|
||||
symbolPaths.forEach(symbol => execSync(`cp -r ${symbol} ${symbolOutput}`));
|
||||
|
||||
if (identity) {
|
||||
signXCFramework(identity, output);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,4 +136,13 @@ function copyBundles(
|
||||
});
|
||||
}
|
||||
|
||||
function signXCFramework(
|
||||
identity /*: string */,
|
||||
xcframeworkPath /*: string */,
|
||||
) {
|
||||
console.log('Signing XCFramework...');
|
||||
const command = `codesign --timestamp --sign "${identity}" ${xcframeworkPath}`;
|
||||
execSync(command, {stdio: 'inherit'});
|
||||
}
|
||||
|
||||
module.exports = {createFramework};
|
||||
|
||||
@@ -65,6 +65,7 @@ async function main() {
|
||||
cli.dependencies,
|
||||
rootFolder,
|
||||
buildFolder,
|
||||
cli.identity,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user