Skip to content

Commit

Permalink
Check for devices before building the project
Browse files Browse the repository at this point in the history
See #1167
  • Loading branch information
teobugslayer committed Nov 16, 2015
1 parent 9e372a8 commit cae6c99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/services/init-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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<void> => {
return (() => {
platformData.platformProjectService.deploy(device.deviceInfo.identifier).wait();
Expand Down

0 comments on commit cae6c99

Please sign in to comment.