mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Integrate the cli script with the compose-xcframework task (#51850)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51850 This change refactors the last compose-xcframework step to intgrate with the cli.js script to coordinate the build process. ## Changelog: [Internal] - Reviewed By: cortinico Differential Revision: D76046443 fbshipit-source-id: 4740bb0869c688611a03d5085771aa6222132e7e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bd2855b056
commit
08f16eef67
+5
-3
@@ -68,9 +68,11 @@ async function main() {
|
||||
}
|
||||
|
||||
// GENERATE XCFrameworks
|
||||
const productsFolder = computeProductsFolder(outputFolder);
|
||||
const frameworkPaths = computeFrameworkPaths(productsFolder);
|
||||
buildXCFrameworks(root, buildFolder, frameworkPaths, buildType);
|
||||
if (cli.tasks.compose) {
|
||||
const productsFolder = computeProductsFolder(outputFolder);
|
||||
const frameworkPaths = computeFrameworkPaths(productsFolder);
|
||||
buildXCFrameworks(root, buildFolder, frameworkPaths, buildType);
|
||||
}
|
||||
|
||||
// Done!
|
||||
prebuildLog('🏁 Done!');
|
||||
|
||||
+19
-20
@@ -74,7 +74,7 @@ function buildXCFrameworks(
|
||||
buildFolder /*: string */,
|
||||
frameworkFolders /*: Array<string> */,
|
||||
buildType /*: 'debug' | 'release' */,
|
||||
) /*: Array<string> */ {
|
||||
) {
|
||||
const outputPath = path.join(
|
||||
buildFolder,
|
||||
'output',
|
||||
@@ -86,25 +86,26 @@ function buildXCFrameworks(
|
||||
cleanPlatformFolders(outputPath);
|
||||
|
||||
// Build the XCFrameworks by using each framework folder as input
|
||||
const frameworks = frameworkFolders.map(frameworkFolder => {
|
||||
const buildCommand = `xcodebuild -create-xcframework -framework "${frameworkFolder}" -output ${outputPath} -allow-internal-distribution`;
|
||||
frameworkLog(`Building ${frameworkFolder}...`);
|
||||
const frameworks = frameworkFolders
|
||||
.map(frameworkFolder => {
|
||||
return `-framework "${frameworkFolder}"`;
|
||||
})
|
||||
.join(' ');
|
||||
|
||||
frameworkLog(buildCommand);
|
||||
try {
|
||||
execSync(buildCommand, {
|
||||
cwd: rootFolder,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
} catch (error) {
|
||||
frameworkLog(
|
||||
`Error building XCFramework: ${error.message}. Check if the build was successful.`,
|
||||
'warning',
|
||||
);
|
||||
}
|
||||
const buildCommand = `xcodebuild -create-xcframework ${frameworks} -output ${outputPath} -allow-internal-distribution`;
|
||||
|
||||
return outputPath;
|
||||
});
|
||||
frameworkLog(buildCommand);
|
||||
try {
|
||||
execSync(buildCommand, {
|
||||
cwd: rootFolder,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
} catch (error) {
|
||||
frameworkLog(
|
||||
`Error building XCFramework: ${error.message}. Check if the build was successful.`,
|
||||
'warning',
|
||||
);
|
||||
}
|
||||
|
||||
// Copy header files from the headers folder that we used to build the swift package
|
||||
const outputHeaderFiles = copyHeaderFiles(
|
||||
@@ -121,8 +122,6 @@ function buildXCFrameworks(
|
||||
|
||||
// Create the module map file
|
||||
createModuleMapFile(outputPath, umbrellaHeaderFile);
|
||||
|
||||
return frameworks;
|
||||
}
|
||||
|
||||
function copyHeaderFiles(
|
||||
|
||||
Reference in New Issue
Block a user