diff --git a/packages/react-native/scripts/ios-prebuild.js b/packages/react-native/scripts/ios-prebuild.js index 0e71fea00d8..1c7319ba7ed 100644 --- a/packages/react-native/scripts/ios-prebuild.js +++ b/packages/react-native/scripts/ios-prebuild.js @@ -71,7 +71,13 @@ async function main() { if (cli.tasks.compose) { const productsFolder = computeProductsFolder(outputFolder); const frameworkPaths = computeFrameworkPaths(productsFolder); - buildXCFrameworks(root, buildFolder, frameworkPaths, buildType); + buildXCFrameworks( + root, + buildFolder, + frameworkPaths, + buildType, + cli.identity, + ); } // Done! diff --git a/packages/react-native/scripts/ios-prebuild/xcframework.js b/packages/react-native/scripts/ios-prebuild/xcframework.js index c2740a1ae2e..ffecf7a74e2 100644 --- a/packages/react-native/scripts/ios-prebuild/xcframework.js +++ b/packages/react-native/scripts/ios-prebuild/xcframework.js @@ -138,6 +138,10 @@ function buildXCFrameworks( fs.mkdirSync(outputFolder, {recursive: true}); execSync(`cp -r ${symbol} ${outputFolder}`); }); + + if (identity) { + signXCFramework(identity, outputPath); + } } function copyHeaderFiles( @@ -353,6 +357,16 @@ function extractDestinationFromPath(symbolPath /*: string */) /*: string */ { `Impossible to extract destination from ${symbolPath}. Valid destinations are iphoneos, iphonesimulator and catalyst.`, ); } + +function signXCFramework( + identity /*: string */, + xcframeworkPath /*: string */, +) { + console.log('Signing XCFramework...'); + const command = `codesign --timestamp --sign "${identity}" ${xcframeworkPath}`; + execSync(command, {stdio: 'inherit'}); +} + module.exports = { buildXCFrameworks, };