From bfd5b3fd7e760a138b768699f956d9156a1540db Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 19 Sep 2018 20:11:41 +0300 Subject: [PATCH] fix: build with Xcode 10 may fail for missing plugins...xcconfig file In the iOS Project template we have include for plugins-debug.xcconfig (or plugins-release.xcconfig when building in release mode). CLI should produce such file, but it does not do it when the project does not have build.xcconfig in its App_Resources and neither of the plugins have such file. With previous Xcode versions, this case was leading to warnings in the output, however they are errors now and the build fails. Fix this by adding an empty file in such case. --- lib/common | 2 +- lib/services/ios-project-service.ts | 7 +++++++ test/ios-project-service.ts | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/common b/lib/common index 0a906cdc0c..a53bd014d5 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 0a906cdc0ca944811229636db1715c429f0de9c6 +Subproject commit a53bd014d553ac1203362ea3bc1fe00861cf9548 diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 1e11cf10d2..ea36dcad89 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -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))) { diff --git a/test/ios-project-service.ts b/test/ios-project-service.ts index e65ffd51bb..9ff67d7c50 100644 --- a/test/ios-project-service.ts +++ b/test/ios-project-service.ts @@ -1029,4 +1029,18 @@ describe("Merge Project XCConfig files", () => { assertPropertyValues(expected, destinationFilePath, testInjector); } }); + + it("creates empty plugins-.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 (iOSProjectService).mergeProjectXcconfigFiles(release, projectData); + + const destinationFilePath = release ? (iOSProjectService).getPluginsReleaseXcconfigFilePath(projectData) + : (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, ""); + } + }); });