Skip to content

Add androidTypings experimental flag #2180

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 1 commit into from
Nov 7, 2016
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
5 changes: 5 additions & 0 deletions lib/android-tools-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
infoData.buildToolsVersion = this.getBuildToolsVersion().wait();
infoData.targetSdkVersion = this.getTargetSdk().wait();
infoData.supportRepositoryVersion = this.getAndroidSupportRepositoryVersion().wait();
infoData.generateTypings = this.shouldGenerateTypings();

this.toolsInfo = infoData;
}
Expand Down Expand Up @@ -196,6 +197,10 @@ export class AndroidToolsInfo implements IAndroidToolsInfo {
}).future<string>()();
}

private shouldGenerateTypings(): boolean {
return this.$options.androidTypings;
}

/**
* Prints messages on the screen. In case the showWarningsAsErrors flag is set to true, warnings are shown, else - errors.
* Uses logger.warn for warnings and errors.failWithoutHelp when erros must be shown.
Expand Down
6 changes: 6 additions & 0 deletions lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ interface IOptions extends ICommonOptions {
linkTo: string;
ng: boolean;
tsc: boolean;
androidTypings: boolean;
bundle: boolean;
platformTemplate: string;
port: Number;
Expand Down Expand Up @@ -224,6 +225,11 @@ interface IAndroidToolsInfoData {
* In case it is not specified, compileSdkVersion will be used for targetSdkVersion.
*/
targetSdkVersion: number;

/**
* Whether or not `.d.ts` typings should be generated for compileSdk. Experimental feature
*/
generateTypings: boolean;
}

interface ISocketProxyFactory {
Expand Down
25 changes: 13 additions & 12 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,35 @@ export class Options extends commonOptionsLibPath.OptionsBase {
framework: { type: OptionType.String },
frameworkVersion: { type: OptionType.String },
copyFrom: { type: OptionType.String },
linkTo: { type: OptionType.String },
linkTo: { type: OptionType.String },
symlink: { type: OptionType.Boolean },
forDevice: { type: OptionType.Boolean },
client: { type: OptionType.Boolean, default: true},
client: { type: OptionType.Boolean, default: true },
production: { type: OptionType.Boolean },
debugTransport: {type: OptionType.Boolean},
debugTransport: { type: OptionType.Boolean },
keyStorePath: { type: OptionType.String },
keyStorePassword: { type: OptionType.String,},
keyStorePassword: { type: OptionType.String, },
keyStoreAlias: { type: OptionType.String },
keyStoreAliasPassword: { type: OptionType.String },
ignoreScripts: {type: OptionType.Boolean },
disableNpmInstall: {type: OptionType.Boolean },
ignoreScripts: { type: OptionType.Boolean },
disableNpmInstall: { type: OptionType.Boolean },
tnsModulesVersion: { type: OptionType.String },
compileSdk: {type: OptionType.Number },
compileSdk: { type: OptionType.Number },
port: { type: OptionType.Number },
copyTo: { type: OptionType.String },
baseConfig: { type: OptionType.String },
platformTemplate: { type: OptionType.String },
ng: {type: OptionType.Boolean },
tsc: {type: OptionType.Boolean },
bundle: {type: OptionType.Boolean },
all: {type: OptionType.Boolean },
ng: { type: OptionType.Boolean },
tsc: { type: OptionType.Boolean },
androidTypings: { type: OptionType.Boolean },
bundle: { type: OptionType.Boolean },
all: { type: OptionType.Boolean },
teamId: { type: OptionType.String },
rebuild: { type: OptionType.Boolean, default: true },
syncAllFiles: { type: OptionType.Boolean },
liveEdit: { type: OptionType.Boolean }
},
path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
$errors, $staticConfig);

// On Windows we moved settings from LocalAppData to AppData. Move the existing file to keep the existing settings
Expand Down
2 changes: 2 additions & 0 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
let targetSdk = this.getTargetFromAndroidManifest().wait() || compileSdk;
let buildToolsVersion = androidToolsInfo.buildToolsVersion;
let appCompatVersion = androidToolsInfo.supportRepositoryVersion;
let generateTypings = androidToolsInfo.generateTypings;
let buildOptions = [
`-PcompileSdk=android-${compileSdk}`,
`-PtargetSdk=${targetSdk}`,
`-PbuildToolsVersion=${buildToolsVersion}`,
`-PsupportVersion=${appCompatVersion}`,
`-PgenerateTypings=${generateTypings}`
];

if (this.$options.release) {
Expand Down