Skip to content

Merge 1.5.1 in master #1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
eb91029
Do not show help when hook fails
rosen-vladimirov Nov 30, 2015
2cd81e1
Merge pull request #1279 from NativeScript/vladimirov/hooks-skip-help
rosen-vladimirov Dec 1, 2015
d65366f
Set version to 1.5.1
rosen-vladimirov Dec 1, 2015
d68ad6a
Merge pull request #1283 from NativeScript/vladimirov/set-version-1.5.1
dtopuzov Dec 1, 2015
741ef89
Improve XML parser validation output
teobugslayer Dec 1, 2015
d2f26e8
Update npm version to latest 2.x
rosen-vladimirov Dec 1, 2015
9b9aa46
Merge pull request #1287 from NativeScript/totev/improve-xml-verify-o…
teobugslayer Dec 1, 2015
f96c4f1
Merge pull request #1289 from NativeScript/vladimirov/update-npm-release
rosen-vladimirov Dec 1, 2015
baa469a
Fix error reporting in XML validation
teobugslayer Dec 1, 2015
e5d15b5
Merge pull request #1290 from NativeScript/totev/fix-error-reporting
teobugslayer Dec 1, 2015
dbc7e95
Only warn about XML parsing errors
teobugslayer Dec 2, 2015
e7db028
Merge pull request #1291 from NativeScript/totev/xml-warnings
teobugslayer Dec 2, 2015
b84105b
Add information about 1.5.1 release in CHANGELOG
rosen-vladimirov Dec 2, 2015
c1ec4e6
Merge pull request #1293 from NativeScript/vladimirov/changelog-1.5.1
rosen-vladimirov Dec 2, 2015
2b9317d
Timestamps for fast LiveSync
teobugslayer Dec 2, 2015
a8a99ab
Merge pull request #1295 from NativeScript/totev/fast-livesync-timest…
teobugslayer Dec 2, 2015
4834e80
Fix tns doctor command
rosen-vladimirov Dec 3, 2015
85c4ecf
Merge pull request #1298 from NativeScript/vladimirov/fix-android-hom…
rosen-vladimirov Dec 3, 2015
989eae2
Merge branch 'release' into vladimirov/merge-rel-master
rosen-vladimirov Dec 3, 2015
374145d
Silent shelljs for unit-tests
rosen-vladimirov Dec 3, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
==

Expand Down Expand Up @@ -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

Expand Down
20 changes: 13 additions & 7 deletions lib/android-tools-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
private $logger: ILogger,
private $options: IOptions) {}

public getPathToAndroidExecutable(): IFuture<string> {
public getPathToAndroidExecutable(options?: {showWarningsAsErrors: boolean}): IFuture<string> {
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);
if(!this.trySetAndroidPath(androidPath).wait() && !this.trySetAndroidPath(this.androidExecutableName).wait()) {
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.");
}
}

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>;
getPathToAndroidExecutable(options?: {showWarningsAsErrors: boolean}): IFuture<string>;

/**
* Gets the path to `adb` executable from ANDROID_HOME. It should be `$ANDROID_HOME/platform-tools/adb` in case it exists.
Expand Down
2 changes: 1 addition & 1 deletion lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>()();
}
Expand Down
17 changes: 10 additions & 7 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -179,15 +180,20 @@ 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
});
parser.parseFromString(fileContents, "text/xml");
xmlHasErrors = xmlHasErrors || hasErrors;
if (xmlHasErrors) {
this.$logger.out("Error: ".red.bold + file + " has syntax errors.".red.bold);
if (hasErrors) {
this.$logger.warn(`${file} has syntax errors.`);
this.$logger.out(errorOutput);
}
});
return !xmlHasErrors;
Expand Down Expand Up @@ -231,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})));
Expand Down
3 changes: 2 additions & 1 deletion lib/services/usb-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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<void>()();
});
};
Expand Down
11 changes: 9 additions & 2 deletions test/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
2 changes: 2 additions & 0 deletions test/test-bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as shelljs from "shelljs";
shelljs.config.silent = true;
global._ = require("lodash");
global.$injector = require("../lib/common/yok").injector;

Expand Down