static ArrayList build()

in src/main/groovy/com/epam/atg/gradle/assemble/RunAssemblerCommandLineBuilder.groovy [61:184]


    static ArrayList<String> build(RunAssemblerTask assembler) {

        List<String> arguments = new ArrayList<String>()

        //Add options (optional)
        OptionsContainer options = assembler.options
        if (options.pack) {
            arguments << PACK
        }
        if (options.standalone) {
            arguments << STANDALONE
        }
        if (options.overwrite) {
            arguments << OVERWRITE
        }
        if (options.collapseClassPath) {
            arguments << COLLAPSE_CLASS_PATH
        }
        if (options.collapseExcludeDirs) {
            arguments << COLLAPSE_EXCLUDE_DIRS
        }
        if (options.collapseExcludeFiles) {
            arguments << COLLAPSE_EXCLUDE_FILES
        }
        if (options.jarDirs) {
            arguments << JAR_DIRS
        }
        if (options.verbose) {
            arguments << VERBOSE
        }
        if (options.classesOnly) {
            arguments << CLASSES_ONLY
        }
        if (options.displayName) {
            arguments << DISPLAY_NAME
            arguments << options.displayName
        }
        if (options.server) {
            arguments << SERVER
            String server = options.server
            if (OsUtils.isWindows() && !server.startsWith('"')) {
                server = "\"${server}\""
            }
            arguments << server
        }
        if (options.liveConfig) {
            arguments << LIVE_CONFIG
        }
        if (options.distributable) {
            arguments << DISTRIBUTABLE
        }
        if (options.addEarFile) {
            arguments << ADD_EAR_FILE
            options.addEarFile.each {
                arguments << it
            }
        }
        if (options.contextRootsFile) {
            arguments << CONTEXT_ROOTS_FILE
            arguments << options.contextRootsFile
        }
        if (options.dynamoEnvProperties) {
            arguments << DYNAMO_ENV_PROPERTIES
            arguments << options.dynamoEnvProperties
        }
        if (options.excludeAccResources) {
            arguments << EXCLUDE_ACC_RESOURCES
        }
        if (options.noFix) {
            arguments << NO_FIX
        }
        if (options.prependJars) {
            arguments << PREPEND_JARS
            String joinedValue = options.prependJars.join(',')
            arguments << "\"$joinedValue\""
        }
        if (options.runInPlace) {
            arguments << RUN_IN_PLACE
        }
        if (options.tomcat) {
            arguments << TOMCAT
        }
        if (options.tomcatAdditionalResourcesFile) {
            arguments << TOMCAT_ADDITIONAL_RESOURCES_FILE
            arguments << options.tomcatAdditionalResourcesFile
        }
        if (options.tomcatInitialResourcesFile) {
            arguments << TOMCAT_INITIAL_RESOURCES_FILE
            arguments << options.tomcatInitialResourcesFile
        }
        if (options.tomcatUseJotm) {
            arguments << TOMCAT_USE_JOTM
        }
        if (options.tomcatUseAtomikos) {
            arguments << TOMCAT_USE_ATOMIKOS
        }
        if (options.jboss) {
            arguments << JBOSS
        }

        if (options.extra != null) {
            arguments << options.extra
        }

        //Add output file name (required)
        String targetPath = new File("${assembler.outputDir}/${assembler.earName}").absolutePath
        if (OsUtils.isWindows() && !targetPath.startsWith('"')) {
            targetPath = "\"${targetPath}\""
        }

        assembler.project.logger.debug('RunAssemblerCommandLineBuilder - targetPath={}', targetPath)

        arguments << targetPath

        //Add layers (optional)
        if (assembler.layers) {
            arguments << LAYER
            arguments.addAll(assembler.layers)
        }

        arguments << '-m'
        arguments.addAll(assembler.modules)
        return arguments
    }