Skip to content

fix: build with Xcode 10 may fail for missing plugins...xcconfig file #3913

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

Merged
merged 1 commit into from
Sep 20, 2018
Merged
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
2 changes: 1 addition & 1 deletion lib/common
7 changes: 7 additions & 0 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,13 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
await this.mergeXcconfigFiles(appResourcesXcconfigPath, pluginsXcconfigFilePath);
}

if (!this.$fs.exists(pluginsXcconfigFilePath)) {
// We need the pluginsXcconfig file to exist in platforms dir as it is required in the native template:
// https://github.com/NativeScript/ios-runtime/blob/9c2b7b5f70b9bee8452b7a24aa6b646214c7d2be/build/project-template/__PROJECT_NAME__/build-debug.xcconfig#L3
// From Xcode 10 in case the file is missing, this include fails and the build itself fails (was a warning in previous Xcode versions).
this.$fs.writeFile(pluginsXcconfigFilePath, "");
}

// Set Entitlements Property to point to default file if not set explicitly by the user.
const entitlementsPropertyValue = this.$xCConfigService.readPropertyValue(pluginsXcconfigFilePath, constants.CODE_SIGN_ENTITLEMENTS);
if (entitlementsPropertyValue === null && this.$fs.exists(this.$iOSEntitlementsService.getPlatformsEntitlementsPath(projectData))) {
Expand Down
14 changes: 14 additions & 0 deletions test/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,4 +1029,18 @@ describe("Merge Project XCConfig files", () => {
assertPropertyValues(expected, destinationFilePath, testInjector);
}
});

it("creates empty plugins-<config>.xcconfig in case there are no build.xcconfig in App_Resources and in plugins", async () => {
// run merge for all release: debug|release
for (const release in [true, false]) {
await (<any>iOSProjectService).mergeProjectXcconfigFiles(release, projectData);

const destinationFilePath = release ? (<any>iOSProjectService).getPluginsReleaseXcconfigFilePath(projectData)
: (<any>iOSProjectService).getPluginsDebugXcconfigFilePath(projectData);

assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
const content = fs.readFile(destinationFilePath).toString();
assert.equal(content, "");
}
});
});