void executeCommandLine()

in src/main/groovy/com/epam/atg/gradle/assemble/RunAssemblerTask.groovy [114:166]


    void executeCommandLine() {
        if (!atgRootDir) {
            atgRootDir = project.property(ATGPluginConstants.PROJECT_ATG_ROOT_PROPERTY)
            if (!atgRootDir) {
                throw new IllegalArgumentException(
                        "\"$ATGPluginConstants.PROJECT_ATG_ROOT_PROPERTY\" is required property.")
            }
        }

        if (modules == null || modules.isEmpty()) {
            throw new IllegalArgumentException('Can\'t assemble empty modules list.')
        }
        if (!earName) {
            earName = name
        }

        if (!earName.toLowerCase().endsWith(EAR_EXT)) {
            earName += EAR_EXT
        }

        if (cleanOnBuild) {
            File target = project.file("$outputDir/$earName")
            if (target.exists()) {
                project.delete(target)
            }
        }

        if (!project.file(outputDir).exists()) {
            project.mkdir(outputDir)
        }

        List<File> tempLinks = []
        Map atgRootModules = ProjectUtils.getAtgRootProjectsPathsWithModulesNames(project)
        atgRootModules.each { String projectPath, String moduleName ->
            File atgModuleFile = new File("$atgRootDir/$moduleName")
            if (!atgModuleFile.exists()) {
                Project rootAtgProject = project.project(projectPath)
                FileUtils.createLink(atgModuleFile, rootAtgProject.projectDir)
                tempLinks.add(atgModuleFile)
                project.logger.info('Added temporary link from {} to {}', rootAtgProject.projectDir, atgModuleFile)
            }
        }

        try {
            List args = RunAssemblerCommandLineBuilder.build(this)
            executor.exec(project, atgRootDir, args)
        } finally {
            for (File link in tempLinks) {
                link.delete()
                project.logger.info('Removed temporary link {}', link)
            }
        }
    }