Content-Length: 1392826 | pFad | http://github.com/NativeScript/nativescript-cli/commit/0bd7b7b0ae008dc2e98c60c3aa83a968d6c8c77d

49 Remove fibers · NativeScript/nativescript-cli@0bd7b7b · GitHub
Skip to content

Commit 0bd7b7b

Browse files
Dimitar KerezovTsvetanMilanov
Dimitar Kerezov
authored andcommitted
Remove fibers
This is a combination of 35 commits. Remove IFuture from function signatures - replace with async...Promise<T> Replace future wrapper in class-less functions Replace .wait with await Replace .wait with await vol 2 Replace .wait with await vol 3 Replace IFuture<T> with Promise<T> in .d.ts Replace Future.fromResult with async Mark IFuture functions without access modifiers as async Replace function..IFuture with async Promise ONE occurrence Mark execute functions as async...Promise<T> Mark lambdas as async Replace future.throw with reject Replace future.return with resolve Replace new Future with new Promise(resolve, reject) Revive lib/common Remove fibers from package.json Replace await return/await if with proper language Fix file in root of lib Fix lib/tools Fix lib/commands/plugin Fix lib/commands Fix files in lib/services up to test-execution-service.ts Fix all files in lib/providers Update package.json with required dependencies for testing. Fix tests from android-project-properties-manager to npm-support (inclusive) - all can be run successfully. Fix lib/device-sockets Fix test/platform-commands Fix services up until test-execution-service Fix test/platform-service Fix test/plugin-variables-service Fix test/lugins-service Fix test/project-commands Fix test/project-name-service Fix test/project-service test/project-templates-service Fix the rest of tests/ Fix error-reporting command
1 parent 385e249 commit 0bd7b7b

File tree

112 files changed

+5128
-5613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5128
-5613
lines changed

Diff for: lib/android-tools-info.ts

+179-205
Large diffs are not rendered by default.

Diff for: lib/commands/add-platform.ts

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
export class AddPlatformCommand implements ICommand {
2+
public allowedParameters: ICommandParameter[] = [];
3+
24
constructor(private $platformService: IPlatformService,
35
private $errors: IErrors) { }
46

5-
execute(args: string[]): IFuture<void> {
6-
return (() => {
7-
this.$platformService.addPlatforms(args).wait();
8-
}).future<void>()();
7+
public async execute(args: string[]): Promise<void> {
8+
await this.$platformService.addPlatforms(args);
99
}
1010

11-
allowedParameters: ICommandParameter[] = [];
12-
13-
canExecute(args: string[]): IFuture<boolean> {
14-
return (() => {
15-
if(!args || args.length === 0) {
16-
this.$errors.fail("No platform specified. Please specify a platform to add");
17-
}
11+
public async canExecute(args: string[]): Promise<boolean> {
12+
if (!args || args.length === 0) {
13+
this.$errors.fail("No platform specified. Please specify a platform to add");
14+
}
1815

19-
_.each(args, arg => this.$platformService.validatePlatform(arg));
16+
_.each(args, arg => this.$platformService.validatePlatform(arg));
2017

21-
return true;
22-
}).future<boolean>()();
18+
return true;
2319
}
2420
}
21+
2522
$injector.registerCommand("platform|add", AddPlatformCommand);

Diff for: lib/commands/appstore-list.ts

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
import { createTable } from "../common/helpers";
2-
import {StringCommandParameter} from "../common/command-params";
2+
import { StringCommandParameter } from "../common/command-params";
33

44
export class ListiOSApps implements ICommand {
5+
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
6+
57
constructor(private $injector: IInjector,
68
private $itmsTransporterService: IITMSTransporterService,
79
private $logger: ILogger,
810
private $prompter: IPrompter,
911
private $stringParameterBuilder: IStringParameterBuilder) { }
1012

11-
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
12-
13-
public execute(args: string[]): IFuture<void> {
14-
return (() => {
15-
let username = args[0],
16-
password = args[1];
13+
public async execute(args: string[]): Promise<void> {
14+
let username = args[0],
15+
password = args[1];
1716

18-
if(!username) {
19-
username = this.$prompter.getString("Apple ID", { allowEmpty: false }).wait();
20-
}
17+
if (!username) {
18+
username = await this.$prompter.getString("Apple ID", { allowEmpty: false });
19+
}
2120

22-
if(!password) {
23-
password = this.$prompter.getPassword("Apple ID password").wait();
24-
}
21+
if (!password) {
22+
password = await this.$prompter.getPassword("Apple ID password");
23+
}
2524

26-
let iOSApplications = this.$itmsTransporterService.getiOSApplications({username, password}).wait();
25+
let iOSApplications = await this.$itmsTransporterService.getiOSApplications({ username, password });
2726

28-
if (!iOSApplications || !iOSApplications.length) {
29-
this.$logger.out("Seems you don't have any applications yet.");
30-
} else {
31-
let table: any = createTable(["Application Name", "Bundle Identifier", "Version"], iOSApplications.map(element => {
32-
return [element.name, element.bundleId, element.version];
33-
}));
27+
if (!iOSApplications || !iOSApplications.length) {
28+
this.$logger.out("Seems you don't have any applications yet.");
29+
} else {
30+
let table: any = createTable(["Application Name", "Bundle Identifier", "Version"], iOSApplications.map(element => {
31+
return [element.name, element.bundleId, element.version];
32+
}));
3433

35-
this.$logger.out(table.toString());
36-
}
37-
}).future<void>()();
34+
this.$logger.out(table.toString());
35+
}
3836
}
3937
}
4038

Diff for: lib/commands/appstore-upload.ts

+73-76
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import {StringCommandParameter} from "../common/command-params";
1+
import { StringCommandParameter } from "../common/command-params";
22
import * as path from "path";
3-
import {IOSProjectService} from "../services/ios-project-service";
3+
import { IOSProjectService } from "../services/ios-project-service";
44

55
export class PublishIOS implements ICommand {
6+
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
7+
new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
8+
69
constructor(private $errors: IErrors,
710
private $fs: IFileSystem,
811
private $hostInfo: IHostInfo,
@@ -14,9 +17,6 @@ export class PublishIOS implements ICommand {
1417
private $stringParameterBuilder: IStringParameterBuilder,
1518
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants) { }
1619

17-
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
18-
new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
19-
2020
private get $platformsData(): IPlatformsData {
2121
return this.$injector.resolve("platformsData");
2222
}
@@ -27,81 +27,78 @@ export class PublishIOS implements ICommand {
2727
return this.$injector.resolve("platformService");
2828
}
2929

30-
public execute(args: string[]): IFuture<void> {
31-
return (() => {
32-
let username = args[0],
33-
password = args[1],
34-
mobileProvisionIdentifier = args[2],
35-
codeSignIdentity = args[3],
36-
teamID = this.$options.teamId,
37-
ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;
38-
39-
if(!username) {
40-
username = this.$prompter.getString("Apple ID", { allowEmpty: false }).wait();
41-
}
42-
43-
if(!password) {
44-
password = this.$prompter.getPassword("Apple ID password").wait();
45-
}
46-
47-
if(!mobileProvisionIdentifier && !ipaFilePath) {
48-
this.$logger.warn("No mobile provision identifier set. A default mobile provision will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
30+
public async execute(args: string[]): Promise<void> {
31+
let username = args[0],
32+
password = args[1],
33+
mobileProvisionIdentifier = args[2],
34+
codeSignIdentity = args[3],
35+
teamID = this.$options.teamId,
36+
ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;
37+
38+
if (!username) {
39+
username = await this.$prompter.getString("Apple ID", { allowEmpty: false });
40+
}
41+
42+
if (!password) {
43+
password = await this.$prompter.getPassword("Apple ID password");
44+
}
45+
46+
if (!mobileProvisionIdentifier && !ipaFilePath) {
47+
this.$logger.warn("No mobile provision identifier set. A default mobile provision will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
48+
}
49+
50+
if (!codeSignIdentity && !ipaFilePath) {
51+
this.$logger.warn("No code sign identity set. A default code sign identity will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
52+
}
53+
54+
this.$options.release = true;
55+
56+
if (!ipaFilePath) {
57+
let platform = this.$devicePlatformsConstants.iOS;
58+
// No .ipa path provided, build .ipa on out own.
59+
if (mobileProvisionIdentifier || codeSignIdentity) {
60+
let iOSBuildConfig: IiOSBuildConfig = {
61+
buildForDevice: true,
62+
mobileProvisionIdentifier,
63+
codeSignIdentity
64+
};
65+
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
66+
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
67+
await this.$platformService.preparePlatform(platform);
68+
await this.$platformService.buildPlatform(platform, iOSBuildConfig);
69+
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
70+
} else {
71+
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
72+
await this.$platformService.preparePlatform(platform);
73+
74+
let platformData = this.$platformsData.getPlatformData(platform);
75+
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;
76+
77+
let archivePath = await iOSProjectService.archive(platformData.projectRoot);
78+
this.$logger.info("Archive at: " + archivePath);
79+
80+
let exportPath = await iOSProjectService.exportArchive({ archivePath, teamID });
81+
this.$logger.info("Export at: " + exportPath);
82+
83+
ipaFilePath = exportPath;
4984
}
50-
51-
if(!codeSignIdentity && !ipaFilePath) {
52-
this.$logger.warn("No code sign identity set. A default code sign identity will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
53-
}
54-
55-
this.$options.release = true;
56-
57-
if (!ipaFilePath) {
58-
let platform = this.$devicePlatformsConstants.iOS;
59-
// No .ipa path provided, build .ipa on out own.
60-
if (mobileProvisionIdentifier || codeSignIdentity) {
61-
let iOSBuildConfig: IiOSBuildConfig = {
62-
buildForDevice: true,
63-
mobileProvisionIdentifier,
64-
codeSignIdentity
65-
};
66-
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
67-
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
68-
this.$platformService.preparePlatform(platform).wait();
69-
this.$platformService.buildPlatform(platform, iOSBuildConfig).wait();
70-
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
71-
} else {
72-
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
73-
this.$platformService.preparePlatform(platform).wait();
74-
75-
let platformData = this.$platformsData.getPlatformData(platform);
76-
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;
77-
78-
let archivePath = iOSProjectService.archive(platformData.projectRoot).wait();
79-
this.$logger.info("Archive at: " + archivePath);
80-
81-
let exportPath = iOSProjectService.exportArchive({ archivePath, teamID }).wait();
82-
this.$logger.info("Export at: " + exportPath);
83-
84-
ipaFilePath = exportPath;
85-
}
86-
}
87-
88-
this.$itmsTransporterService.upload({
89-
username,
90-
password,
91-
ipaFilePath,
92-
verboseLogging: this.$logger.getLevel() === "TRACE"
93-
}).wait();
94-
}).future<void>()();
85+
}
86+
87+
await this.$itmsTransporterService.upload({
88+
username,
89+
password,
90+
ipaFilePath,
91+
verboseLogging: this.$logger.getLevel() === "TRACE"
92+
});
9593
}
9694

97-
public canExecute(args: string[]): IFuture<boolean> {
98-
return (() => {
99-
if (!this.$hostInfo.isDarwin) {
100-
this.$errors.failWithoutHelp("This command is only available on Mac OS X.");
101-
}
95+
public async canExecute(args: string[]): Promise<boolean> {
96+
if (!this.$hostInfo.isDarwin) {
97+
this.$errors.failWithoutHelp("This command is only available on Mac OS X.");
98+
}
10299

103-
return true;
104-
}).future<boolean>()();
100+
return true;
105101
}
106102
}
103+
107104
$injector.registerCommand(["publish|ios", "appstore|upload"], PublishIOS);

Diff for: lib/commands/build.ts

+29-31
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,57 @@ export class BuildCommandBase {
33
protected $platformsData: IPlatformsData,
44
protected $platformService: IPlatformService) { }
55

6-
executeCore(args: string[]): IFuture<void> {
7-
return (() => {
8-
let platform = args[0].toLowerCase();
9-
this.$platformService.preparePlatform(platform).wait();
10-
this.$options.clean = true;
11-
this.$platformService.buildPlatform(platform).wait();
12-
if(this.$options.copyTo) {
13-
this.$platformService.copyLastOutput(platform, this.$options.copyTo, {isForDevice: this.$options.forDevice});
14-
}
15-
}).future<void>()();
6+
public async executeCore(args: string[]): Promise<void> {
7+
let platform = args[0].toLowerCase();
8+
await this.$platformService.preparePlatform(platform);
9+
this.$options.clean = true;
10+
await this.$platformService.buildPlatform(platform);
11+
if (this.$options.copyTo) {
12+
this.$platformService.copyLastOutput(platform, this.$options.copyTo, { isForDevice: this.$options.forDevice });
13+
}
1614
}
1715
}
1816

19-
export class BuildIosCommand extends BuildCommandBase implements ICommand {
17+
export class BuildIosCommand extends BuildCommandBase implements ICommand {
18+
public allowedParameters: ICommandParameter[] = [];
19+
2020
constructor(protected $options: IOptions,
21-
$platformsData: IPlatformsData,
22-
$platformService: IPlatformService) {
21+
$platformsData: IPlatformsData,
22+
$platformService: IPlatformService) {
2323
super($options, $platformsData, $platformService);
2424
}
2525

26-
public allowedParameters: ICommandParameter[] = [];
27-
28-
public execute(args: string[]): IFuture<void> {
26+
public async execute(args: string[]): Promise<void> {
2927
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
3028
}
3129

32-
public canExecute(args: string[]): IFuture<boolean> {
30+
public canExecute(args: string[]): Promise<boolean> {
3331
return this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
3432
}
3533
}
34+
3635
$injector.registerCommand("build|ios", BuildIosCommand);
3736

38-
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
37+
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
38+
public allowedParameters: ICommandParameter[] = [];
39+
3940
constructor(protected $options: IOptions,
40-
$platformsData: IPlatformsData,
41-
private $errors: IErrors,
42-
$platformService: IPlatformService) {
41+
$platformsData: IPlatformsData,
42+
private $errors: IErrors,
43+
$platformService: IPlatformService) {
4344
super($options, $platformsData, $platformService);
4445
}
4546

46-
public execute(args: string[]): IFuture<void> {
47+
public async execute(args: string[]): Promise<void> {
4748
return this.executeCore([this.$platformsData.availablePlatforms.Android]);
4849
}
4950

50-
public allowedParameters: ICommandParameter[] = [];
51-
52-
public canExecute(args: string[]): IFuture<boolean> {
53-
return (() => {
54-
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
55-
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
56-
}
57-
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
58-
}).future<boolean>()();
51+
public async canExecute(args: string[]): Promise<boolean> {
52+
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
53+
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
54+
}
55+
return args.length === 0 && await this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android);
5956
}
6057
}
58+
6159
$injector.registerCommand("build|android", BuildAndroidCommand);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/nativescript-cli/commit/0bd7b7b0ae008dc2e98c60c3aa83a968d6c8c77d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy