diff --git a/CHANGELOG.md b/CHANGELOG.md index 83fcdccb7f..f386d37ae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ NativeScript CLI Changelog ================ +5.3.4 (2019, April 24) +== + +### Fixed +* [Fixed #4561](https://github.com/NativeScript/nativescript-cli/issues/4561): CLI merges xcconfig files only for specified build configuration + +5.3.3 (2019, April 23) +== + +### Fixed +* [Fixed #4527](https://github.com/NativeScript/nativescript-cli/issues/4527): Unable to upload applications to App Store + 5.3.2 (2019, April 12) == @@ -10,6 +22,17 @@ NativeScript CLI Changelog * [Fixed #4504](https://github.com/NativeScript/nativescript-cli/issues/4504): Custom tagged versions of android runtime are not supported * [Fixed #4510](https://github.com/NativeScript/nativescript-cli/pull/4510): Handle HTTP 304 response status code +5.3.1 (2019, April 03) +== + +### Implemented +* [Implemented #4492](https://github.com/NativeScript/nativescript-cli/pull/4492): API(kinvey): provide correct data to preview-sdk based on the schema + +### Fixed +* [Fixed #4370](https://github.com/NativeScript/nativescript-cli/issues/4370): NativeScript CLI installation fails on linux +* [Fixed #4451](https://github.com/NativeScript/nativescript-cli/issues/4451): Error while trying to start application on Android emulator with API level Q +* [Fixed #4483](https://github.com/NativeScript/nativescript-cli/pull/4483): Detection fixes for emulator/device + 5.3.0 (2019, March 27) == diff --git a/lib/declarations.d.ts b/lib/declarations.d.ts index dfaf0d258f..6c90ac8903 100644 --- a/lib/declarations.d.ts +++ b/lib/declarations.d.ts @@ -893,12 +893,11 @@ interface IXcprojInfo { interface IXcconfigService { /** - * Returns the path to the xcconfig file + * Returns the paths to the xcconfig files for build configuration (debug/release) * @param projectRoot The path to root folder of native project (platforms/ios) - * @param opts - * @returns {string} + * @returns {IStringDictionary} */ - getPluginsXcconfigFilePath(projectRoot: string, opts: IRelease): string; + getPluginsXcconfigFilePaths(projectRoot: string): IStringDictionary; /** * Returns the value of a property from a xcconfig file. diff --git a/lib/services/cocoapods-service.ts b/lib/services/cocoapods-service.ts index b25a7daa13..da08ec1252 100644 --- a/lib/services/cocoapods-service.ts +++ b/lib/services/cocoapods-service.ts @@ -55,14 +55,16 @@ export class CocoaPodsService implements ICocoaPodsService { return podInstallResult; } - public async mergePodXcconfigFile(projectData: IProjectData, platformData: IPlatformData, opts: IRelease) { + public async mergePodXcconfigFile(projectData: IProjectData, platformData: IPlatformData): Promise { const podFilesRootDirName = path.join("Pods", "Target Support Files", `Pods-${projectData.projectName}`); const podFolder = path.join(platformData.projectRoot, podFilesRootDirName); if (this.$fs.exists(podFolder)) { - const podXcconfigFilePath = opts && opts.release ? path.join(podFolder, `Pods-${projectData.projectName}.release.xcconfig`) - : path.join(podFolder, `Pods-${projectData.projectName}.debug.xcconfig`); - const pluginsXcconfigFilePath = this.$xcconfigService.getPluginsXcconfigFilePath(platformData.projectRoot, opts); - await this.$xcconfigService.mergeFiles(podXcconfigFilePath, pluginsXcconfigFilePath); + const pluginsXcconfigFilePaths = this.$xcconfigService.getPluginsXcconfigFilePaths(platformData.projectRoot); + for (const configuration in pluginsXcconfigFilePaths) { + const pluginsXcconfigFilePath = pluginsXcconfigFilePaths[configuration]; + const podXcconfigFilePath = path.join(podFolder, `Pods-${projectData.projectName}.${configuration}.xcconfig`); + await this.$xcconfigService.mergeFiles(podXcconfigFilePath, pluginsXcconfigFilePath); + } } } diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 3a68c26b91..6857f155da 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -810,7 +810,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f public async processConfigurationFilesFromAppResources(projectData: IProjectData, opts: IRelease): Promise { await this.mergeInfoPlists(projectData, opts); await this.$iOSEntitlementsService.merge(projectData); - await this.mergeProjectXcconfigFiles(projectData, opts); + await this.mergeProjectXcconfigFiles(projectData); for (const pluginData of await this.getAllInstalledPlugins(projectData)) { await this.$pluginVariablesService.interpolatePluginVariables(pluginData, this.getPlatformData(projectData).configurationFilePath, projectData.projectDir); } @@ -1227,10 +1227,13 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f this.$fs.writeFile(path.join(headersFolderPath, "module.modulemap"), modulemap); } - private async mergeProjectXcconfigFiles(projectData: IProjectData, opts: IRelease): Promise { + private async mergeProjectXcconfigFiles(projectData: IProjectData): Promise { const platformData = this.getPlatformData(projectData); - const pluginsXcconfigFilePath = this.$xcconfigService.getPluginsXcconfigFilePath(platformData.projectRoot, opts); - this.$fs.deleteFile(pluginsXcconfigFilePath); + const pluginsXcconfigFilePaths = _.values(this.$xcconfigService.getPluginsXcconfigFilePaths(platformData.projectRoot)); + + for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) { + this.$fs.deleteFile(pluginsXcconfigFilePath); + } const pluginsService = this.$injector.resolve("pluginsService"); const allPlugins: IPluginData[] = await pluginsService.getAllInstalledPlugins(projectData); @@ -1238,32 +1241,40 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f const pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME); const pluginXcconfigFilePath = path.join(pluginPlatformsFolderPath, BUILD_XCCONFIG_FILE_NAME); if (this.$fs.exists(pluginXcconfigFilePath)) { - await this.$xcconfigService.mergeFiles(pluginXcconfigFilePath, pluginsXcconfigFilePath); + for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) { + await this.$xcconfigService.mergeFiles(pluginXcconfigFilePath, pluginsXcconfigFilePath); + } } } const appResourcesXcconfigPath = path.join(projectData.appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName, BUILD_XCCONFIG_FILE_NAME); if (this.$fs.exists(appResourcesXcconfigPath)) { - await this.$xcconfigService.mergeFiles(appResourcesXcconfigPath, pluginsXcconfigFilePath); + for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) { + await this.$xcconfigService.mergeFiles(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, ""); + for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) { + 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))) { - temp.track(); - const tempEntitlementsDir = temp.mkdirSync("entitlements"); - const tempEntitlementsFilePath = path.join(tempEntitlementsDir, "set-entitlements.xcconfig"); - const entitlementsRelativePath = this.$iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData); - this.$fs.writeFile(tempEntitlementsFilePath, `CODE_SIGN_ENTITLEMENTS = ${entitlementsRelativePath}${EOL}`); - - await this.$xcconfigService.mergeFiles(tempEntitlementsFilePath, pluginsXcconfigFilePath); + for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) { + // 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))) { + temp.track(); + const tempEntitlementsDir = temp.mkdirSync("entitlements"); + const tempEntitlementsFilePath = path.join(tempEntitlementsDir, "set-entitlements.xcconfig"); + const entitlementsRelativePath = this.$iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData); + this.$fs.writeFile(tempEntitlementsFilePath, `CODE_SIGN_ENTITLEMENTS = ${entitlementsRelativePath}${EOL}`); + + await this.$xcconfigService.mergeFiles(tempEntitlementsFilePath, pluginsXcconfigFilePath); + } } } diff --git a/lib/services/xcconfig-service.ts b/lib/services/xcconfig-service.ts index 59a33353ec..896778536f 100644 --- a/lib/services/xcconfig-service.ts +++ b/lib/services/xcconfig-service.ts @@ -1,4 +1,5 @@ import * as path from "path"; +import { Configurations } from "../common/constants"; export class XcconfigService implements IXcconfigService { constructor( @@ -6,12 +7,11 @@ export class XcconfigService implements IXcconfigService { private $fs: IFileSystem, private $xcprojService: IXcprojService) { } - public getPluginsXcconfigFilePath(projectRoot: string, opts: IRelease): string { - if (opts && opts.release) { - return this.getPluginsReleaseXcconfigFilePath(projectRoot); - } - - return this.getPluginsDebugXcconfigFilePath(projectRoot); + public getPluginsXcconfigFilePaths(projectRoot: string): IStringDictionary { + return { + [Configurations.Debug.toLowerCase()]: this.getPluginsDebugXcconfigFilePath(projectRoot), + [Configurations.Release.toLowerCase()]: this.getPluginsReleaseXcconfigFilePath(projectRoot) + }; } private getPluginsDebugXcconfigFilePath(projectRoot: string): string { diff --git a/test/ios-project-service.ts b/test/ios-project-service.ts index d01f8df6c0..b419ff9e7a 100644 --- a/test/ios-project-service.ts +++ b/test/ios-project-service.ts @@ -1176,17 +1176,19 @@ describe("Merge Project XCConfig files", () => { // run merge for all release: debug|release for (const release in [true, false]) { - await (iOSProjectService).mergeProjectXcconfigFiles(projectData, { release }); + await (iOSProjectService).mergeProjectXcconfigFiles(projectData); - const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release }); + const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot); - assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release); - const expected = { - 'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon', - 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage', - 'CODE_SIGN_IDENTITY': 'iPhone Distribution' - }; - assertPropertyValues(expected, destinationFilePath, testInjector); + _.each(destinationFilePaths, destinationFilePath => { + assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release); + const expected = { + 'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon', + 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage', + 'CODE_SIGN_IDENTITY': 'iPhone Distribution' + }; + assertPropertyValues(expected, destinationFilePath, testInjector); + }); } }); @@ -1204,13 +1206,15 @@ describe("Merge Project XCConfig files", () => { await (iOSProjectService).mergeProjectXcconfigFiles(projectData, { release }); - const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release }); + const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot); - assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release); - const expected = { - 'CODE_SIGN_ENTITLEMENTS': iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData) - }; - assertPropertyValues(expected, destinationFilePath, testInjector); + _.each(destinationFilePaths, destinationFilePath => { + assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release); + const expected = { + 'CODE_SIGN_ENTITLEMENTS': iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData) + }; + assertPropertyValues(expected, destinationFilePath, testInjector); + }); } }); @@ -1220,13 +1224,12 @@ describe("Merge Project XCConfig files", () => { const xcconfigEntitlements = appResourceXCConfigContent + `${EOL}CODE_SIGN_ENTITLEMENTS = ${expectedEntitlementsFile}`; fs.writeFile(appResourcesXcconfigPath, xcconfigEntitlements); - // run merge for all release: debug|release - for (const release in [true, false]) { - await (iOSProjectService).mergeProjectXcconfigFiles(projectData, { release }); + await (iOSProjectService).mergeProjectXcconfigFiles(projectData); - const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release }); + const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot); - assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release); + _.each(destinationFilePaths, destinationFilePath => { + assert.isTrue(fs.exists(destinationFilePath), `Target build xcconfig ${destinationFilePath} is missing.`); const expected = { 'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon', 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage', @@ -1234,20 +1237,19 @@ describe("Merge Project XCConfig files", () => { 'CODE_SIGN_ENTITLEMENTS': expectedEntitlementsFile }; 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(projectData, { release }); + await (iOSProjectService).mergeProjectXcconfigFiles(projectData); - const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release }); + const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot); - assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release); + _.each(destinationFilePaths, destinationFilePath => { + assert.isTrue(fs.exists(destinationFilePath), `Target build xcconfig ${destinationFilePath} is missing.` ); const content = fs.readFile(destinationFilePath).toString(); assert.equal(content, ""); - } + }); }); });