in lib/build.js [331:423]
function getXcodeBuildArgs (projectPath, configuration, emulatorTarget, buildConfig = {}) {
let options;
let buildActions;
let settings;
const buildFlags = buildConfig.buildFlag;
const customArgs = {};
customArgs.otherFlags = [];
if (buildFlags) {
if (typeof buildFlags === 'string' || buildFlags instanceof String) {
parseBuildFlag(buildFlags, customArgs);
} else { // buildFlags is an Array of strings
buildFlags.forEach(flag => {
parseBuildFlag(flag, customArgs);
});
}
}
if (buildConfig.device && !buildConfig.catalyst) {
options = [
'-workspace', customArgs.workspace || 'App.xcworkspace',
'-scheme', customArgs.scheme || 'App',
'-configuration', customArgs.configuration || configuration,
'-destination', customArgs.destination || 'generic/platform=iOS',
'-archivePath', customArgs.archivePath || 'App.xcarchive'
];
buildActions = ['archive'];
settings = [];
if (customArgs.configuration_build_dir) {
settings.push(customArgs.configuration_build_dir);
}
if (customArgs.shared_precomps_dir) {
settings.push(customArgs.shared_precomps_dir);
}
// Add other matched flags to otherFlags to let xcodebuild present an appropriate error.
// This is preferable to just ignoring the flags that the user has passed in.
if (customArgs.sdk) {
customArgs.otherFlags = customArgs.otherFlags.concat(['-sdk', customArgs.sdk]);
}
if (buildConfig.automaticProvisioning) {
options.push('-allowProvisioningUpdates');
}
if (buildConfig.authenticationKeyPath) {
options.push('-authenticationKeyPath', buildConfig.authenticationKeyPath);
}
if (buildConfig.authenticationKeyID) {
options.push('-authenticationKeyID', buildConfig.authenticationKeyID);
}
if (buildConfig.authenticationKeyIssuerID) {
options.push('-authenticationKeyIssuerID', buildConfig.authenticationKeyIssuerID);
}
} else { // emulator
options = [
'-workspace', customArgs.workspace || 'App.xcworkspace',
'-scheme', customArgs.scheme || 'App',
'-configuration', customArgs.configuration || configuration
];
if (buildConfig.catalyst) {
options = options.concat([
'-destination', customArgs.destination || 'generic/platform=macOS,variant=Mac Catalyst'
]);
} else {
options = options.concat([
'-sdk', customArgs.sdk || 'iphonesimulator',
'-destination', customArgs.destination || `platform=iOS Simulator,name=${emulatorTarget}`
]);
}
buildActions = ['build'];
settings = [];
if (customArgs.configuration_build_dir) {
settings.push(customArgs.configuration_build_dir);
}
if (customArgs.shared_precomps_dir) {
settings.push(customArgs.shared_precomps_dir);
}
// Add other matched flags to otherFlags to let xcodebuild present an appropriate error.
// This is preferable to just ignoring the flags that the user has passed in.
if (customArgs.archivePath) {
customArgs.otherFlags = customArgs.otherFlags.concat(['-archivePath', customArgs.archivePath]);
}
}
return options.concat(buildActions).concat(settings).concat(customArgs.otherFlags);
}