Package com.iizix.run.common
Class BuildEnvironment
java.lang.Object
com.iizix.run.common.BuildEnvironment
Class to build up the environment to use.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
final File
The home directory.static final boolean
static final boolean
static final boolean
static final boolean
static final boolean
Executable extension (".exe" for Windows, "" for the others).final File
The "output" directory where all programs, etc, build output goes This is normally the "\iiziBuildInstall" directory.static final char
static final char
final File
The temporary directory for downloads, etc.Constructor Summary
ConstructorDescriptionBuildEnvironment
(File rootDir, boolean doAndroid, boolean doIOS, ICommonJobCreator jobCreator, IPrintAdapter printer) Constructor verifies presence of required directories.Method Summary
Modifier and TypeMethodDescriptioncheckAndroidEnvironment
(IPropProgressMonitor monitor, IPrintAdapter printer, boolean isVerbose) Checks the Android environment and build tools.getExternalProcessEnvironment
(Map<String, String> returnEnv, boolean logEnvironment) Gets the "real" environment to use for processes where some of the original environment is inherited, but "not too much".static BuildEnvironment
getInstance
(String rootDirPath, ICommonJobCreator jobCreator, IPropProgressMonitor monitor, IPrintAdapter printer, boolean doAndroid, boolean doIOS, boolean isVerbose) Constructs the environment from the path specified from the root of the current drive in Windows, or from the HOME directory under Mac or Linux.getJavaEnvironment
(RuntimeBuilderSettings settings, ICommonJobCreator jobCreator, IPropProgressMonitor monitor, boolean isVerbose) Retrieves the Java environment.Gets the output directory.static String
Gets the first line of the output that contains a version number from a command line such as e.g.getVersions
(IPropProgressMonitor monitor, IPrintAdapter printer, boolean isVerbose) Gets the versions: Node + NPM, Gradle, Android and Cordova.initialize
(boolean isVerbose) Initializes the environments: Node + NPM, Gradle, Android and Cordova.static void
Performs the environment creation for debug purposes.
Field Details
isWindows
public static final boolean isWindowsExecutable extension (".exe" for Windows, "" for the others).isMac
public static final boolean isMacisLinux
public static final boolean isLinuxisAArch64
public static final boolean isAArch64isARM64
public static final boolean isARM64sep
public static final char seppathSep
public static final char pathSepEXE_EXT
BAT_EXT
CMD_EXT
output
The "output" directory where all programs, etc, build output goes This is normally the "\iiziBuildInstall" directory.homeDir
The home directory.tempDir
The temporary directory for downloads, etc.
Constructor Details
BuildEnvironment
public BuildEnvironment(File rootDir, boolean doAndroid, boolean doIOS, ICommonJobCreator jobCreator, IPrintAdapter printer) throws IOException Constructor verifies presence of required directories.- Parameters:
rootDir
- The tools root directory where OS directories with Node, NPM, Android, etc, is located, null for default.doAndroid
- Flag to enable Android building.doIOS
- Flag to enable iOS building (ignored if not on macOS).jobCreator
- The job creator interface.printer
- The printer for output.- Throws:
IOException
- For I/O errors.
Method Details
getVersionFromCommand
Gets the first line of the output that contains a version number from a command line such as e.g. "node -version".- Parameters:
s
- The String of the result of the program execution stdout.- Returns:
- The trimmed string as version string, or "n/a?" if not found, a potential prefix of 'v' is skipped.
getOutputDirectory
Gets the output directory.getExternalProcessEnvironment
public BuildReply getExternalProcessEnvironment(Map<String, String> returnEnv, boolean logEnvironment) Gets the "real" environment to use for processes where some of the original environment is inherited, but "not too much".- Parameters:
returnEnv
- The environment to use is filled in (not cleared).logEnvironment
- Logs the environment as informational to the system log.- Returns:
- The build reply.
getJavaEnvironment
public BuildReply getJavaEnvironment(RuntimeBuilderSettings settings, ICommonJobCreator jobCreator, IPropProgressMonitor monitor, boolean isVerbose) throws IOException Retrieves the Java environment.- Parameters:
settings
- Settings to use if it specified the JDK environment. If null or the JDK settings are not defined, this environment is attempted to be used.jobCreator
- A job creator, null if not inside Eclipse.monitor
- A progress monitor that will have 5 ticks taken from it, or null for none.isVerbose
- The verbose flag.- Returns:
- The build reply.
- Throws:
IOException
- For I/O errors.
initialize
Initializes the environments: Node + NPM, Gradle, Android and Cordova.- Parameters:
isVerbose
- The verbose flag.- Returns:
- The build reply.
- Throws:
IOException
- For I/O errors.
getVersions
public BuildReply getVersions(IPropProgressMonitor monitor, IPrintAdapter printer, boolean isVerbose) Gets the versions: Node + NPM, Gradle, Android and Cordova. The monitor should be configured for 5 ticks.- Parameters:
monitor
- The monitor to use, null for non-Eclipse processes.printer
- The console printer.isVerbose
- If the job should be verbose or not.- Returns:
- The build reply.
checkAndroidEnvironment
public BuildReply checkAndroidEnvironment(IPropProgressMonitor monitor, IPrintAdapter printer, boolean isVerbose) Checks the Android environment and build tools.The progress monitor should be configured to 4 ticks and only be called if Android build is required.
- Parameters:
monitor
- The monitor to use, null for non-Eclipse processes.printer
- The console printer.isVerbose
- If the job should be verbose or not.- Returns:
- The build reply.
getInstance
public static BuildEnvironment getInstance(String rootDirPath, ICommonJobCreator jobCreator, IPropProgressMonitor monitor, IPrintAdapter printer, boolean doAndroid, boolean doIOS, boolean isVerbose) throws IOException Constructs the environment from the path specified from the root of the current drive in Windows, or from the HOME directory under Mac or Linux.- Parameters:
rootDirPath
- If unspecified (null), "iiziBuildInstall" is used, otherwise the path specified. Do not specify the OS such as "windows", "mac" or "linux".jobCreator
- A job creator, null if not inside Eclipse.monitor
- A progress monitor that will have 5 ticks taken from it, or null for none.printer
- A printer for redirected output, null for none.doAndroid
- Flag to enable building for Android.doIOS
- Flag to enable building for iOS (ignored if not using macOS).isVerbose
- If the job should be verbose or not.- Returns:
- The build environment instance.
- Throws:
IOException
- An IOException for failures.
main
Performs the environment creation for debug purposes.- Parameters:
args
- The arguments of the command line (ignored).