Class BuildEnvironment


  • public class BuildEnvironment
    extends java.lang.Object
    Class to build up the environment to use.
    Author:
    Christopher Mindus
    • Field Detail

      • isWindows

        public static final boolean isWindows
        Executable extension (".exe" for Windows, "" for the others).
      • isMac

        public static final boolean isMac
      • isLinux

        public static final boolean isLinux
      • sep

        public static final char sep
      • pathSep

        public static final char pathSep
      • EXE_EXT

        public static final java.lang.String EXE_EXT
      • BAT_EXT

        public static final java.lang.String BAT_EXT
      • CMD_EXT

        public static final java.lang.String CMD_EXT
      • output

        public final java.io.File output
        The "output" directory where all programs, etc, build output goes This is normally the "\iiziBuildInstall" directory.
      • homeDir

        public final java.io.File homeDir
        The home directory.
      • tempDir

        public final java.io.File tempDir
        The temporary directory for downloads, etc.
    • Constructor Detail

      • BuildEnvironment

        public BuildEnvironment​(java.io.File rootDir,
                                boolean doAndroid,
                                ICommonJobCreator jobCreator,
                                IPrintAdapter printer)
                         throws java.io.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.
        jobCreator - The job creator interface.
        printer - The printer for output.
        Throws:
        java.io.IOException - For I/O errors.
    • Method Detail

      • firstTrimmedLine

        public static java.lang.String firstTrimmedLine​(java.lang.String s)
        Gets the first line of the output.
        Parameters:
        s - The String of the result.
        Returns:
        The trimmed string.
      • getOutputDirectory

        public java.io.File getOutputDirectory()
        Gets the output directory.
      • getExternalProcessEnvironment

        public BuildReply getExternalProcessEnvironment​(java.util.Map<java.lang.String,​java.lang.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,
                                             boolean isVerbose)
        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.
        isVerbose - The verbose flag.
        Returns:
        The build reply.
      • initialize

        public BuildReply initialize​(boolean isVerbose)
        Initializes the environments: Node + NPM, Gradle, Android and Cordova.
        Parameters:
        isVerbose - The verbose flag.
        Returns:
        The build reply.
      • 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​(java.lang.String rootDirPath,
                                                   ICommonJobCreator jobCreator,
                                                   IPropProgressMonitor monitor,
                                                   IPrintAdapter printer,
                                                   boolean isVerbose)
                                            throws java.io.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.
        isVerbose - If the job should be verbose or not.
        Returns:
        The build environment instance.
        Throws:
        java.io.IOException - An IOException for failures.
      • main

        public static void main​(java.lang.String[] args)
        Performs the environment creation for debug purposes.