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

Added build options for .ipa generate #14

Open
wants to merge 3 commits 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
35 changes: 33 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var cordova = cordovaLib.raw;

module.exports = function (options) {
options = options || {};
var device = options.device || true;
var release = options.release || false;

return through.obj(function (file, enc, cb) {
// Change the working directory
Expand All @@ -20,7 +22,9 @@ module.exports = function (options) {

cb();
}, function (cb) {
var exists = fs.existsSync(path.join(cordovaLib.findProjectRoot(), 'platforms', 'ios'));
var self = this;
var iosPath = path.join(cordovaLib.findProjectRoot(), 'platforms', 'ios');
var exists = fs.existsSync(iosPath);

Promise.resolve()
.then(function () {
Expand All @@ -36,10 +40,37 @@ module.exports = function (options) {
}
})
.then(function () {
var options = [];

if (device) {
options.push('--device');
}
if (release) {
options.push('--release');
}

// Build the platform
return cordova.build({platforms: ['ios']});
return cordova.build({platforms: ['ios'], options: options});
})
.then(function () {
var base = path.join(iosPath, 'build/device');
var cwd = process.env.PWD;

// Iterate over the output directory
fs.readdirSync(base).forEach(function (file) {
if (file.indexOf('.ipa') !== -1) {
var filePath = path.join(base, file);

// Push the file to the result set
self.push(new gutil.File({
base: base,
cwd: cwd,
path: filePath,
contents: fs.readFileSync(path.join(base, file))
}));
}
});

cb();
})
.catch(function (err) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"ios"
],
"dependencies": {
"cordova-lib": "6.2.0",
"cordova-lib": "7.1.0",
"gulp-util": "^3.0.4",
"pinkie-promise": "^2.0.0",
"through2": "^2.0.0"
Expand Down
37 changes: 35 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ gulp.task('build', () => {
.pipe(create())
.pipe(plugin('org.apache.cordova.dialogs'))
.pipe(plugin('org.apache.cordova.camera'))
.pipe(ios());
.pipe(ios())
.pipe('ios');
});
```

Expand All @@ -43,12 +44,44 @@ Default: `false`

If the value is `true`, this will cause the ios platform to be removed and re-added.

#### version
##### version

Type: `string`

iOS platform version.

##### device

Type: `boolean`<br>
Default: `true`

If the value is `true`, this will build .ipa file as result.

**You must provide build.json file in cordova project directory**

```json
{
"ios": {
"debug": {
"codeSignIdentitiy": "iPhone Developer",
"provisioningProfile": "your-dev-provisioning-profile-UUID-here"
},
"release": {
"codeSignIdentitiy": "iPhone Distribution",
"provisioningProfile": "your-distribution-provisioning-profile-UUID-her"
}
}
}
```
To get UUID execute in terminal - `/usr/libexec/PlistBuddy -c "Print UUID" /dev/stdin <<< $(security cms -D -i /path/to/file.mobileprovision)` or
open the .mobileprovision file on a text editor and search for 'UUID'.

##### release

Type: `boolean`<br>
Default: `false`

If the value is `true`, this will build .ipa and sign it with release certificates

## Related

Expand Down