diff --git a/README.md b/README.md index 26fd604f..1f6cab6d 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,14 @@ For iOS: A string that is used to pick the device (from the `cordova run --list cordova-paramedic --platform ios --plugin cordova-plugin-contacts --target "iPhone-8" ``` +#### `--deploymentIosTarget` (optional) + +For iOS: if the plugin requires a minimum version of iOS. This parameter is going to add ``on the `config.xml`. + +``` +cordova-paramedic --platform ios --plugin cordova-plugin-contacts --target "iPhone-8" --deploymentIosTarget="10.0" +``` + ### Test Result Server diff --git a/lib/ParamedicApp.js b/lib/ParamedicApp.js index 887bb420..4c76cfdb 100644 --- a/lib/ParamedicApp.js +++ b/lib/ParamedicApp.js @@ -101,6 +101,7 @@ class ParamedicApp { return execPromise(this.config.getCli() + ' platform add ' + platform + utilities.PARAMEDIC_COMMON_CLI_ARGS + utilities.PARAMEDIC_PLATFORM_ADD_ARGS) .then(() => { logger.info('cordova-paramedic: successfully finished adding platform ' + platform); + if (this.isAndroid && this.config.isCI()) { logger.info('cordova-paramedic: monkey patching Android platform to disable gradle daemon...'); const gradleBuilderFile = path.join(this.tempFolder.name, 'platforms', 'android', 'cordova', 'lib', 'builders', 'GradleBuilder.js'); @@ -128,10 +129,20 @@ class ParamedicApp { this.runner.browserPatched = false; } } + } else if (this.isIos) { + this.setUpDeploymentIosTarget(); } }); } + setUpDeploymentIosTarget () { + const deploymentIosTarget = this.config.getDeploymentIosTarget(); + if (deploymentIosTarget) { + shell.sed('-i', '', `\\n\\t`, 'config.xml'); + logger.info(`cordova-paramedic: set up minimum deployment ios target ${deploymentIosTarget}`); + } + } + checkPlatformRequirements () { if (this.isBrowser) return Q(); diff --git a/lib/ParamedicConfig.js b/lib/ParamedicConfig.js index 474bed8a..e4544c0f 100644 --- a/lib/ParamedicConfig.js +++ b/lib/ParamedicConfig.js @@ -276,6 +276,14 @@ class ParamedicConfig { this._config.cli = cli; } + getDeploymentIosTarget () { + return this._config.deploymentIosTarget ? this._config.deploymentIosTarget : undefined; + } + + setDeploymentIosTarget (deploymentIosTarget) { + this._config.deploymentIosTarget = deploymentIosTarget; + } + getAll () { return this._config; } diff --git a/main.js b/main.js index 6d744068..e0628fba 100755 --- a/main.js +++ b/main.js @@ -66,6 +66,7 @@ var USAGE = "Error missing args. \n" + "--useTunnel: (optional) use tunneling instead of local address. default is false\n" + "--verbose : (optional) verbose mode. Display more information output\n" + "--version : (optional) prints cordova-paramedic version and exits\n" + + "--deploymentIosTarget: (optional) Adds a minimum ios deployment target on config.xml\n" + ""; var argv = parseArgs(process.argv.slice(2), { @@ -181,6 +182,10 @@ if (argv.version) { paramedicConfig.setArgs(argv.args); } + if (argv.deploymentIosTarget) { + paramedicConfig.setDeploymentIosTarget(argv.deploymentIosTarget); + } + paramedic.run(paramedicConfig) .catch(function (error) { if (error && error.stack) {