Skip to content

Commit 24b4e1d

Browse files
committed
Do not create empty .entitlements file
Fixes #3481
1 parent bf3969b commit 24b4e1d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/services/ios-entitlements-service.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ export class IOSEntitlementsService {
5656
makePatch(appEntitlementsPath);
5757
}
5858

59-
const plistContent = session.build();
60-
this.$logger.trace("App.entitlements: Write to: " + this.getPlatformsEntitlementsPath(projectData));
61-
this.$fs.writeFile(this.getPlatformsEntitlementsPath(projectData), plistContent);
62-
return;
59+
if ((<any>session).patches && (<any>session).patches.length > 0) {
60+
const plistContent = session.build();
61+
this.$logger.trace("App.entitlements: Write to: " + this.getPlatformsEntitlementsPath(projectData));
62+
this.$fs.writeFile(this.getPlatformsEntitlementsPath(projectData), plistContent);
63+
}
6364
}
6465

6566
private getAllInstalledPlugins(projectData: IProjectData): Promise<IPluginData[]> {

lib/services/ios-project-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
12411241

12421242
// Set Entitlements Property to point to default file if not set explicitly by the user.
12431243
const entitlementsPropertyValue = this.$xCConfigService.readPropertyValue(pluginsXcconfigFilePath, constants.CODE_SIGN_ENTITLEMENTS);
1244-
if (entitlementsPropertyValue === null) {
1244+
if (entitlementsPropertyValue === null && this.$fs.exists(this.$iOSEntitlementsService.getPlatformsEntitlementsPath(projectData))) {
12451245
temp.track();
12461246
const tempEntitlementsDir = temp.mkdirSync("entitlements");
12471247
const tempEntitlementsFilePath = path.join(tempEntitlementsDir, "set-entitlements.xcconfig");

test/ios-entitlements-service.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ describe("IOSEntitlements Service Tests", () => {
7676
});
7777

7878
describe("Merge", () => {
79-
const defaultPlistContent = `<?xml version="1.0" encoding="UTF-8"?>
80-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
81-
<plist version="1.0">
82-
<dict/>
83-
</plist>`;
8479
const defaultAppResourcesEntitlementsContent = `<?xml version="1.0" encoding="UTF-8"?>
8580
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
8681
<plist version="1.0">
@@ -123,13 +118,13 @@ describe("IOSEntitlements Service Tests", () => {
123118
assert.equal(strip(actual), strip(expected));
124119
}
125120

126-
it("Merge creates a default entitlements file.", async () => {
121+
it("Merge creates a merged entitlements file.", async () => {
127122
// act
128123
await iOSEntitlementsService.merge(projectData);
129124

130125
// assert
131126
const actual = fs.readText(destinationFilePath);
132-
assertContent(actual, defaultPlistContent);
127+
assertContent(actual, mergedEntitlementsContent);
133128
});
134129

135130
it("Merge uses the entitlements from App_Resources folder", async () => {

0 commit comments

Comments
 (0)