|
|
@@ -3,7 +3,9 @@ package cn.reghao.devops.common.build.chain.impl;
|
|
|
import cn.reghao.devops.common.build.chain.BuildTools;
|
|
|
import cn.reghao.devops.common.build.chain.Handler;
|
|
|
import cn.reghao.devops.common.build.model.AppDto;
|
|
|
+import cn.reghao.devops.common.build.model.CompilerDto;
|
|
|
import cn.reghao.devops.common.build.model.LocalBuildDir;
|
|
|
+import cn.reghao.devops.common.build.model.constant.CompileType;
|
|
|
import cn.reghao.devops.common.build.tool.compiler.CodeCompiler;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
@@ -25,14 +27,18 @@ public class CompileHandler extends Handler<BuildChainParam, BuildChainResult> {
|
|
|
String appCompileDir = LocalBuildDir.compileDir + File.separator + appId;
|
|
|
String compileDir = appCompileDir + File.separator + appDto.getProjDirname();
|
|
|
long start = System.currentTimeMillis();
|
|
|
- if (appDto.getAppType().equals("maven")) {
|
|
|
+ CompilerDto compilerDto = appDto.getBuildConfigDto().getCompilerDto();
|
|
|
+ String compileType = compilerDto.getType();
|
|
|
+ if (compileType.equals(CompileType.maven.getName())) {
|
|
|
codeCompiler.compile(appId, compileDir, appDto.getEnv(), appDto.getAppRootPath());
|
|
|
- } else {
|
|
|
+ } else if (compileType.equals(CompileType.shell.getName())) {
|
|
|
codeCompiler.compile(appId, compileDir);
|
|
|
+ } else {
|
|
|
+ String errMsg = String.format("unknown compile type %s with app %s", compileType, appId);
|
|
|
+ throw new Exception(errMsg);
|
|
|
}
|
|
|
|
|
|
buildResult.getBuildConsumedDto().setCompileConsumed(System.currentTimeMillis()-start);
|
|
|
-
|
|
|
if (next != null) {
|
|
|
next.handle(buildParam, buildResult);
|
|
|
}
|