Skip to content

Commit dacbe9b

Browse files
committed
Check for devices before building the project
See #1167
1 parent 78835ec commit dacbe9b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/services/init-service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export class InitService implements IInitService {
1616
private _projectFilePath: string;
1717

1818
constructor(private $fs: IFileSystem,
19-
private $errors: IErrors,
2019
private $logger: ILogger,
2120
private $options: IOptions,
2221
private $injector: IInjector,

lib/services/platform-service.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ export class PlatformService implements IPlatformService {
335335
this.ensurePlatformInstalled(platform).wait();
336336
let platformData = this.$platformsData.getPlatformData(platform);
337337

338+
this.$devicesService.initialize({platform: platform, deviceId: this.$options.device}).wait();
339+
if (this.$devicesService.deviceCount < 1) {
340+
this.$errors.failWithoutHelp("Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.");
341+
}
342+
338343
let cachedDeviceOption = this.$options.forDevice;
339344
this.$options.forDevice = true;
340345
this.buildPlatform(platform, buildConfig).wait();
@@ -344,7 +349,6 @@ export class PlatformService implements IPlatformService {
344349
let packageFile = this.getLatestApplicationPackageForDevice(platformData).wait().packageName;
345350
this.$logger.out("Using ", packageFile);
346351

347-
this.$devicesService.initialize({platform: platform, deviceId: this.$options.device}).wait();
348352
let action = (device: Mobile.IDevice): IFuture<void> => {
349353
return (() => {
350354
platformData.platformProjectService.deploy(device.deviceInfo.identifier).wait();

0 commit comments

Comments
 (0)