diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eac55eda0..65d1b2dbe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ NativeScript CLI Changelog ================ +1.5.2 (2015, December 12) +== +### New +* [Implemented #1247](https://github.com/NativeScript/nativescript-cli/issues/1247): Do not kill adb server if possible. + +### Fixed +* [Fixed #956](https://github.com/NativeScript/nativescript-cli/issues/956): Better error reporting for deploy on device. +* [Fixed #1210](https://github.com/NativeScript/nativescript-cli/issues/1210): LiveSync does not handle correctly removed files on iOS simulator. +* [Fixes #1308](https://github.com/NativeScript/nativescript-cli/issues/1308): Livesync ends up with an endless loop for projects that have before-prepare hook that changes some project file. +* [Fixed #1313](https://github.com/NativeScript/nativescript-cli/issues/1313): `tns livesync ios --watch --emulator` command does not process platform specific files. + 1.5.1 (2015, December 03) == ### New diff --git a/PLUGINS.md b/PLUGINS.md index 2ad036105d..e811271028 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -112,7 +112,7 @@ my-plugin/ * `platforms\android\include.gradle`: This file modifies the native Android configuration of your NativeScript project such as native dependencies, build types and configurations. For more information about the format of `include.gradle`, see [`include.gradle` file](#includegradle-specification). * `platforms\ios`: This directory contains native dynamic iOS Cocoa Touch Frameworks (`.framework`) and Cocoa Touch Static Libraries (`.a`). During the plugin installation, the NativeScript CLI will copy these files to `lib\iOS` in your project and will configure the iOS project in `platforms\ios` to work with the libraries. If the library is written in Swift, only APIs exposed to Objective-C are exposed to NativeScript. In case the plugin contains a Cocoa Touch Static Library (`.a`), you must place all public headers (`.h`) under `include\\`. Make sure that the static libraries are built at least for the following processor architectures - armv7, arm64, i386. * `platforms\ios\build.xcconfig`: This file modifies the native iOS configuration of your NativeScript project such as native dependencies and configurations. For more information about the format of `build.xcconfig`, see [`build.xcconfig` file](#buildxcconfig-specification). -* `platforms\ios\Podfile`: This file describes the dependency to the library that you want to use. For more information, see [CocoaPods.md](CocoaPods.md). +* `platforms\ios\Podfile`: This file describes the dependency to the library that you want to use. For more information, see [the CocoaPods article](CocoaPods.md). ### Package.json Specification diff --git a/README.md b/README.md index 77cc6c452d..2753c76b65 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ You can install and run the NativeScript CLI on Windows or OS X. > On Windows systems, you can develop, build, and deploy NativeScript projects that target Android. * Windows Vista or later -* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/), [0.12.x](https://nodejs.org/dist/latest-v0.12.x/) or [4.2.x](https://nodejs.org/dist/latest-v4.x/) stable official release +* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/), [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), [4.2.x](https://nodejs.org/dist/latest-v4.x/) or [5.x](https://nodejs.org/dist/latest-v5.x/) stable official release * (Optional) [Chocolatey][Chocolatey] * [JDK 8][JDK 8] or a later stable official release * [Android SDK 22][Android SDK 22] or a later stable official release @@ -77,15 +77,6 @@ You can install and run the NativeScript CLI on Windows or OS X. * [Android Support Repository][Android Support Repository] * (Optional) [Genymotion][Genymotion] -If you want to develop for Android, verify that you have added the following paths in the `PATH` system environment variable. - -``` -Path to tools directory in the Android SDK installation folder -Path to platform-tools directory in the Android SDK installation folder -``` - -For example: PATH=...;...;C:\Users\MyUser\AppData\Local\Android\android-sdk\tools;C:\Users\MyUser\AppData\Local\Android\android-sdk\platform-tools; - If you have installed Chocolatey, you can complete these steps to set up JDK, and Android SDK. 1. Run a Windows command prompt. @@ -97,7 +88,7 @@ If you have installed Chocolatey, you can complete these steps to set up JDK, an 1. If not present, create the following environment variables. ``` - JAVA_HOME=Path to the jdk* install folder + JAVA_HOME=Path to the jdk* install directory ``` For example: JAVA_HOME=C:\Program Files\Java\jdk1.8.0_66 @@ -107,19 +98,14 @@ If you have installed Chocolatey, you can complete these steps to set up JDK, an ``` For example: ANDROID_HOME=C:\Android\android-sdk + +> NOTE: This is the directory that contains `tools` and `platform-tools` directories. + 1. To install the Android SDK, run the following command. ```Shell choco install android-sdk ``` -1. If not present, add the following file path to the `PATH` system environment variable. - - ``` - Path to tools directory in the Android SDK installation folder - Path to platform-tools directory in the Android SDK installation folder - ``` - - For example: PATH=...;...;C:\Users\MyUser\AppData\Local\Android\android-sdk\tools;C:\Users\MyUser\AppData\Local\Android\android-sdk\platform-tools 1. To update the Android SDK to 22 or later, run the following command. ```Shell @@ -139,7 +125,7 @@ android update sdk --filter tools,platform-tools,android-22,build-tools-22.0.1,s > On OS X systems, you can develop, build, and deploy NativeScript projects that target iOS and Android. * OS X Mavericks -* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/) or [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), or [4.2.x](https://nodejs.org/dist/latest-v4.x/) stable official release +* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/), [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), [4.2.x](https://nodejs.org/dist/latest-v4.x/) or [5.x](https://nodejs.org/dist/latest-v5.x/) stable official release * For iOS development * [Latest Xcode][12] * [Xcode command-line tools][12] @@ -151,22 +137,10 @@ android update sdk --filter tools,platform-tools,android-22,build-tools-22.0.1,s * [Android Support Repository][Android Support Repository] * (Optional) [Genymotion][Genymotion] -If you want to develop for Android, verify that you have added the following paths in your `PATH` in `~/.bash_profile`. - -``` -Path to the tools subdirectory in the Android SDK installation directory -Path to the platform-tools subdirectory in the Android SDK installation directory -``` - -For example: -``` -export PATH=${PATH}:/Applications/Android\ Studio.app/sdk/tools:/Applications/Android\ Studio.app/sdk/platform-tools -``` - If not present, create the following environment variables. ``` -JAVA_HOME=Path to the jdk* install folder +JAVA_HOME=Path to the jdk* install directory ``` For example: JAVA_HOME=/usr/bin/java @@ -175,7 +149,9 @@ For example: JAVA_HOME=/usr/bin/java ANDROID_HOME=Path to Android installation directory ``` -For example: ANDROID_HOME=/Applications/Android\ Studio.app/sdk/ +For example: ANDROID_HOME=/usr/local/Cellar/android-sdk/24/ + +> NOTE: This is the directory that contains `tools` and `platform-tools` directories. You can install the required Android tools with the following command: @@ -188,7 +164,7 @@ echo yes | android update sdk --filter tools,platform-tools,android-22,build-too > On Linux systems, you can develop, build, and deploy NativeScript projects that target Android. * Ubuntu 14.04 LTS -* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/) or [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), or [4.2.x](https://nodejs.org/dist/latest-v4.x/) stable official release +* The latest Node.js [0.10.x](https://nodejs.org/dist/latest-v0.10.x/), [0.12.x](https://nodejs.org/dist/latest-v0.12.x/), [4.2.x](https://nodejs.org/dist/latest-v4.x/) or [5.x](https://nodejs.org/dist/latest-v5.x/) stable official release > **TIP:** You can follow the instructions provided [here](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) to install Node.js on your system. @@ -209,22 +185,10 @@ echo yes | android update sdk --filter tools,platform-tools,android-22,build-too * [Android Support Repository][Android Support Repository] * (Optional) [Genymotion][Genymotion] -Verify that you have added the following paths in your `PATH`. - -``` -Path to the tools subdirectory in the Android SDK installation directory -Path to the platform-tools subdirectory in the Android SDK installation directory -``` - -For example: -``` -export PATH=${PATH}:/home/user/android-sdk/tools:/home/user/android-sdk/platform-tools -``` - If not present, create the following environment variables. ``` -JAVA_HOME=Path to the jdk* install folder +JAVA_HOME=Path to the jdk* install directory ``` For example: JAVA_HOME=/usr/bin/java @@ -235,6 +199,8 @@ ANDROID_HOME=Path to Android installation directory For example: ANDROID_HOME=/home/user/android-sdk +> NOTE: This is the directory that contains `tools` and `platform-tools` directories. + You can install required Android Tools with the following command. ```Shell diff --git a/docs/man_pages/project/testing/emulate-android.md b/docs/man_pages/project/testing/emulate-android.md index b4751c6a41..eff859b21d 100644 --- a/docs/man_pages/project/testing/emulate-android.md +++ b/docs/man_pages/project/testing/emulate-android.md @@ -36,8 +36,12 @@ Before running your app in the Android emulator from the Android SDK, verify tha * Verify that you have installed Genymotion. * On Windows and Linux systems, verify that you have added the Genymotion installation directory to the `PATH` environment variable. * On OS X systems, verify that you have added the following paths to the PATH environment variable. - * `/Applications/Genymotion.app/Contents/MacOS/` - * `/Applications/Genymotion Shell.app/Contents/MacOS/` + * For Genymotion earlier than 2.6: + * `/Applications/Genymotion.app/Contents/MacOS/` + * `/Applications/Genymotion Shell.app/Contents/MacOS/` + * For Genymotion 2.6: + * `/Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS` + * `/Applications/Genymotion Shell.app/Contents/MacOS/` ### Command Limitations diff --git a/docs/man_pages/project/testing/run-android.md b/docs/man_pages/project/testing/run-android.md index 7efe258e60..a99d35c7cf 100644 --- a/docs/man_pages/project/testing/run-android.md +++ b/docs/man_pages/project/testing/run-android.md @@ -34,8 +34,13 @@ Before running your app in the Android emulator from the Android SDK, verify tha * Verify that you have installed Genymotion. * On Windows and Linux systems, verify that you have added the Genymotion installation directory to the `PATH` environment variable. * On OS X systems, verify that you have added the following paths to the `PATH` environment variable. - * `/Applications/Genymotion.app/Contents/MacOS/` - * `/Applications/Genymotion Shell.app/Contents/MacOS/` + * For Genymotion earlier than 2.6: + * `/Applications/Genymotion.app/Contents/MacOS/` + * `/Applications/Genymotion Shell.app/Contents/MacOS/` + * For Genymotion 2.6: + * `/Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS` + * `/Applications/Genymotion Shell.app/Contents/MacOS/` + ### Command Limitations diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts index 670aeabb40..5f13a02e0a 100644 --- a/lib/bootstrap.ts +++ b/lib/bootstrap.ts @@ -1,4 +1,5 @@ require("./common/bootstrap"); +$injector.require("logger", "./common/logger"); $injector.require("config", "./config"); $injector.require("options", "./options"); // note: order above is important! diff --git a/lib/common b/lib/common index 416012b69c..b083503f9a 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 416012b69cd8bf67e9470d7f3670d631830e08c5 +Subproject commit b083503f9a6627363e0c0d4e0a1971a1991172dd diff --git a/lib/declarations.ts b/lib/declarations.ts index 9c90f22085..2024836824 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -87,6 +87,7 @@ interface IOptions extends ICommonOptions { compileSdk: number; port: Number; copyTo: string; + baseConfig: string; } interface IProjectFilesManager { diff --git a/lib/options.ts b/lib/options.ts index ce2c032d26..431e4cf6f4 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -34,6 +34,7 @@ export class Options extends commonOptionsLibPath.OptionsBase { compileSdk: {type: OptionType.Number }, port: { type: OptionType.Number }, copyTo: { type: OptionType.String }, + baseConfig: { type: OptionType.String } }, path.join($hostInfo.isWindows ? process.env.LocalAppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"), $errors, $staticConfig); diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index b33193f4c3..4939d6f6d4 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -222,6 +222,9 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject } let gradleBin = this.useGradleWrapper(projectRoot) ? path.join(projectRoot, "gradlew") : "gradle"; + if (this.$hostInfo.isWindows) { + gradleBin += ".bat"; // cmd command line parsing rules are weird. Avoid issues with quotes. See https://github.com/apache/cordova-android/blob/master/bin/templates/cordova/lib/builders/GradleBuilder.js for another approach + } this.spawn(gradleBin, buildOptions, { stdio: "inherit", cwd: this.platformData.projectRoot }).wait(); } else { this.checkAnt().wait(); @@ -368,11 +371,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject } private spawn(command: string, args: string[], opts?: any): IFuture { - if (this.$hostInfo.isWindows) { - args.unshift('/s', '/c', command); - command = process.env.COMSPEC || 'cmd.exe'; - } - return this.$childProcess.spawnFromEvent(command, args, "close", opts || { stdio: "inherit"}); } diff --git a/lib/services/doctor-service.ts b/lib/services/doctor-service.ts index 9cc8ec43d7..2d1ed65854 100644 --- a/lib/services/doctor-service.ts +++ b/lib/services/doctor-service.ts @@ -47,9 +47,9 @@ class DoctorService implements IDoctorService { } if(!sysInfo.cocoapodVer) { - this.$logger.warn("WARNING: CocoaPod is not installed or is not configured properly."); + this.$logger.warn("WARNING: CocoaPods is not installed or is not configured properly."); this.$logger.out("You will not be able to build your projects for iOS if they contain plugin with CocoaPod file." + EOL - + "To be able to build such projects, verify that you have installed CocoaPod."); + + "To be able to build such projects, verify that you have installed CocoaPods."); result = true; } diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index a114fc2564..dfaedb6056 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -113,6 +113,11 @@ export class PlatformService implements IPlatformService { let sourceFrameworkDir = isFrameworkPathDirectory && this.$options.symlink ? path.join(this.$options.frameworkPath, "framework") : frameworkDir; platformData.platformProjectService.createProject(path.resolve(sourceFrameworkDir), installedVersion).wait(); + if(this.$options.baseConfig) { + let newConfigFile = path.resolve(this.$options.baseConfig); + this.$logger.trace(`Replacing '${platformData.configurationFilePath}' with '${newConfigFile}'.`); + this.$fs.copyFile(newConfigFile, platformData.configurationFilePath).wait(); + } if(isFrameworkPathDirectory || isFrameworkPathNotSymlinkedFile) { // Need to remove unneeded node_modules folder @@ -224,7 +229,7 @@ export class PlatformService implements IPlatformService { .value(); // Copy all files from app dir, but make sure to exclude tns_modules - let sourceFiles = this.$fs.enumerateFilesInDirectorySync(appSourceDirectoryPath); + let sourceFiles = this.$fs.enumerateFilesInDirectorySync(appSourceDirectoryPath, null, { includeEmptyDirectories: true }); if (this.$options.release) { sourceFiles = sourceFiles.filter(source => source !== 'tests'); @@ -242,8 +247,11 @@ export class PlatformService implements IPlatformService { // Remove .ts and .js.map files PlatformService.EXCLUDE_FILES_PATTERN.forEach(pattern => sourceFiles = sourceFiles.filter(file => !minimatch(file, pattern, {nocase: true}))); let copyFileFutures = sourceFiles.map(source => { - let destinationFile = path.join(appDestinationDirectoryPath, path.relative(appSourceDirectoryPath, source)); - return this.$fs.copyFile(source, destinationFile); + let destinationPath = path.join(appDestinationDirectoryPath, path.relative(appSourceDirectoryPath, source)); + if (this.$fs.getFsStats(source).wait().isDirectory()) { + return this.$fs.createDirectory(destinationPath); + } + return this.$fs.copyFile(source, destinationPath); }); Future.wait(copyFileFutures); diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index 781b455d22..813ca640ea 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -114,7 +114,7 @@ export class PluginsService implements IPluginsService { npmInstallationManager.addToCache(platformData.frameworkPackageName, frameworkVersion).wait(); let cachedPackagePath = npmInstallationManager.getCachedPackagePath(platformData.frameworkPackageName, frameworkVersion); - let cachedConfigurationFilePath = path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, platformData.relativeToFrameworkConfigurationFilePath); + let cachedConfigurationFilePath = this.$options.baseConfig ? path.resolve(this.$options.baseConfig) : path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, platformData.relativeToFrameworkConfigurationFilePath); let cachedConfigurationFileContent = this.$fs.readText(cachedConfigurationFilePath).wait(); this.$fs.writeFile(platformData.configurationFilePath, cachedConfigurationFileContent).wait(); diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 13eb2a3ce5..68486e97ff 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -157,6 +157,10 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer let getApplicationPathForiOSSimulatorAction = (): IFuture => { return (() => { + if (!this.$fs.exists(platformData.emulatorBuildOutputPath).wait()) { + this.$platformService.buildPlatform(platformData.normalizedPlatformName).wait(); + } + return this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait().packageName; }).future()(); }; diff --git a/package.json b/package.json index 6821b321d7..1496e18e85 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "ref-struct": "https://github.com/telerik/ref-struct/tarball/v1.0.2.1", "rimraf": "2.4.2", "semver": "5.0.1", - "shelljs": "0.5.1", + "shelljs": "0.5.3", "tabtab": "https://github.com/Icenium/node-tabtab/tarball/master", "temp": "0.8.3", "through2": "2.0.0",