@bubblewrap/core
Version:
Core Library to generate, build and sign TWA projects
55 lines (54 loc) • 2 kB
TypeScript
import { Config } from '../Config';
import { Result } from '../Result';
import { ValidatePathError } from '../errors/ValidatePathError';
/**
* Helps getting information relevant to the JDK installed, including
* the approprite environment needed to run Java commands on the JDK
*/
export declare class JdkHelper {
private process;
private config;
private joinPath;
private pathSeparator;
private pathEnvironmentKey;
/**
* Constructs a new instance of JdkHelper.
*
* @param {NodeJS.Process} process information from the OS process
* @param {Config} config the bubblewrap general configuration
*/
constructor(process: NodeJS.Process, config: Config);
/**
* Runs the `java` command, passing args as parameters.
*/
runJava(args: string[]): Promise<{
stdout: string;
stderr: string;
}>;
/**
* Returns information from the JAVA_HOME, based on the config and platform.
*/
getJavaHome(): string;
/**
* Returns information from the JAVA_HOME, based on the config and platform.
* @param {Config} config The bubblewrap general configuration
* @param {NodeJS.Process} process Information from the OS process
*/
static getJavaHome(jdkPath: string, process: NodeJS.Process): string;
private static getJoinPath;
/**
* Checks if the given jdkPath is valid.
* @param {string} jdkPath the path to the jdk.
*/
static validatePath(jdkPath: string, currentProcess?: NodeJS.Process): Promise<Result<string, ValidatePathError>>;
/**
* Returns information from the Java executable location, based on the config and platform.
* @returns {string} the value where the Java executables can be found
*/
getJavaBin(): string;
/**
* Returns a copy of process.env, customized with the correct JAVA_HOME and PATH.
* @returns {NodeJS.ProcessEnv} an env object configure to run JDK commands
*/
getEnv(): NodeJS.ProcessEnv;
}