Skip to content

Commit 94ac262

Browse files
committed
Define identity from the device provisioning profile
1 parent 5462c26 commit 94ac262

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const tools = require('./lib/tools');
44
const config = require('./lib/config');
5+
const idprov = require('./lib/idprov');
56
const EventEmitter = require('events').EventEmitter;
67
const path = require('path');
78
const { execSync } = require('child_process');
@@ -123,11 +124,12 @@ class Applesign {
123124
async _pullMobileProvision () {
124125
if (this.config.deviceProvision === true) {
125126
this.config.mobileprovision = await this.getDeviceProvision();
126-
} else {
127-
this.config.mobileprovision = this.config.mobileprovisions[0];
128-
if (this.config.mobileprovisions.length > 1) {
129-
this.config.mobileprovisions.slice(1);
130-
}
127+
this.config.mobileprovisions = [this.config.mobileprovision];
128+
this.config.identity = idprov(this.config.mobileprovision);
129+
}
130+
this.config.mobileprovision = this.config.mobileprovisions[0];
131+
if (this.config.mobileprovisions.length > 1) {
132+
this.config.mobileprovisions.slice(1);
131133
}
132134
}
133135

@@ -453,8 +455,8 @@ class Applesign {
453455
let newEntitlements = (appId && teamId && this.config.entry)
454456
? defaultEntitlements(appId, teamId)
455457
: (this.config.entitlement)
456-
? fs.readFileSync(this.config.entitlement).toString()
457-
: plistBuild(entMacho).toString();
458+
? fs.readFileSync(this.config.entitlement).toString()
459+
: plistBuild(entMacho).toString();
458460
const ent = plist.parse(newEntitlements.trim());
459461
const shouldRenameGroups = !this.config.mobileprovision && !this.config.cloneEntitlements;
460462
if (shouldRenameGroups && ent['com.apple.security.application-groups']) {

lib/tools.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const path = require('path');
1010
const which = require('which');
1111
const rimraf = require('rimraf');
1212

13-
var use7zip = false;
14-
var useOpenSSL = false;
13+
let use7zip = false;
14+
let useOpenSSL = false;
1515

1616
const cmdSpec = {
1717
'7z': '/usr/local/bin/7z',
@@ -146,7 +146,7 @@ async function verifyCodesign (file, keychain, cb) {
146146
}
147147

148148
async function getMobileProvisionPlist (file) {
149-
var res;
149+
let res;
150150
if (file === undefined) {
151151
throw new Error('No mobile provisioning file available.');
152152
}

0 commit comments

Comments
 (0)