Skip to content

Commit 9bdefab

Browse files
committed
feat: codesign extension targets
1 parent 23fcd2a commit 9bdefab

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

lib/services/ios-project-service.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
490490
}
491491

492492
xcode.setAutomaticSigningStyle(projectData.projectName, teamId);
493+
xcode.setAutomaticSigningStyleByTargetProductType("com.apple.product-type.app-extension", teamId);
493494
xcode.save();
494495

495496
this.$logger.trace(`Set Automatic signing style and team id ${teamId}.`);
@@ -524,13 +525,14 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
524525
if (!mobileprovision) {
525526
this.$errors.failWithoutHelp("Failed to find mobile provision with UUID or Name: " + provision);
526527
}
527-
528-
xcode.setManualSigningStyle(projectData.projectName, {
528+
const configuration = {
529529
team: mobileprovision.TeamIdentifier && mobileprovision.TeamIdentifier.length > 0 ? mobileprovision.TeamIdentifier[0] : undefined,
530530
uuid: mobileprovision.UUID,
531531
name: mobileprovision.Name,
532532
identity: mobileprovision.Type === "Development" ? "iPhone Developer" : "iPhone Distribution"
533-
});
533+
}
534+
xcode.setManualSigningStyle(projectData.projectName, configuration);
535+
xcode.setManualSigningStyleByTargetProductType("com.apple.product-type.app-extension", configuration);
534536
xcode.save();
535537

536538
// this.cache(uuid);
@@ -1107,6 +1109,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
11071109
}
11081110

11091111
private async prepareExtensionsCode(extensionsFolderPath: string, projectData: IProjectData): Promise<void> {
1112+
const targetUuids: string[] = [];
11101113
if(!this.$fs.exists(extensionsFolderPath)){
11111114
return;
11121115
}
@@ -1159,9 +1162,27 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
11591162
project.addPbxGroup(group.files, group.name, group.path, null, { isMain: true, target: target.uuid, filesRelativeToProject: true });
11601163
project.addBuildProperty("PRODUCT_BUNDLE_IDENTIFIER", `${projectData.projectIdentifiers.ios}.${extensionFolder}`, "Debug", extensionFolder);
11611164
project.addBuildProperty("PRODUCT_BUNDLE_IDENTIFIER", `${projectData.projectIdentifiers.ios}.${extensionFolder}`, "Release", extensionFolder);
1165+
targetUuids.push(target.uuid);
11621166
});
11631167

11641168
this.savePbxProj(project, projectData, true);
1169+
1170+
const xcode = this.$pbxprojDomXcode.Xcode.open(this.getPbxProjPath(projectData));
1171+
const signing = xcode.getSigning(projectData.projectName);
1172+
if(signing !== undefined) {
1173+
_.forEach(targetUuids, targetUuid => {
1174+
if(signing.style === "Automatic"){
1175+
xcode.setAutomaticSigningStyleByTargetKey(targetUuid, signing.team);
1176+
} else {
1177+
for(let config in signing.configurations) {
1178+
const signingConfiguration = signing.configurations[config];
1179+
xcode.setManualSigningStyleByTargetKey(targetUuid, signingConfiguration);
1180+
break;
1181+
}
1182+
}
1183+
})
1184+
}
1185+
xcode.save();
11651186
}
11661187

11671188
private getRootGroup(name: string, rootPath: string) {

0 commit comments

Comments
 (0)