Skip to content

Remove fibers #2411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
384 changes: 179 additions & 205 deletions lib/android-tools-info.ts

Large diffs are not rendered by default.

25 changes: 11 additions & 14 deletions lib/commands/add-platform.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
export class AddPlatformCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];

constructor(private $platformService: IPlatformService,
private $errors: IErrors) { }

execute(args: string[]): IFuture<void> {
return (() => {
this.$platformService.addPlatforms(args).wait();
}).future<void>()();
public async execute(args: string[]): Promise<void> {
await this.$platformService.addPlatforms(args);
}

allowedParameters: ICommandParameter[] = [];

canExecute(args: string[]): IFuture<boolean> {
return (() => {
if(!args || args.length === 0) {
this.$errors.fail("No platform specified. Please specify a platform to add");
}
public async canExecute(args: string[]): Promise<boolean> {
if (!args || args.length === 0) {
this.$errors.fail("No platform specified. Please specify a platform to add");
}

_.each(args, arg => this.$platformService.validatePlatform(arg));
_.each(args, arg => this.$platformService.validatePlatform(arg));

return true;
}).future<boolean>()();
return true;
}
}

$injector.registerCommand("platform|add", AddPlatformCommand);
47 changes: 22 additions & 25 deletions lib/commands/appstore-list.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
import { createTable } from "../common/helpers";
import {StringCommandParameter} from "../common/command-params";
import { StringCommandParameter } from "../common/command-params";

export class ListiOSApps implements ICommand {
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];

constructor(private $injector: IInjector,
private $itmsTransporterService: IITMSTransporterService,
private $logger: ILogger,
private $prompter: IPrompter,
private $stringParameterBuilder: IStringParameterBuilder) { }

public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
private $prompter: IPrompter) { }

public execute(args: string[]): IFuture<void> {
return (() => {
let username = args[0],
password = args[1];
public async execute(args: string[]): Promise<void> {
let username = args[0],
password = args[1];

if(!username) {
username = this.$prompter.getString("Apple ID", { allowEmpty: false }).wait();
}
if (!username) {
username = await this.$prompter.getString("Apple ID", { allowEmpty: false });
}

if(!password) {
password = this.$prompter.getPassword("Apple ID password").wait();
}
if (!password) {
password = await this.$prompter.getPassword("Apple ID password");
}

let iOSApplications = this.$itmsTransporterService.getiOSApplications({username, password}).wait();
let iOSApplications = await this.$itmsTransporterService.getiOSApplications({ username, password });

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

this.$logger.out(table.toString());
}
}).future<void>()();
this.$logger.out(table.toString());
}
}
}

Expand Down
151 changes: 73 additions & 78 deletions lib/commands/appstore-upload.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import {StringCommandParameter} from "../common/command-params";
import { StringCommandParameter } from "../common/command-params";
import * as path from "path";
import {IOSProjectService} from "../services/ios-project-service";
import { IOSProjectService } from "../services/ios-project-service";

export class PublishIOS implements ICommand {
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];

constructor(private $errors: IErrors,
private $fs: IFileSystem,
private $hostInfo: IHostInfo,
private $injector: IInjector,
private $itmsTransporterService: IITMSTransporterService,
private $logger: ILogger,
private $options: IOptions,
private $prompter: IPrompter,
private $stringParameterBuilder: IStringParameterBuilder,
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants) { }

public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];

private get $platformsData(): IPlatformsData {
return this.$injector.resolve("platformsData");
}
Expand All @@ -27,81 +25,78 @@ export class PublishIOS implements ICommand {
return this.$injector.resolve("platformService");
}

public execute(args: string[]): IFuture<void> {
return (() => {
let username = args[0],
password = args[1],
mobileProvisionIdentifier = args[2],
codeSignIdentity = args[3],
teamID = this.$options.teamId,
ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;

if(!username) {
username = this.$prompter.getString("Apple ID", { allowEmpty: false }).wait();
}

if(!password) {
password = this.$prompter.getPassword("Apple ID password").wait();
}

if(!mobileProvisionIdentifier && !ipaFilePath) {
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");
public async execute(args: string[]): Promise<void> {
let username = args[0],
password = args[1],
mobileProvisionIdentifier = args[2],
codeSignIdentity = args[3],
teamID = this.$options.teamId,
ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;

if (!username) {
username = await this.$prompter.getString("Apple ID", { allowEmpty: false });
}

if (!password) {
password = await this.$prompter.getPassword("Apple ID password");
}

if (!mobileProvisionIdentifier && !ipaFilePath) {
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");
}

if (!codeSignIdentity && !ipaFilePath) {
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");
}

this.$options.release = true;

if (!ipaFilePath) {
let platform = this.$devicePlatformsConstants.iOS;
// No .ipa path provided, build .ipa on out own.
if (mobileProvisionIdentifier || codeSignIdentity) {
let iOSBuildConfig: IiOSBuildConfig = {
buildForDevice: true,
mobileProvisionIdentifier,
codeSignIdentity
};
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
await this.$platformService.preparePlatform(platform);
await this.$platformService.buildPlatform(platform, iOSBuildConfig);
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
} else {
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.");
await this.$platformService.preparePlatform(platform);

let platformData = this.$platformsData.getPlatformData(platform);
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;

let archivePath = await iOSProjectService.archive(platformData.projectRoot);
this.$logger.info("Archive at: " + archivePath);

let exportPath = await iOSProjectService.exportArchive({ archivePath, teamID });
this.$logger.info("Export at: " + exportPath);

ipaFilePath = exportPath;
}

if(!codeSignIdentity && !ipaFilePath) {
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");
}

this.$options.release = true;

if (!ipaFilePath) {
let platform = this.$devicePlatformsConstants.iOS;
// No .ipa path provided, build .ipa on out own.
if (mobileProvisionIdentifier || codeSignIdentity) {
let iOSBuildConfig: IiOSBuildConfig = {
buildForDevice: true,
mobileProvisionIdentifier,
codeSignIdentity
};
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
this.$platformService.preparePlatform(platform).wait();
this.$platformService.buildPlatform(platform, iOSBuildConfig).wait();
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
} else {
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.");
this.$platformService.preparePlatform(platform).wait();

let platformData = this.$platformsData.getPlatformData(platform);
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;

let archivePath = iOSProjectService.archive(platformData.projectRoot).wait();
this.$logger.info("Archive at: " + archivePath);

let exportPath = iOSProjectService.exportArchive({ archivePath, teamID }).wait();
this.$logger.info("Export at: " + exportPath);

ipaFilePath = exportPath;
}
}

this.$itmsTransporterService.upload({
username,
password,
ipaFilePath,
verboseLogging: this.$logger.getLevel() === "TRACE"
}).wait();
}).future<void>()();
}

await this.$itmsTransporterService.upload({
username,
password,
ipaFilePath,
verboseLogging: this.$logger.getLevel() === "TRACE"
});
}

public canExecute(args: string[]): IFuture<boolean> {
return (() => {
if (!this.$hostInfo.isDarwin) {
this.$errors.failWithoutHelp("This command is only available on Mac OS X.");
}
public async canExecute(args: string[]): Promise<boolean> {
if (!this.$hostInfo.isDarwin) {
this.$errors.failWithoutHelp("This command is only available on Mac OS X.");
}

return true;
}).future<boolean>()();
return true;
}
}

$injector.registerCommand(["publish|ios", "appstore|upload"], PublishIOS);
64 changes: 30 additions & 34 deletions lib/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,57 @@ export class BuildCommandBase {
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>()();
public async executeCore(args: string[]): Promise<void> {
let platform = args[0].toLowerCase();
await this.$platformService.preparePlatform(platform);
this.$options.clean = true;
await this.$platformService.buildPlatform(platform);
if (this.$options.copyTo) {
this.$platformService.copyLastOutput(platform, this.$options.copyTo, { isForDevice: this.$options.forDevice });
}
}
}

export class BuildIosCommand extends BuildCommandBase implements ICommand {
export class BuildIosCommand extends BuildCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];

constructor(protected $options: IOptions,
$platformsData: IPlatformsData,
$platformService: IPlatformService) {
$platformsData: IPlatformsData,
$platformService: IPlatformService) {
super($options, $platformsData, $platformService);
}

public allowedParameters: ICommandParameter[] = [];

public execute(args: string[]): IFuture<void> {
public async execute(args: string[]): Promise<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}

public canExecute(args: string[]): IFuture<boolean> {
return (() => {
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS).wait();
}).future<boolean>()();
public canExecute(args: string[]): Promise<boolean> {
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
}
}

$injector.registerCommand("build|ios", BuildIosCommand);

export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];

constructor(protected $options: IOptions,
$platformsData: IPlatformsData,
private $errors: IErrors,
$platformService: IPlatformService) {
$platformsData: IPlatformsData,
private $errors: IErrors,
$platformService: IPlatformService) {
super($options, $platformsData, $platformService);
}

public execute(args: string[]): IFuture<void> {
public async execute(args: string[]): Promise<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>()();
public async canExecute(args: string[]): Promise<boolean> {
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 && await this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android);
}
}

$injector.registerCommand("build|android", BuildAndroidCommand);
Loading