UNPKG

@bubblewrap/core

Version:

Core Library to generate, build and sign TWA projects

87 lines (86 loc) 3.63 kB
import { Config } from '../Config'; import { JdkHelper } from '../jdk/JdkHelper'; import { Log } from '../../lib/Log'; import { Result } from '../../lib/Result'; import { ValidatePathError } from '../errors/ValidatePathError'; export declare const BUILD_TOOLS_VERSION = "34.0.0"; /** * Wraps functionality of the Android SDK Tools and allows them to be invoked programatically. */ export declare class AndroidSdkTools { readonly log: Log; private process; private config; private jdkHelper; private pathJoin; static create(process: NodeJS.Process, config: Config, jdkHelper: JdkHelper, log?: Log): Promise<AndroidSdkTools>; /** * Constructs a new instance of AndroidSdkTools. * * @param {NodeJS.Process} process information from the OS process * @param {Config} config the bubblewrap general configuration * @param {jdkHelper} jdkHelper the JDK information to be used by the Android SDK */ constructor(process: NodeJS.Process, config: Config, jdkHelper: JdkHelper, log?: Log); /** * Installs the build tools into the the Android SDK. Equivalent to running * * `tools/bin/sdkmanager --install "build-tools;29.0.2"` */ installBuildTools(): Promise<void>; /** * Verifies if the build-tools are installed on the Android SDK. */ checkBuildTools(): Promise<boolean>; /** * Returns the path to the Android SDK. * @returns {string} the path to the Android SDK. */ getAndroidHome(): string; /** * Creates a Node Process with the correct ANDROID_HOME information * @returns {NodeJS.ProcessEnv} the env with ANDROID_HOME set */ getEnv(): NodeJS.ProcessEnv; /** * Invokes the zipalign tool from the Android SDK with the following flags: * -f : overwrite existing outfile.zip. * -v : verbose output. * -p 4 : align all libraries to the 32-bit page boundary. * More information on zipalign can be found here: * https://developer.android.com/studio/command-line/zipalign * @param {string} input path to the input file. * @param {string} output path to the output file. */ zipalign(input: string, output: string): Promise<void>; /** * Invokes the zipalign tool from the Android SDK with the following flags: * -c : confirm the alignment of the given file. * -v : verbose output. * -p 4 : align all libraries to the 32-bit page boundary. * More information on zipalign can be found here: * https://developer.android.com/studio/command-line/zipalign * @param {string} input path to the input file. */ zipalignOnlyVerification(input: string): Promise<void>; /** * Signs an Android APK, with they keystore * @param {string} keystore path to the keystore * @param {string} ksPass keystore password * @param {string} alias key alias * @param {string} keyPass key password * @param {string} input path to the input APK file * @param {string} output path where the signed APK will be generated */ apksigner(keystore: string, ksPass: string, alias: string, keyPass: string, input: string, output: string): Promise<void>; /** * Installs an APK on an a device connected to the computer. * @param apkFilePath the path to the APK to be installed */ install(apkFilePath: string, passthroughArgs?: string[]): Promise<void>; /** * Checks if `sdkPath` is valid. * @param {string} sdkPath the path to the sdk. */ static validatePath(sdkPath: string): Promise<Result<string, ValidatePathError>>; }