Skip to content

Commit 10d8321

Browse files
Vasil ChimevVasil Chimev
authored andcommitted
Merge pull request #1100 from NativeScript/vladimirov/merge-1.4.3
Merge 1.4.3 in master
2 parents 0b42cc9 + 5df9bb6 commit 10d8321

14 files changed

+164
-160
lines changed

CHANGELOG.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
NativeScript CLI Changelog
22
================
33

4+
1.4.3 (2015, October 21)
5+
==
6+
7+
### New
8+
* [Implemented #883](https://github.com/NativeScript/nativescript-cli/issues/883): Support xcconfig file from plugin.
9+
* [Implemented #958](https://github.com/NativeScript/nativescript-cli/issues/958): Support for Node 4.2.1+.
10+
* [Implemented #1065](https://github.com/NativeScript/nativescript-cli/issues/1065): Support sandbox-pod.
11+
12+
### Fixed
13+
* [Fixed #1031](https://github.com/NativeScript/nativescript-cli/issues/1031): Command emulate android after LiveSync starts the last synced app on the emulator.
14+
* [Fixed #1044](https://github.com/NativeScript/nativescript-cli/issues/1044): iOS debug break on Simulator causes app crash when the debugger is paused on the first line for a long time.
15+
* [Fixed #1054](https://github.com/NativeScript/nativescript-cli/issues/1054): ENOENT error is thrown when `tns platform add ios` command is executed.
16+
* [Fixed #1066](https://github.com/NativeScript/nativescript-cli/issues/1066): Merge Info.plist fails second build.
17+
* [Fixed #1080](https://github.com/NativeScript/nativescript-cli/issues/1080): Using --symlink for android runtime is modifying the original one.
18+
19+
1.4.2 (2015, October 15)
20+
==
21+
22+
### Fixed
23+
* [Fixed #1041](https://github.com/NativeScript/nativescript-cli/issues/1041): Unable to run the application when project root directory is renamed.
24+
425
1.4.0 (2015, October 07)
526
==
627

@@ -74,7 +95,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK
7495

7596
* [Fixed #776](https://github.com/NativeScript/nativescript-cli/issues/776): `tns livesync ios --emulator --watch` doesn't sync changes.
7697
* [Fixed #777](https://github.com/NativeScript/nativescript-cli/issues/777): `tns library add ios` does not build correct relative paths to referenced frameworks for mdgenerator.
77-
* [Fixed #779](https://github.com/NativeScript/nativescript-cli/issues/779): Command failed due to space in library reference path.
98+
* [Fixed #779](https://github.com/NativeScript/nativescript-cli/issues/779): Command failed due to space in library reference path.
7899

79100
1.2.2 (2015, August 11)
80101
==
@@ -173,7 +194,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK
173194

174195
* [Implemented #510](https://github.com/NativeScript/nativescript-cli/issues/510): You can work with custom NativeScript plugins in your project. You can add a plugin from an npm package, a local folder, a URL or a `.tar.gz` file. For more information, run `$ tns help plugin`
175196
* [Implemented #362](https://github.com/NativeScript/nativescript-cli/issues/362): You can use npm as package manager for your NativeScript projects.
176-
197+
177198
### Updated
178199

179200
* [Updated #358](https://github.com/NativeScript/nativescript-cli/issues/358): Multiple improvements and bug fixes for iOS debugging.
@@ -197,7 +218,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK
197218

198219
### Fixed
199220

200-
* [Fixed #459](https://github.com/NativeScript/nativescript-cli/issues/459): You cannot add a third-party iOS native library to your project, if the path to the library contains spaces.
221+
* [Fixed #459](https://github.com/NativeScript/nativescript-cli/issues/459): You cannot add a third-party iOS native library to your project, if the path to the library contains spaces.
201222
* [Fixed #458](https://github.com/NativeScript/nativescript-cli/issues/458): If you have installed Xcode 6.2 or earlier on your system, you cannot debug in the iOS Simulator.
202223
* [Fixed #413](https://github.com/NativeScript/nativescript-cli/issues/413): If your project name contains a hyphen, the NativeScript CLI sets your application identifier inconsistently across the project.
203224

@@ -206,7 +227,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK
206227

207228
### New
208229

209-
* [Implemented #447](https://github.com/NativeScript/nativescript-cli/issues/447): `tns run ios`, `tns run android` and `tns emulate android` print the output of the running application in the console.
230+
* [Implemented #447](https://github.com/NativeScript/nativescript-cli/issues/447): `tns run ios`, `tns run android` and `tns emulate android` print the output of the running application in the console.
210231
* [Implemented #441](https://github.com/NativeScript/nativescript-cli/issues/441): Improved command-line completion.
211232
* [Implemented #416](https://github.com/NativeScript/nativescript-cli/issues/416): Improved installation.
212233
* [Implemented #358](https://github.com/NativeScript/nativescript-cli/issues/358): Improved `tns debug ios`.
@@ -250,7 +271,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK
250271
* [Fixed #257](https://github.com/NativeScript/nativescript-cli/issues/257): On bash consoles, you cannot pass arguments with spaces, even if escaped.
251272
* [Fixed #251](https://github.com/NativeScript/nativescript-cli/issues/251): On OS X systems, the command validation might not work properly.
252273
* [Fixed #248](https://github.com/NativeScript/nativescript-cli/issues/248): On OS X systems, the `tns deploy` command might not release the console.
253-
* [Fixed #169](https://github.com/NativeScript/nativescript-cli/issues/169): The native Xcode project is created with an incorrect name.
274+
* [Fixed #169](https://github.com/NativeScript/nativescript-cli/issues/169): The native Xcode project is created with an incorrect name.
254275

255276
0.9.4 (2015, March 18)
256277
==
@@ -272,7 +293,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK
272293
### New
273294

274295
* [Implemented #305](https://github.com/NativeScript/nativescript-cli/issues/305), [#322](https://github.com/NativeScript/nativescript-cli/issues/322): You can quickly add or update your platform runtime to a specific version by running `tns platform update platform@version`<br/>For example: `tns platform update [email protected]`<br/>The NativeScript team will publish experimental support for the latest versions of iOS and Android.<br/>To list all available versions for android, run $ npm view tns-android versions<br/>To list only experimental versions for android, run $ npm view tns-android dist-tags
275-
To list all available versions for ios, run $ npm view tns-ios versions<br/>To list only experimental versions for ios, run $ npm view tns-ios dist-tags
296+
To list all available versions for ios, run $ npm view tns-ios versions<br/>To list only experimental versions for ios, run $ npm view tns-ios dist-tags
276297
* [Implemented #302](https://github.com/NativeScript/nativescript-cli/issues/302): You can configure proxy settings for the NativeScript CLI.
277298

278299
### Fixed

lib/definitions/platform.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ interface IPlatformData {
3737
targetedOS?: string[];
3838
configurationFileName?: string;
3939
configurationFilePath?: string;
40+
relativeToFrameworkConfigurationFilePath: string;
4041
mergeXmlConfig?: any[];
4142
}
4243

lib/definitions/project.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ interface IPlatformProjectService {
3636
platformData: IPlatformData;
3737
validate(): IFuture<void>;
3838
createProject(frameworkDir: string, frameworkVersion: string): IFuture<void>;
39-
interpolateData(projectRoot: string): IFuture<void>;
39+
interpolateData(): IFuture<void>;
40+
interpolateConfigurationFile(configurationFilePath?: string): IFuture<void>;
4041
afterCreateProject(projectRoot: string): IFuture<void>;
4142
buildProject(projectRoot: string, buildConfig?: IBuildConfig): IFuture<void>;
4243
prepareProject(): IFuture<void>;

lib/npm-installation-manager.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class NpmInstallationManager implements INpmInstallationManager {
4343
public addToCache(packageName: string, version: string): IFuture<void> {
4444
return (() => {
4545
let cachedPackagePath = this.getCachedPackagePath(packageName, version);
46-
if(!this.$fs.exists(cachedPackagePath).wait()) {
46+
if(!this.$fs.exists(cachedPackagePath).wait() || !this.$fs.exists(path.join(cachedPackagePath, "framework")).wait()) {
4747
this.addToCacheCore(packageName, version).wait();
4848
}
4949

@@ -151,13 +151,16 @@ export class NpmInstallationManager implements INpmInstallationManager {
151151
private installCore(packageName: string, pathToSave: string, version: string): IFuture<string> {
152152
return (() => {
153153
if (this.$options.frameworkPath) {
154-
if (this.$fs.getFsStats(this.$options.frameworkPath).wait().isFile()) {
155-
this.npmInstall(packageName, pathToSave, version).wait();
156-
let pathToNodeModules = path.join(pathToSave, "node_modules");
157-
let folders = this.$fs.readDirectory(pathToNodeModules).wait();
158-
return path.join(pathToNodeModules, folders[0]);
154+
this.npmInstall(packageName, pathToSave, version).wait();
155+
let pathToNodeModules = path.join(pathToSave, "node_modules");
156+
let folders = this.$fs.readDirectory(pathToNodeModules).wait();
157+
158+
let data = this.$fs.readJson(path.join(pathToNodeModules, folders[0], "package.json")).wait();
159+
if(!this.isPackageUnpacked(this.getCachedPackagePath(data.name, data.version), data.name).wait()) {
160+
this.cacheUnpack(data.name, data.version).wait();
159161
}
160-
return this.$options.frameworkPath;
162+
163+
return path.join(pathToNodeModules, folders[0]);
161164
} else {
162165
version = version || this.getLatestCompatibleVersion(packageName).wait();
163166
let packagePath = this.getCachedPackagePath(packageName, version);

lib/services/android-project-service.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as semver from "semver";
88
import * as projectServiceBaseLib from "./platform-project-service-base";
99
import * as androidDebugBridgePath from "../common/mobile/android/android-debug-bridge";
1010

11-
class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
11+
export class AndroidProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
1212
private static VALUES_DIRNAME = "values";
1313
private static VALUES_VERSION_DIRNAME_PREFIX = AndroidProjectService.VALUES_DIRNAME + "-v";
1414
private static ANDROID_PLATFORM_NAME = "android";
@@ -57,6 +57,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
5757
frameworkFilesExtensions: [".jar", ".dat", ".so"],
5858
configurationFileName: "AndroidManifest.xml",
5959
configurationFilePath: path.join(projectRoot, "src", "main", "AndroidManifest.xml"),
60+
relativeToFrameworkConfigurationFilePath: path.join("src", "main", "AndroidManifest.xml"),
6061
mergeXmlConfig: [{ "nodename": "manifest", "attrname": "*" }, {"nodename": "application", "attrname": "*"}]
6162
};
6263
}
@@ -133,18 +134,24 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
133134
}).future<void>()();
134135
}
135136

136-
public interpolateData(projectRoot: string): IFuture<void> {
137+
public interpolateData(): IFuture<void> {
137138
return (() => {
138-
// Interpolate the activity name and package
139-
let manifestPath = this.platformData.configurationFilePath;
140-
shell.sed('-i', /__PACKAGE__/, this.$projectData.projectId, manifestPath);
139+
// Interpolate the apilevel and package
140+
this.interpolateConfigurationFile().wait();
141141

142142
let stringsFilePath = path.join(this.getAppResourcesDestinationDirectoryPath().wait(), 'values', 'strings.xml');
143143
shell.sed('-i', /__NAME__/, this.$projectData.projectName, stringsFilePath);
144144
shell.sed('-i', /__TITLE_ACTIVITY__/, this.$projectData.projectName, stringsFilePath);
145145

146146
let gradleSettingsFilePath = path.join(this.platformData.projectRoot, "settings.gradle");
147147
shell.sed('-i', /__PROJECT_NAME__/, this.getProjectNameFromId(), gradleSettingsFilePath);
148+
}).future<void>()();
149+
}
150+
151+
public interpolateConfigurationFile(): IFuture<void> {
152+
return (() => {
153+
let manifestPath = this.platformData.configurationFilePath;
154+
shell.sed('-i', /__PACKAGE__/, this.$projectData.projectId, manifestPath);
148155
shell.sed('-i', /__APILEVEL__/, this.$options.sdk || this.$androidToolsInfo.getToolsInfo().wait().compileSdkVersion.toString(), manifestPath);
149156
}).future<void>()();
150157
}

lib/services/ios-project-service.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
6161
targetedOS: ['darwin'],
6262
configurationFileName: "Info.plist",
6363
configurationFilePath: path.join(projectRoot, this.$projectData.projectName, this.$projectData.projectName+"-Info.plist"),
64+
relativeToFrameworkConfigurationFilePath: path.join("__PROJECT_NAME__", "__PROJECT_NAME__-Info.plist"),
6465
mergeXmlConfig: [{ "nodename": "plist", "attrname": "*" }, {"nodename": "dict", "attrname": "*"}]
6566
};
6667
}
@@ -119,20 +120,27 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
119120
}).future<void>()();
120121
}
121122

122-
public interpolateData(projectRoot: string): IFuture<void> {
123+
public interpolateData(): IFuture<void> {
123124
return (() => {
124-
let infoPlistFilePath = path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, util.format("%s-%s", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "Info.plist"));
125-
shell.sed('-i', "__CFBUNDLEIDENTIFIER__", this.$projectData.projectId, infoPlistFilePath);
125+
let infoPlistFilePath = path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, util.format("%s-%s", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "Info.plist"));
126+
this.interpolateConfigurationFile(infoPlistFilePath).wait();
126127

127-
this.replaceFileName("-Info.plist", path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait();
128-
this.replaceFileName("-Prefix.pch", path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait();
129-
this.replaceFileName(IOSProjectService.XCODE_PROJECT_EXT_NAME, projectRoot).wait();
128+
let projectRootFilePath = path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER);
129+
this.replaceFileName("-Info.plist", projectRootFilePath).wait();
130+
this.replaceFileName("-Prefix.pch", projectRootFilePath).wait();
131+
this.replaceFileName(IOSProjectService.XCODE_PROJECT_EXT_NAME, this.platformData.projectRoot).wait();
130132

131-
let pbxprojFilePath = path.join(projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "project.pbxproj");
133+
let pbxprojFilePath = path.join(this.platformData.projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "project.pbxproj");
132134
this.replaceFileContent(pbxprojFilePath).wait();
133135
}).future<void>()();
134136
}
135137

138+
public interpolateConfigurationFile(configurationFilePath?: string): IFuture<void> {
139+
return (() => {
140+
shell.sed('-i', "__CFBUNDLEIDENTIFIER__", this.$projectData.projectId, configurationFilePath || this.platformData.configurationFilePath);
141+
}).future<void>()();
142+
}
143+
136144
public afterCreateProject(projectRoot: string): IFuture<void> {
137145
return (() => {
138146
this.$fs.rename(path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER),

lib/services/platform-service.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,25 @@ export class PlatformService implements IPlatformService {
9494
private addPlatformCore(platformData: IPlatformData, frameworkDir: string): IFuture<void> {
9595
return (() => {
9696
let installedVersion = this.$fs.readJson(path.join(frameworkDir, "../", "package.json")).wait().version;
97-
platformData.platformProjectService.createProject(frameworkDir, installedVersion).wait();
97+
let isFrameworkPathDirectory = false,
98+
isFrameworkPathNotSymlinkedFile = false;
9899

99-
if(this.$options.frameworkPath && this.$fs.getFsStats(this.$options.frameworkPath).wait().isFile() && !this.$options.symlink) {
100+
if(this.$options.frameworkPath) {
101+
let frameworkPathStats = this.$fs.getFsStats(this.$options.frameworkPath).wait();
102+
isFrameworkPathDirectory = frameworkPathStats.isDirectory();
103+
isFrameworkPathNotSymlinkedFile = !this.$options.symlink && frameworkPathStats.isFile();
104+
}
105+
106+
let sourceFrameworkDir = isFrameworkPathDirectory && this.$options.symlink ? path.join(this.$options.frameworkPath, "framework") : frameworkDir;
107+
platformData.platformProjectService.createProject(path.resolve(sourceFrameworkDir), installedVersion).wait();
108+
109+
if(isFrameworkPathDirectory || isFrameworkPathNotSymlinkedFile) {
100110
// Need to remove unneeded node_modules folder
101111
// One level up is the runtime module and one above is the node_modules folder.
102112
this.$fs.deleteDirectory(path.join(frameworkDir, "../../")).wait();
103113
}
104114

105-
platformData.platformProjectService.interpolateData(platformData.projectRoot).wait();
115+
platformData.platformProjectService.interpolateData().wait();
106116
platformData.platformProjectService.afterCreateProject(platformData.projectRoot).wait();
107117

108118
this.$projectDataService.initialize(this.$projectData.projectDir);

0 commit comments

Comments
 (0)