Skip to content

Commit

Permalink
fix(ios/build): support passing target and device id to the module bu…
Browse files Browse the repository at this point in the history
…ild (#13808)

Co-authored-by: Chris Barber <chris@cb1inc.com>
  • Loading branch information
2 people authored and hansemannn committed Apr 24, 2023
1 parent 2df423c commit 3838f7a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
4 changes: 3 additions & 1 deletion iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,9 @@ iOSBuilder.prototype.configOptionWatchDeviceId = function configOptionWatchDevic
* error.
*/
iOSBuilder.prototype.initTiappSettings = function initTiappSettings() {
if (this._tiappSettingsInitialized) {
// This logic will also run on a module build when a --device-id argument is provided,
// so skip if we're not building an app.
if (this._tiappSettingsInitialized || this.cli.argv.type !== 'app') {
return;
}

Expand Down
31 changes: 20 additions & 11 deletions iphone/cli/commands/_buildModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ iOSModuleBuilder.prototype.validate = function validate(logger, config, cli) {

this.buildOnly = cli.argv['build-only'];
this.xcodeEnv = null;
this.target = cli.argv['target'];
this.deviceId = cli.argv['device-id'];

const sdkModuleAPIVersion = cli.sdk.manifest && cli.sdk.manifest.moduleAPIVersion && cli.sdk.manifest.moduleAPIVersion['iphone'];
if (this.manifest.apiversion && sdkModuleAPIVersion && this.manifest.apiversion !== sdkModuleAPIVersion) {
logger.error(__('The module manifest apiversion is currently set to %s', this.manifest.apiversion));
Expand Down Expand Up @@ -1078,17 +1081,23 @@ iOSModuleBuilder.prototype.runModule = function runModule(cli, next) {
function (cb) {
// 6. run the app
this.logger.debug(__('Running example project...', tmpDir.cyan));
runTiCommand(
[
'build',
'-p', 'ios',
'-d', tmpProjectDir,
'--no-prompt',
'--no-colors',
'--no-progress-bars'
],
cb
);
const buildArgs = [
'build',
'-p', 'ios',
'-d', tmpProjectDir,
'--no-prompt',
'--no-colors',
'--no-progress-bars'
];

if (this.target) {
buildArgs.push('-T', this.target);
}
if (this.deviceId) {
buildArgs.push('-C', this.deviceId);
}

runTiCommand(buildArgs, cb);
}
], next);
};
Expand Down

0 comments on commit 3838f7a

Please sign in to comment.