diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts index edf24f1af4..670aeabb40 100644 --- a/lib/bootstrap.ts +++ b/lib/bootstrap.ts @@ -90,3 +90,4 @@ $injector.require("iOSNotificationService", "./services/ios-notification-service $injector.require("socketProxyFactory", "./device-sockets/ios/socket-proxy-factory"); $injector.require("iOSNotification", "./device-sockets/ios/notification"); $injector.require("iOSSocketRequestExecutor", "./device-sockets/ios/socket-request-executor"); +$injector.require("messages", "./messages"); diff --git a/lib/common b/lib/common index a756232d06..ad5e363a55 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit a756232d06f3b500dcac456486d5c2c8899c3bd0 +Subproject commit ad5e363a55822745caad0ef3f965ee52c2fbec18 diff --git a/lib/services/doctor-service.ts b/lib/services/doctor-service.ts index a79d208efd..f016d51834 100644 --- a/lib/services/doctor-service.ts +++ b/lib/services/doctor-service.ts @@ -45,15 +45,22 @@ class DoctorService implements IDoctorService { result = true; } - if(!sysInfo.cocoapodVer ) { + if(!sysInfo.cocoapodVer) { this.$logger.warn("WARNING: CocoaPod 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."); result = true; } - if(sysInfo.cocoapodVer && semver.lt(sysInfo.cocoapodVer, DoctorService.MIN_SUPPORTED_POD_VERSION)) { - this.$logger.warn(`WARNING: CocoaPods version is lower than ${DoctorService.MIN_SUPPORTED_POD_VERSION}`); + if (sysInfo.cocoapodVer && semver.valid(sysInfo.cocoapodVer) === null) { + this.$logger.warn(`WARNING: CocoaPods version is not a valid semver version.`); + 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 at least ${DoctorService.MIN_SUPPORTED_POD_VERSION} version installed.`); + result = true; + } + + if (sysInfo.cocoapodVer && semver.valid(sysInfo.cocoapodVer) && semver.lt(sysInfo.cocoapodVer, DoctorService.MIN_SUPPORTED_POD_VERSION)) { + this.$logger.warn(`WARNING: CocoaPods version is lower than ${DoctorService.MIN_SUPPORTED_POD_VERSION}.`); 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 at least ${DoctorService.MIN_SUPPORTED_POD_VERSION} version installed.`); result = true; diff --git a/lib/services/init-service.ts b/lib/services/init-service.ts index 244053198e..fdf0cb73b3 100644 --- a/lib/services/init-service.ts +++ b/lib/services/init-service.ts @@ -16,7 +16,6 @@ export class InitService implements IInitService { private _projectFilePath: string; constructor(private $fs: IFileSystem, - private $errors: IErrors, private $logger: ILogger, private $options: IOptions, private $injector: IInjector, diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 948c169c1c..3afe67c7f3 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -335,6 +335,11 @@ export class PlatformService implements IPlatformService { this.ensurePlatformInstalled(platform).wait(); let platformData = this.$platformsData.getPlatformData(platform); + this.$devicesService.initialize({platform: platform, deviceId: this.$options.device}).wait(); + if (this.$devicesService.deviceCount < 1) { + this.$errors.failWithoutHelp("Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again."); + } + let cachedDeviceOption = this.$options.forDevice; this.$options.forDevice = true; this.buildPlatform(platform, buildConfig).wait(); @@ -344,7 +349,6 @@ export class PlatformService implements IPlatformService { let packageFile = this.getLatestApplicationPackageForDevice(platformData).wait().packageName; this.$logger.out("Using ", packageFile); - this.$devicesService.initialize({platform: platform, deviceId: this.$options.device}).wait(); let action = (device: Mobile.IDevice): IFuture => { return (() => { platformData.platformProjectService.deploy(device.deviceInfo.identifier).wait(); diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index 0951f4de4e..781b455d22 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -162,11 +162,7 @@ export class PluginsService implements IPluginsService { let packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath()).wait(); let allDependencies = _.keys(packageJsonContent.dependencies).concat(_.keys(packageJsonContent.devDependencies)); if(this.$options.force || _.difference(allDependencies, installedDependencies).length) { - let command = "npm install "; - if(this.$options.ignoreScripts) { - command += "--ignore-scripts"; - } - this.$childProcess.exec(command, { cwd: this.$projectData.projectDir }).wait(); + this.$npm.install(this.$projectData.projectDir, this.$projectData.projectDir, { "ignore-scripts": this.$options.ignoreScripts }).wait(); } }).future()(); } diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 321eab9f0f..a478bb462b 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -217,6 +217,14 @@ export class IOSUsbLiveSyncService implements IiOSUsbLiveSyncService { return this.$iOSEmulatorServices.postDarwinNotification(this.$iOSNotification.attachRequest); } + public removeFile(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture { + return (() => { + _.each(localToDevicePaths, localToDevicePathData => { + this.device.fileSystem.deleteFile(localToDevicePathData.getDevicePath(), appIdentifier); + }); + }).future()(); + } + private sendPageReloadMessage(socket: net.Socket): void { try { this.sendPageReloadMessageCore(socket); @@ -265,7 +273,7 @@ export class AndroidUsbLiveSyncService extends androidLiveSyncServiceLib.Android public beforeLiveSyncAction(deviceAppData: Mobile.IDeviceAppData): IFuture { return (() => { - let deviceRootPath = `/data/local/tmp/${deviceAppData.appIdentifier}`; + let deviceRootPath = this.getDeviceRootPath(deviceAppData.appIdentifier); this.device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, "fullsync"), this.$mobileHelper.buildDevicePath(deviceRootPath, "sync"), this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync")]).wait(); @@ -279,6 +287,21 @@ export class AndroidUsbLiveSyncService extends androidLiveSyncServiceLib.Android }).future()(); } + public removeFile(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture { + return (() => { + let deviceRootPath = this.getDeviceRootPath(appIdentifier); + _.each(localToDevicePaths, localToDevicePathData => { + let relativeUnixPath = _.trimLeft(helpers.fromWindowsRelativePathToUnix(localToDevicePathData.getRelativeToProjectBasePath()), "/"); + let deviceFilePath = this.$mobileHelper.buildDevicePath(deviceRootPath, "removedsync", relativeUnixPath); + this.device.adb.executeShellCommand(["mkdir", "-p", path.dirname(deviceFilePath), "&&", "touch", deviceFilePath]).wait(); + }); + }).future()(); + } + + private getDeviceRootPath(appIdentifier: string): string { + return `/data/local/tmp/${appIdentifier}`; + } + private sendPageReloadMessage(): IFuture { let future = new Future(); diff --git a/lib/tools/broccoli/node-modules-dest-copy.ts b/lib/tools/broccoli/node-modules-dest-copy.ts index 302e306498..d30e845cba 100644 --- a/lib/tools/broccoli/node-modules-dest-copy.ts +++ b/lib/tools/broccoli/node-modules-dest-copy.ts @@ -7,6 +7,8 @@ import * as semver from "semver"; import * as shelljs from "shelljs"; import {wrapBroccoliPlugin} from './broccoli-plugin-wrapper-factory'; import * as constants from "../../constants"; +import * as minimatch from "minimatch"; +import Future = require("fibers/future"); /** * Intercepts each directory as it is copied to the destination tempdir, @@ -79,6 +81,12 @@ export class DestCopy implements IBroccoliPlugin { if (dependency.name === constants.TNS_CORE_MODULES_NAME) { let tnsCoreModulesResourcePath = path.join(this.outputRoot, constants.TNS_CORE_MODULES_NAME); + + // Remove .ts files + let allFiles = this.$fs.enumerateFilesInDirectorySync(tnsCoreModulesResourcePath); + let deleteFilesFutures = allFiles.filter(file => minimatch(file, "**/*.ts", {nocase: true})).map(file => this.$fs.deleteFile(file)); + Future.wait(deleteFilesFutures); + shelljs.cp("-Rf", path.join(tnsCoreModulesResourcePath, "*"), this.outputRoot); this.$fs.deleteDirectory(tnsCoreModulesResourcePath).wait(); }