diff --git a/lib/android-tools-info.ts b/lib/android-tools-info.ts index 82bafc90b6..c503601eb2 100644 --- a/lib/android-tools-info.ts +++ b/lib/android-tools-info.ts @@ -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; } @@ -196,6 +197,10 @@ export class AndroidToolsInfo implements IAndroidToolsInfo { }).future()(); } + 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. diff --git a/lib/declarations.ts b/lib/declarations.ts index bfc22329fc..9d232019b0 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -91,6 +91,7 @@ interface IOptions extends ICommonOptions { linkTo: string; ng: boolean; tsc: boolean; + androidTypings: boolean; bundle: boolean; platformTemplate: string; port: Number; @@ -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 { diff --git a/lib/options.ts b/lib/options.ts index ae7097b7fd..3c7286251b 100644 --- a/lib/options.ts +++ b/lib/options.ts @@ -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 diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index a01a793f9a..13e4fd8a25 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -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) {