-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathbuild.ts
61 lines (52 loc) · 2.24 KB
/
build.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
export class BuildCommandBase {
constructor(protected $options: IOptions,
protected $platformsData: IPlatformsData,
protected $platformService: IPlatformService) { }
executeCore(args: string[]): IFuture<void> {
return (() => {
let platform = args[0].toLowerCase();
this.$platformService.preparePlatform(platform).wait();
this.$options.clean = true;
this.$platformService.buildPlatform(platform).wait();
if(this.$options.copyTo) {
this.$platformService.copyLastOutput(platform, this.$options.copyTo, {isForDevice: this.$options.forDevice});
}
}).future<void>()();
}
}
export class BuildIosCommand extends BuildCommandBase implements ICommand {
constructor(protected $options: IOptions,
$platformsData: IPlatformsData,
$platformService: IPlatformService) {
super($options, $platformsData, $platformService);
}
public allowedParameters: ICommandParameter[] = [];
public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}
public canExecute(args: string[]): IFuture<boolean> {
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
}
}
$injector.registerCommand("build|ios", BuildIosCommand);
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
constructor(protected $options: IOptions,
$platformsData: IPlatformsData,
private $errors: IErrors,
$platformService: IPlatformService) {
super($options, $platformsData, $platformService);
}
public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.Android]);
}
public allowedParameters: ICommandParameter[] = [];
public canExecute(args: string[]): IFuture<boolean> {
return (() => {
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
}
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
}).future<boolean>()();
}
}
$injector.registerCommand("build|android", BuildAndroidCommand);