Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new option deploymentIosTarget (ios) #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<preference name="deployment-target" value="${deploymentIosTarget}" />`on the `config.xml`.

```
cordova-paramedic --platform ios --plugin cordova-plugin-contacts --target "iPhone-8" --deploymentIosTarget="10.0"
```


### Test Result Server

Expand Down
11 changes: 11 additions & 0 deletions lib/ParamedicApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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', '<platform name="ios">', `<platform name="ios">\\n\\t<preference name="deployment-target" value="${deploymentIosTarget}" />`, 'config.xml');
logger.info(`cordova-paramedic: set up minimum deployment ios target ${deploymentIosTarget}`);
}
}

checkPlatformRequirements () {
if (this.isBrowser) return Q();

Expand Down
8 changes: 8 additions & 0 deletions lib/ParamedicConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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), {
Expand Down Expand Up @@ -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) {
Expand Down