Skip to content

Commit 8169878

Browse files
Merge pull request #3913 from NativeScript/vladimirov/fix-xcode10-plugins-xcconfig
fix: build with Xcode 10 may fail for missing plugins...xcconfig file
2 parents 2abae5f + bfd5b3f commit 8169878

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

lib/services/ios-project-service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,13 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
13011301
await this.mergeXcconfigFiles(appResourcesXcconfigPath, pluginsXcconfigFilePath);
13021302
}
13031303

1304+
if (!this.$fs.exists(pluginsXcconfigFilePath)) {
1305+
// We need the pluginsXcconfig file to exist in platforms dir as it is required in the native template:
1306+
// https://github.com/NativeScript/ios-runtime/blob/9c2b7b5f70b9bee8452b7a24aa6b646214c7d2be/build/project-template/__PROJECT_NAME__/build-debug.xcconfig#L3
1307+
// From Xcode 10 in case the file is missing, this include fails and the build itself fails (was a warning in previous Xcode versions).
1308+
this.$fs.writeFile(pluginsXcconfigFilePath, "");
1309+
}
1310+
13041311
// Set Entitlements Property to point to default file if not set explicitly by the user.
13051312
const entitlementsPropertyValue = this.$xCConfigService.readPropertyValue(pluginsXcconfigFilePath, constants.CODE_SIGN_ENTITLEMENTS);
13061313
if (entitlementsPropertyValue === null && this.$fs.exists(this.$iOSEntitlementsService.getPlatformsEntitlementsPath(projectData))) {

test/ios-project-service.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,4 +1029,18 @@ describe("Merge Project XCConfig files", () => {
10291029
assertPropertyValues(expected, destinationFilePath, testInjector);
10301030
}
10311031
});
1032+
1033+
it("creates empty plugins-<config>.xcconfig in case there are no build.xcconfig in App_Resources and in plugins", async () => {
1034+
// run merge for all release: debug|release
1035+
for (const release in [true, false]) {
1036+
await (<any>iOSProjectService).mergeProjectXcconfigFiles(release, projectData);
1037+
1038+
const destinationFilePath = release ? (<any>iOSProjectService).getPluginsReleaseXcconfigFilePath(projectData)
1039+
: (<any>iOSProjectService).getPluginsDebugXcconfigFilePath(projectData);
1040+
1041+
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1042+
const content = fs.readFile(destinationFilePath).toString();
1043+
assert.equal(content, "");
1044+
}
1045+
});
10321046
});

0 commit comments

Comments
 (0)