From eb91029f097219e46170f7adb23a1b1aee0b39b5 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 30 Nov 2015 20:22:48 +0200 Subject: [PATCH 01/10] Do not show help when hook fails When any of the hooks fail, we show help of the command. Hooks failure is not bad user input, so we should not show help. --- lib/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common b/lib/common index 923bcdb11c..9f4d4e91ad 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 923bcdb11cc5fa1c00c8ff1db2ace77d73830934 +Subproject commit 9f4d4e91ad8bc1a64ea7c713edfb5e4d99c74259 From d65366fdd4ecee971e456a8dd45933cd53f9ceac Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Tue, 1 Dec 2015 10:43:25 +0200 Subject: [PATCH 02/10] Set version to 1.5.1 Set version to 1.5.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d8166fb609..d0c786feee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "1.5.0", + "version": "1.5.1", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": { From 741ef89fe18b449be45b46e084b4e50de597aaa2 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Tue, 1 Dec 2015 17:26:44 +0200 Subject: [PATCH 03/10] Improve XML parser validation output --- lib/services/platform-service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 5cc1698b69..0a9fcdbc20 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -8,6 +8,7 @@ import * as helpers from "../common/helpers"; import * as semver from "semver"; import * as minimatch from "minimatch"; import Future = require("fibers/future"); +import {EOL} from "os"; export class PlatformService implements IPlatformService { private static TNS_MODULES_FOLDER_NAME = "tns_modules"; @@ -179,7 +180,11 @@ export class PlatformService implements IPlatformService { .forEach(file => { let fileContents = this.$fs.readText(file).wait(); let hasErrors = false; - let domErrorHandler = (level:any, msg:string) => hasErrors = true; + let errorOutput = ""; + let domErrorHandler = (level:any, msg:string) => { + errorOutput += level + EOL + msg + EOL; + hasErrors = true; + }; let parser = new DomParser({ locator:{}, errorHandler: domErrorHandler @@ -187,7 +192,8 @@ export class PlatformService implements IPlatformService { parser.parseFromString(fileContents, "text/xml"); xmlHasErrors = xmlHasErrors || hasErrors; if (xmlHasErrors) { - this.$logger.out("Error: ".red.bold + file + " has syntax errors.".red.bold); + this.$logger.warn(`${file} has syntax errors.`); + this.$logger.out(errorOutput); } }); return !xmlHasErrors; From d2f26e810f216c22d0993da5b3ceac5f2699dfb4 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Tue, 1 Dec 2015 17:37:10 +0200 Subject: [PATCH 04/10] Update npm version to latest 2.x Update npm version to latest 2.x as the old one (2.6.1) has some bugs that prevent us from using git urls, installing some plugins, etc. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d0c786feee..892f614b48 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mute-stream": "0.0.5", "node-inspector": "https://github.com/NativeScript/node-inspector/tarball/v0.7.4.0", "node-uuid": "1.4.3", - "npm": "2.6.1", + "npm": "2.14.12", "open": "0.0.5", "osenv": "0.1.3", "plist": "1.1.0", From baa469ababd0244f060e2ac399ae6102235eed85 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Tue, 1 Dec 2015 18:07:11 +0200 Subject: [PATCH 05/10] Fix error reporting in XML validation --- lib/services/platform-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 0a9fcdbc20..6cb28beddc 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -191,7 +191,7 @@ export class PlatformService implements IPlatformService { }); parser.parseFromString(fileContents, "text/xml"); xmlHasErrors = xmlHasErrors || hasErrors; - if (xmlHasErrors) { + if (hasErrors) { this.$logger.warn(`${file} has syntax errors.`); this.$logger.out(errorOutput); } From dbc7e959da394083d7c3aa809efff60c89d673d8 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Wed, 2 Dec 2015 10:36:17 +0200 Subject: [PATCH 06/10] Only warn about XML parsing errors See https://github.com/NativeScript/nativescript-cli/issues/1272 --- lib/services/platform-service.ts | 5 +---- test/platform-service.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 6cb28beddc..a114fc2564 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -237,10 +237,7 @@ export class PlatformService implements IPlatformService { } // verify .xml files are well-formed - let validXmlFiles = this.checkXmlFiles(sourceFiles).wait(); - if (!validXmlFiles) { - return false; - } + this.checkXmlFiles(sourceFiles).wait(); // Remove .ts and .js.map files PlatformService.EXCLUDE_FILES_PATTERN.forEach(pattern => sourceFiles = sourceFiles.filter(file => !minimatch(file, pattern, {nocase: true}))); diff --git a/test/platform-service.ts b/test/platform-service.ts index edac69f78e..9e941685a0 100644 --- a/test/platform-service.ts +++ b/test/platform-service.ts @@ -331,10 +331,17 @@ describe('Platform Service Tests', () => { projectData.projectDir = tempFolder; platformService = testInjector.resolve("platformService"); - let result = platformService.preparePlatform("android").wait(); + let oldLoggerWarner = testInjector.resolve("$logger").warn; + let warnings: string = ""; + try { + testInjector.resolve("$logger").warn = (text: string) => warnings += text; + platformService.preparePlatform("android").wait(); + } finally { + testInjector.resolve("$logger").warn = oldLoggerWarner; + } // Asserts that prepare has caught invalid xml - assert.isFalse(result); + assert.isFalse(warnings.indexOf("has errors") !== -1); }); }); }); From b84105b28d83a7978b73af2ab7dc50dfc5decdc9 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 2 Dec 2015 13:57:44 +0200 Subject: [PATCH 07/10] Add information about 1.5.1 release in CHANGELOG Add information about 1.5.1 release in CHANGELOG --- CHANGELOG.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 964c7eed2e..0eac55eda0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ NativeScript CLI Changelog ================ +1.5.1 (2015, December 03) +== +### New +* [Implemented #452](https://github.com/NativeScript/nativescript-cli/issues/452): Build should report malformed XML. +* [Implemented #1263](https://github.com/NativeScript/nativescript-cli/issues/1263): Add timestamps to LiveSync messages. + +### Fixed +* [Fixed #1234](https://github.com/NativeScript/nativescript-cli/issues/1234): LiveSync does not work for iOS platform specific .xml/.css files on iOS Simulator. +* [Fixed #1242](https://github.com/NativeScript/nativescript-cli/issues/1242): `ANDROID_HOME environment variable is not set correctly` error is thrown when `tns run ios --log trace` command is executed. +* [Fixed #1245](https://github.com/NativeScript/nativescript-cli/issues/1245): `TypeError: Cannot read property 'match' of null` error is thrown on various commands. +* [Fixed #1246](https://github.com/NativeScript/nativescript-cli/issues/1246): LiveSync on android device is throwing ENAMTOOLONG error on Windows. +* [Fixed #1253](https://github.com/NativeScript/nativescript-cli/issues/1253): iOS debugger does not work with iOS Simulator with Xcode7+. +* [Fixed #1268](https://github.com/NativeScript/nativescript-cli/issues/1268): Hook failures treated as bad user input. + 1.5.0 (2015, November 24) == @@ -280,7 +294,7 @@ Building NativeScript projects for Android requires Android SDK 22, Android SDK * Introduced new project structure. To migrate to the new structure, complete the following steps. 1. Manually move all files and folders from the inner `app` folder one level up inside the outer `app` folder. 1. Remove the now empty inner `app` folder. - 1. Verify that your project structure reflects the structure described [here](README.md#create-project). + 1. Verify that your project structure reflects the structure described [here](https://github.com/NativeScript/nativescript-cli/blob/production/README.md#create-project). ### New From 2b9317d4a52f1d8424dac5f44765821e5d7bbad6 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Wed, 2 Dec 2015 18:09:14 +0200 Subject: [PATCH 08/10] Timestamps for fast LiveSync See https://github.com/NativeScript/nativescript-cli/issues/1263 --- lib/services/usb-livesync-service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 299920d45a..13eb2a3ce5 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -9,6 +9,7 @@ import * as semver from "semver"; import * as net from "net"; import Future = require("fibers/future"); import * as helpers from "../common/helpers"; +import * as moment from "moment"; export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncServiceBase implements IUsbLiveSyncService { @@ -149,7 +150,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer }); } - this.$logger.info(`Successfully synced application ${this.$projectData.projectId}.`); + this.$logger.info(`Successfully synced application ${this.$projectData.projectId} at ${moment().format("ll LTS")}.`); }).future()(); }); }; From 4834e800809e11ddc8d7c372f6974528d2ad2c41 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 3 Dec 2015 08:40:18 +0000 Subject: [PATCH 09/10] Fix tns doctor command When ANDROID_HOME environment variable is not set, we call childProcess exec and spawn with undefined command. This leads to "futures left behind" errors. Make sure the commands will be executed only in case they are not undefined. Also make sure that `tns prepare android` will fail immediately in case ANDROID_HOME is not set (currently it shows warning for ANDROID_HOME and shows error for compile SDK). --- lib/android-tools-info.ts | 20 +++++++++++++------- lib/common | 2 +- lib/declarations.ts | 3 ++- lib/services/android-project-service.ts | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/android-tools-info.ts b/lib/android-tools-info.ts index 7f52036ac6..2e04ac4ae6 100644 --- a/lib/android-tools-info.ts +++ b/lib/android-tools-info.ts @@ -38,8 +38,11 @@ export class AndroidToolsInfo implements IAndroidToolsInfo { private $logger: ILogger, private $options: IOptions) {} - public getPathToAndroidExecutable(): IFuture { + public getPathToAndroidExecutable(options?: {showWarningsAsErrors: boolean}): IFuture { return ((): string => { + if(options) { + this.showWarningsAsErrors = options.showWarningsAsErrors; + } if (!this.pathToAndroidExecutable) { if(this.validateAndroidHomeEnvVariable(this.androidHome).wait()) { let androidPath = path.join(this.androidHome, "tools", this.androidExecutableName); @@ -47,7 +50,7 @@ export class AndroidToolsInfo implements IAndroidToolsInfo { this.printMessage(`Unable to find "${this.androidExecutableName}" executable file. Make sure you have set ANDROID_HOME environment variable correctly.`); } } else { - this.printMessage("ANDROID_HOME environment variable is not set correctly."); + this.$logger.trace("ANDROID_HOME environment variable is not set correctly."); } } @@ -338,11 +341,14 @@ export class AndroidToolsInfo implements IAndroidToolsInfo { return (() => { if (!this.installedTargetsCache) { try { - let result = this.$childProcess.spawnFromEvent(this.getPathToAndroidExecutable().wait(), ["list", "targets"], "close", {}, {throwError: false}).wait(); - if(result.stdout) { - this.$logger.trace(result.stdout); - this.installedTargetsCache = []; - result.stdout.replace(/id: \d+ or "(.+)"/g, (m:string, p1:string) => (this.installedTargetsCache.push(p1), m)); + let pathToAndroidExecutable = this.getPathToAndroidExecutable().wait(); + if(pathToAndroidExecutable) { + let result = this.$childProcess.spawnFromEvent(pathToAndroidExecutable, ["list", "targets"], "close", {}, {throwError: false}).wait(); + if(result && result.stdout) { + this.$logger.trace(result.stdout); + this.installedTargetsCache = []; + result.stdout.replace(/id: \d+ or "(.+)"/g, (m:string, p1:string) => (this.installedTargetsCache.push(p1), m)); + } } } catch(err) { this.$logger.trace("Unable to get Android targets. Error is: " + err); diff --git a/lib/common b/lib/common index 9f4d4e91ad..2b0980f179 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 9f4d4e91ad8bc1a64ea7c713edfb5e4d99c74259 +Subproject commit 2b0980f17978c5cf8e2e9fe0bb9f9febf7c43576 diff --git a/lib/declarations.ts b/lib/declarations.ts index e8906ca5df..9c90f22085 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -126,9 +126,10 @@ interface IAndroidToolsInfo { /** * Returns the path to `android` executable. It should be `$ANDROID_HOME/tools/android`. * In case ANDROID_HOME is not defined, check if `android` is part of $PATH. + * @param {any} options Defines if the warning messages should treated as error. * @return {string} Path to the `android` executable. */ - getPathToAndroidExecutable(): IFuture; + getPathToAndroidExecutable(options?: {showWarningsAsErrors: boolean}): IFuture; /** * Gets the path to `adb` executable from ANDROID_HOME. It should be `$ANDROID_HOME/platform-tools/adb` in case it exists. diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index bdca9896d3..b33193f4c3 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -79,7 +79,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject this.validateProjectName(this.$projectData.projectName); // this call will fail in case `android` is not set correctly. - this.$androidToolsInfo.getPathToAndroidExecutable().wait(); + this.$androidToolsInfo.getPathToAndroidExecutable({showWarningsAsErrors: true}).wait(); this.$androidToolsInfo.validateJavacVersion(this.$sysInfo.getSysInfo(path.join(__dirname, "..", "..", "package.json")).wait().javacVersion, {showWarningsAsErrors: true}).wait(); }).future()(); } From 374145de9d0fa381b57c6a7e626f6b6d4ba63e68 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Thu, 3 Dec 2015 14:41:08 +0000 Subject: [PATCH 10/10] Silent shelljs for unit-tests Silent shelljs for unit-tests and update to latest common lib --- lib/common | 2 +- test/test-bootstrap.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/common b/lib/common index ed9af3330c..416012b69c 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit ed9af3330c8c340faf217376d6f6d51916d0bf36 +Subproject commit 416012b69cd8bf67e9470d7f3670d631830e08c5 diff --git a/test/test-bootstrap.ts b/test/test-bootstrap.ts index ee807cabce..b90c40cdf7 100644 --- a/test/test-bootstrap.ts +++ b/test/test-bootstrap.ts @@ -1,3 +1,5 @@ +import * as shelljs from "shelljs"; +shelljs.config.silent = true; global._ = require("lodash"); global.$injector = require("../lib/common/yok").injector;