Class CommonBuilder


  • public class CommonBuilder
    extends java.lang.Object
    Static class for common builder routines.
    Author:
    Christopher Mindus
    • Field Detail

      • DEBUG

        public static boolean DEBUG
        Debug.
      • VERBOSE

        public static boolean VERBOSE
        Verbose mode.npm
      • ANDROID_SDK_MINIMUM

        public static final java.lang.String ANDROID_SDK_MINIMUM
        Android SDK minimum and targets.
        See Also:
        Constant Field Values
      • ANDROID_SDK_TARGET

        public static final java.lang.String ANDROID_SDK_TARGET
        See Also:
        Constant Field Values
      • cordova_plugin_file

        public static final java.lang.String cordova_plugin_file
        Cordova plugin versions.
        See Also:
        Constant Field Values
      • cordova_plugin_file_transfer

        public static final java.lang.String cordova_plugin_file_transfer
        See Also:
        Constant Field Values
      • cordova_plugin_battery_status

        public static final java.lang.String cordova_plugin_battery_status
        See Also:
        Constant Field Values
      • cordova_plugin_camera

        public static final java.lang.String cordova_plugin_camera
        See Also:
        Constant Field Values
      • cordova_plugin_console

        public static final java.lang.String cordova_plugin_console
        See Also:
        Constant Field Values
      • cordova_plugin_contacts

        public static final java.lang.String cordova_plugin_contacts
        See Also:
        Constant Field Values
      • cordova_plugin_device

        public static final java.lang.String cordova_plugin_device
        See Also:
        Constant Field Values
      • cordova_plugin_dialogs

        public static final java.lang.String cordova_plugin_dialogs
        See Also:
        Constant Field Values
      • cordova_plugin_geolocation

        public static final java.lang.String cordova_plugin_geolocation
        See Also:
        Constant Field Values
      • cordova_plugin_inappbrowser

        public static final java.lang.String cordova_plugin_inappbrowser
        See Also:
        Constant Field Values
      • cordova_plugin_media

        public static final java.lang.String cordova_plugin_media
        See Also:
        Constant Field Values
      • cordova_plugin_media_capture

        public static final java.lang.String cordova_plugin_media_capture
        See Also:
        Constant Field Values
      • cordova_plugin_network_information

        public static final java.lang.String cordova_plugin_network_information
        See Also:
        Constant Field Values
      • cordova_plugin_splashscreen

        public static final java.lang.String cordova_plugin_splashscreen
        See Also:
        Constant Field Values
      • cordova_plugin_statusbar

        public static final java.lang.String cordova_plugin_statusbar
        See Also:
        Constant Field Values
      • cordova_plugin_vibration

        public static final java.lang.String cordova_plugin_vibration
        See Also:
        Constant Field Values
      • cordova_plugin_whitelist

        public static final java.lang.String cordova_plugin_whitelist
        See Also:
        Constant Field Values
      • cordova_plugin_screen_orientation

        public static final java.lang.String cordova_plugin_screen_orientation
        See Also:
        Constant Field Values
      • cordova_plugin_android_fingerprint_auth

        public static final java.lang.String cordova_plugin_android_fingerprint_auth
        See Also:
        Constant Field Values
      • cordova_plugin_touch_id

        public static final java.lang.String cordova_plugin_touch_id
        See Also:
        Constant Field Values
      • cordova_plugin_firebase

        public static final java.lang.String cordova_plugin_firebase
        See Also:
        Constant Field Values
      • cordova_plugin_mauron85_background_geolocation

        public static final java.lang.String cordova_plugin_mauron85_background_geolocation
        See Also:
        Constant Field Values
      • cordova_plugin_customurlscheme

        public static final java.lang.String cordova_plugin_customurlscheme
        See Also:
        Constant Field Values
      • cordova_custom_config

        public static final java.lang.String cordova_custom_config
        See Also:
        Constant Field Values
      • textVariablesMap

        public static final java.util.Map<java.lang.String,​java.lang.String> textVariablesMap
        The required variables in the text file in an unmutable map.
      • APP_DIR_NAME

        public static final java.lang.String APP_DIR_NAME
        Name of the "app" directory below the OS directory of the build machine.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CommonBuilder

        public CommonBuilder​(RuntimeBuilderSettings settings,
                             IPropProgressMonitor monitor,
                             ICommonJobCreator jobCreator,
                             IPrintAdapter printer,
                             boolean isVerbose)
                      throws java.io.IOException
        Constructor with the build settings.
        Parameters:
        settings - The build settings.
        monitor - The progress monitor.
        jobCreator - The Job creator.
        printer - Print redirector for e.g. console in Eclipse.
        isVerbose - If the build should be verbose or not.
        Throws:
        java.io.IOException - For I/O errors.
      • CommonBuilder

        public CommonBuilder​(BuildEnvironment environment,
                             RuntimeBuilderSettings settings,
                             java.io.File buildOutputDir,
                             int uniqueID,
                             IPropProgressMonitor monitor,
                             ICommonJobCreator jobCreator,
                             IPrintAdapter printer)
        Constructor with the build settings.
        Parameters:
        settings - The build settings.
        buildOutputDir - Build output directory.
        uniqueID - A unique ID when building on the server for a client.
        monitor - The progress monitor.
        jobCreator - The Job creator.
        printer - Print redirector for e.g. console in Eclipse.
    • Method Detail

      • performCordovaBuild

        public static void performCordovaBuild​(RuntimeBuilderSettings settings,
                                               java.io.File outputDirForCommandPrompt,
                                               java.util.List<java.io.File> filesBuilt,
                                               boolean isVerbose)
        Performs the building of an Internal Cordova build.
        Parameters:
        settings - The builder settings.
        outputDirForCommandPrompt - Output directory.
        filesBuilt - The built files.
        isVerbose - If the job should be verbose or not.
      • openTerminalWindow

        public void openTerminalWindow​(java.io.File dir)
                                throws java.io.IOException,
                                       java.lang.InterruptedException
        Opens a terminal with bash or a command line window under Windows.
        Parameters:
        dir - Current directory.
        Throws:
        java.lang.InterruptedException
        java.io.IOException
      • getUploadsDirectory

        public java.io.File getUploadsDirectory()
                                         throws java.io.IOException
        Gets the directory where to store uploaded files for the remote builder.
        Throws:
        java.io.IOException
      • newJob

        protected ICommonJobs newJob​(int ticks,
                                     boolean isVerbose)
        Create new job.
        Parameters:
        ticks - Number of ticks for the job.
        isVerbose - If the job should be verbose or not.
      • getRemoteBuildCleanupDir

        public java.io.File getRemoteBuildCleanupDir()
        Returns the directory that eventually needs to be fully cleaned up in remote builds. Files may be locked when a build process has just terminated...
        Returns:
        null for none,7 otherwise the directory to clean up.
      • dispose

        public void dispose()
        Dispose: kills any ongoing process directly.
      • cleanupProcesses

        public java.lang.String cleanupProcesses​(boolean isVerbose)
        Cleans up after Android ADB and Gradle.
        Parameters:
        isVerbose - If the job should be verbose or not.
        Returns:
        Error return string, or null for success.
      • createApp

        public BuildReply createApp​(IPropProgressMonitor monitor,
                                    int ticks,
                                    CodeModifier codeModifier,
                                    java.util.List<java.io.File> filesBuilt,
                                    boolean isVerbose)
        Creates the application and builds it according to the BuildSettings.
        Parameters:
        monitor - Progress monitor, never null.
        ticks - The number of ticks for each build to take from the main progress monitor.
        codeModifier - The instance of the code modifier.
        filesBuilt - The list of files that have been built.
        isVerbose - If the job should be verbose or not.
        Returns:
        The build reply.