Skip to content

Commit 646f7a7

Browse files
author
Fatme
authored
Merge pull request #4577 from NativeScript/fatme/merge-release-5.3.4
chore: merge release into master
2 parents 873d82b + 77f4947 commit 646f7a7

6 files changed

+100
-63
lines changed

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
NativeScript CLI Changelog
22
================
33

4+
5.3.4 (2019, April 24)
5+
==
6+
7+
### Fixed
8+
* [Fixed #4561](https://github.com/NativeScript/nativescript-cli/issues/4561): CLI merges xcconfig files only for specified build configuration
9+
10+
5.3.3 (2019, April 23)
11+
==
12+
13+
### Fixed
14+
* [Fixed #4527](https://github.com/NativeScript/nativescript-cli/issues/4527): Unable to upload applications to App Store
15+
416
5.3.2 (2019, April 12)
517
==
618

@@ -10,6 +22,17 @@ NativeScript CLI Changelog
1022
* [Fixed #4504](https://github.com/NativeScript/nativescript-cli/issues/4504): Custom tagged versions of android runtime are not supported
1123
* [Fixed #4510](https://github.com/NativeScript/nativescript-cli/pull/4510): Handle HTTP 304 response status code
1224

25+
5.3.1 (2019, April 03)
26+
==
27+
28+
### Implemented
29+
* [Implemented #4492](https://github.com/NativeScript/nativescript-cli/pull/4492): API(kinvey): provide correct data to preview-sdk based on the schema
30+
31+
### Fixed
32+
* [Fixed #4370](https://github.com/NativeScript/nativescript-cli/issues/4370): NativeScript CLI installation fails on linux
33+
* [Fixed #4451](https://github.com/NativeScript/nativescript-cli/issues/4451): Error while trying to start application on Android emulator with API level Q
34+
* [Fixed #4483](https://github.com/NativeScript/nativescript-cli/pull/4483): Detection fixes for emulator/device
35+
1336
5.3.0 (2019, March 27)
1437
==
1538

lib/declarations.d.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -893,12 +893,11 @@ interface IXcprojInfo {
893893

894894
interface IXcconfigService {
895895
/**
896-
* Returns the path to the xcconfig file
896+
* Returns the paths to the xcconfig files for build configuration (debug/release)
897897
* @param projectRoot The path to root folder of native project (platforms/ios)
898-
* @param opts
899-
* @returns {string}
898+
* @returns {IStringDictionary}
900899
*/
901-
getPluginsXcconfigFilePath(projectRoot: string, opts: IRelease): string;
900+
getPluginsXcconfigFilePaths(projectRoot: string): IStringDictionary;
902901

903902
/**
904903
* Returns the value of a property from a xcconfig file.

lib/services/cocoapods-service.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@ export class CocoaPodsService implements ICocoaPodsService {
5555
return podInstallResult;
5656
}
5757

58-
public async mergePodXcconfigFile(projectData: IProjectData, platformData: IPlatformData, opts: IRelease) {
58+
public async mergePodXcconfigFile(projectData: IProjectData, platformData: IPlatformData): Promise<void> {
5959
const podFilesRootDirName = path.join("Pods", "Target Support Files", `Pods-${projectData.projectName}`);
6060
const podFolder = path.join(platformData.projectRoot, podFilesRootDirName);
6161
if (this.$fs.exists(podFolder)) {
62-
const podXcconfigFilePath = opts && opts.release ? path.join(podFolder, `Pods-${projectData.projectName}.release.xcconfig`)
63-
: path.join(podFolder, `Pods-${projectData.projectName}.debug.xcconfig`);
64-
const pluginsXcconfigFilePath = this.$xcconfigService.getPluginsXcconfigFilePath(platformData.projectRoot, opts);
65-
await this.$xcconfigService.mergeFiles(podXcconfigFilePath, pluginsXcconfigFilePath);
62+
const pluginsXcconfigFilePaths = this.$xcconfigService.getPluginsXcconfigFilePaths(platformData.projectRoot);
63+
for (const configuration in pluginsXcconfigFilePaths) {
64+
const pluginsXcconfigFilePath = pluginsXcconfigFilePaths[configuration];
65+
const podXcconfigFilePath = path.join(podFolder, `Pods-${projectData.projectName}.${configuration}.xcconfig`);
66+
await this.$xcconfigService.mergeFiles(podXcconfigFilePath, pluginsXcconfigFilePath);
67+
}
6668
}
6769
}
6870

lib/services/ios-project-service.ts

+32-21
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
810810
public async processConfigurationFilesFromAppResources(projectData: IProjectData, opts: IRelease): Promise<void> {
811811
await this.mergeInfoPlists(projectData, opts);
812812
await this.$iOSEntitlementsService.merge(projectData);
813-
await this.mergeProjectXcconfigFiles(projectData, opts);
813+
await this.mergeProjectXcconfigFiles(projectData);
814814
for (const pluginData of await this.getAllInstalledPlugins(projectData)) {
815815
await this.$pluginVariablesService.interpolatePluginVariables(pluginData, this.getPlatformData(projectData).configurationFilePath, projectData.projectDir);
816816
}
@@ -1227,43 +1227,54 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
12271227
this.$fs.writeFile(path.join(headersFolderPath, "module.modulemap"), modulemap);
12281228
}
12291229

1230-
private async mergeProjectXcconfigFiles(projectData: IProjectData, opts: IRelease): Promise<void> {
1230+
private async mergeProjectXcconfigFiles(projectData: IProjectData): Promise<void> {
12311231
const platformData = this.getPlatformData(projectData);
1232-
const pluginsXcconfigFilePath = this.$xcconfigService.getPluginsXcconfigFilePath(platformData.projectRoot, opts);
1233-
this.$fs.deleteFile(pluginsXcconfigFilePath);
1232+
const pluginsXcconfigFilePaths = _.values(this.$xcconfigService.getPluginsXcconfigFilePaths(platformData.projectRoot));
1233+
1234+
for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
1235+
this.$fs.deleteFile(pluginsXcconfigFilePath);
1236+
}
12341237

12351238
const pluginsService = <IPluginsService>this.$injector.resolve("pluginsService");
12361239
const allPlugins: IPluginData[] = await pluginsService.getAllInstalledPlugins(projectData);
12371240
for (const plugin of allPlugins) {
12381241
const pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
12391242
const pluginXcconfigFilePath = path.join(pluginPlatformsFolderPath, BUILD_XCCONFIG_FILE_NAME);
12401243
if (this.$fs.exists(pluginXcconfigFilePath)) {
1241-
await this.$xcconfigService.mergeFiles(pluginXcconfigFilePath, pluginsXcconfigFilePath);
1244+
for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
1245+
await this.$xcconfigService.mergeFiles(pluginXcconfigFilePath, pluginsXcconfigFilePath);
1246+
}
12421247
}
12431248
}
12441249

12451250
const appResourcesXcconfigPath = path.join(projectData.appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName, BUILD_XCCONFIG_FILE_NAME);
12461251
if (this.$fs.exists(appResourcesXcconfigPath)) {
1247-
await this.$xcconfigService.mergeFiles(appResourcesXcconfigPath, pluginsXcconfigFilePath);
1252+
for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
1253+
await this.$xcconfigService.mergeFiles(appResourcesXcconfigPath, pluginsXcconfigFilePath);
1254+
}
12481255
}
12491256

1250-
if (!this.$fs.exists(pluginsXcconfigFilePath)) {
1251-
// We need the pluginsXcconfig file to exist in platforms dir as it is required in the native template:
1252-
// https://github.com/NativeScript/ios-runtime/blob/9c2b7b5f70b9bee8452b7a24aa6b646214c7d2be/build/project-template/__PROJECT_NAME__/build-debug.xcconfig#L3
1253-
// From Xcode 10 in case the file is missing, this include fails and the build itself fails (was a warning in previous Xcode versions).
1254-
this.$fs.writeFile(pluginsXcconfigFilePath, "");
1257+
for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
1258+
if (!this.$fs.exists(pluginsXcconfigFilePath)) {
1259+
// We need the pluginsXcconfig file to exist in platforms dir as it is required in the native template:
1260+
// https://github.com/NativeScript/ios-runtime/blob/9c2b7b5f70b9bee8452b7a24aa6b646214c7d2be/build/project-template/__PROJECT_NAME__/build-debug.xcconfig#L3
1261+
// From Xcode 10 in case the file is missing, this include fails and the build itself fails (was a warning in previous Xcode versions).
1262+
this.$fs.writeFile(pluginsXcconfigFilePath, "");
1263+
}
12551264
}
12561265

1257-
// Set Entitlements Property to point to default file if not set explicitly by the user.
1258-
const entitlementsPropertyValue = this.$xcconfigService.readPropertyValue(pluginsXcconfigFilePath, constants.CODE_SIGN_ENTITLEMENTS);
1259-
if (entitlementsPropertyValue === null && this.$fs.exists(this.$iOSEntitlementsService.getPlatformsEntitlementsPath(projectData))) {
1260-
temp.track();
1261-
const tempEntitlementsDir = temp.mkdirSync("entitlements");
1262-
const tempEntitlementsFilePath = path.join(tempEntitlementsDir, "set-entitlements.xcconfig");
1263-
const entitlementsRelativePath = this.$iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData);
1264-
this.$fs.writeFile(tempEntitlementsFilePath, `CODE_SIGN_ENTITLEMENTS = ${entitlementsRelativePath}${EOL}`);
1265-
1266-
await this.$xcconfigService.mergeFiles(tempEntitlementsFilePath, pluginsXcconfigFilePath);
1266+
for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
1267+
// Set Entitlements Property to point to default file if not set explicitly by the user.
1268+
const entitlementsPropertyValue = this.$xcconfigService.readPropertyValue(pluginsXcconfigFilePath, constants.CODE_SIGN_ENTITLEMENTS);
1269+
if (entitlementsPropertyValue === null && this.$fs.exists(this.$iOSEntitlementsService.getPlatformsEntitlementsPath(projectData))) {
1270+
temp.track();
1271+
const tempEntitlementsDir = temp.mkdirSync("entitlements");
1272+
const tempEntitlementsFilePath = path.join(tempEntitlementsDir, "set-entitlements.xcconfig");
1273+
const entitlementsRelativePath = this.$iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData);
1274+
this.$fs.writeFile(tempEntitlementsFilePath, `CODE_SIGN_ENTITLEMENTS = ${entitlementsRelativePath}${EOL}`);
1275+
1276+
await this.$xcconfigService.mergeFiles(tempEntitlementsFilePath, pluginsXcconfigFilePath);
1277+
}
12671278
}
12681279
}
12691280

lib/services/xcconfig-service.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import * as path from "path";
2+
import { Configurations } from "../common/constants";
23

34
export class XcconfigService implements IXcconfigService {
45
constructor(
56
private $childProcess: IChildProcess,
67
private $fs: IFileSystem,
78
private $xcprojService: IXcprojService) { }
89

9-
public getPluginsXcconfigFilePath(projectRoot: string, opts: IRelease): string {
10-
if (opts && opts.release) {
11-
return this.getPluginsReleaseXcconfigFilePath(projectRoot);
12-
}
13-
14-
return this.getPluginsDebugXcconfigFilePath(projectRoot);
10+
public getPluginsXcconfigFilePaths(projectRoot: string): IStringDictionary {
11+
return {
12+
[Configurations.Debug.toLowerCase()]: this.getPluginsDebugXcconfigFilePath(projectRoot),
13+
[Configurations.Release.toLowerCase()]: this.getPluginsReleaseXcconfigFilePath(projectRoot)
14+
};
1515
}
1616

1717
private getPluginsDebugXcconfigFilePath(projectRoot: string): string {

test/ios-project-service.ts

+29-27
Original file line numberDiff line numberDiff line change
@@ -1176,17 +1176,19 @@ describe("Merge Project XCConfig files", () => {
11761176

11771177
// run merge for all release: debug|release
11781178
for (const release in [true, false]) {
1179-
await (<any>iOSProjectService).mergeProjectXcconfigFiles(projectData, { release });
1179+
await (<any>iOSProjectService).mergeProjectXcconfigFiles(projectData);
11801180

1181-
const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release });
1181+
const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot);
11821182

1183-
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1184-
const expected = {
1185-
'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon',
1186-
'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage',
1187-
'CODE_SIGN_IDENTITY': 'iPhone Distribution'
1188-
};
1189-
assertPropertyValues(expected, destinationFilePath, testInjector);
1183+
_.each(destinationFilePaths, destinationFilePath => {
1184+
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1185+
const expected = {
1186+
'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon',
1187+
'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage',
1188+
'CODE_SIGN_IDENTITY': 'iPhone Distribution'
1189+
};
1190+
assertPropertyValues(expected, destinationFilePath, testInjector);
1191+
});
11901192
}
11911193
});
11921194

@@ -1204,13 +1206,15 @@ describe("Merge Project XCConfig files", () => {
12041206

12051207
await (<any>iOSProjectService).mergeProjectXcconfigFiles(projectData, { release });
12061208

1207-
const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release });
1209+
const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot);
12081210

1209-
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1210-
const expected = {
1211-
'CODE_SIGN_ENTITLEMENTS': iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData)
1212-
};
1213-
assertPropertyValues(expected, destinationFilePath, testInjector);
1211+
_.each(destinationFilePaths, destinationFilePath => {
1212+
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1213+
const expected = {
1214+
'CODE_SIGN_ENTITLEMENTS': iOSEntitlementsService.getPlatformsEntitlementsRelativePath(projectData)
1215+
};
1216+
assertPropertyValues(expected, destinationFilePath, testInjector);
1217+
});
12141218
}
12151219
});
12161220

@@ -1220,34 +1224,32 @@ describe("Merge Project XCConfig files", () => {
12201224
const xcconfigEntitlements = appResourceXCConfigContent + `${EOL}CODE_SIGN_ENTITLEMENTS = ${expectedEntitlementsFile}`;
12211225
fs.writeFile(appResourcesXcconfigPath, xcconfigEntitlements);
12221226

1223-
// run merge for all release: debug|release
1224-
for (const release in [true, false]) {
1225-
await (<any>iOSProjectService).mergeProjectXcconfigFiles(projectData, { release });
1227+
await (<any>iOSProjectService).mergeProjectXcconfigFiles(projectData);
12261228

1227-
const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release });
1229+
const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot);
12281230

1229-
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1231+
_.each(destinationFilePaths, destinationFilePath => {
1232+
assert.isTrue(fs.exists(destinationFilePath), `Target build xcconfig ${destinationFilePath} is missing.`);
12301233
const expected = {
12311234
'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon',
12321235
'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME': 'LaunchImage',
12331236
'CODE_SIGN_IDENTITY': 'iPhone Distribution',
12341237
'CODE_SIGN_ENTITLEMENTS': expectedEntitlementsFile
12351238
};
12361239
assertPropertyValues(expected, destinationFilePath, testInjector);
1237-
}
1240+
});
12381241
});
12391242

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

1245-
const destinationFilePath = xcconfigService.getPluginsXcconfigFilePath(projectRoot, { release: !!release });
1246+
const destinationFilePaths = xcconfigService.getPluginsXcconfigFilePaths(projectRoot);
12461247

1247-
assert.isTrue(fs.exists(destinationFilePath), 'Target build xcconfig is missing for release: ' + release);
1248+
_.each(destinationFilePaths, destinationFilePath => {
1249+
assert.isTrue(fs.exists(destinationFilePath), `Target build xcconfig ${destinationFilePath} is missing.` );
12481250
const content = fs.readFile(destinationFilePath).toString();
12491251
assert.equal(content, "");
1250-
}
1252+
});
12511253
});
12521254
});
12531255

0 commit comments

Comments
 (0)