|
|
@@ -13,18 +13,21 @@ import cn.reghao.autodop.dmaster.app.model.po.config.build.CompilerConfig;
|
|
|
*/
|
|
|
public class ShellCompiler implements CodeCompiler {
|
|
|
private final ShellExecutor shell;
|
|
|
- private final String[] compileCmd;
|
|
|
+ private final String[] compileCmds;
|
|
|
|
|
|
public ShellCompiler(CompilerConfig compilerConfig) {
|
|
|
- this.compileCmd = compilerConfig.getCompileCmd().split("\\s+");
|
|
|
+ this.compileCmds = compilerConfig.getCompileCmd().split(" && ");
|
|
|
this.shell = new ShellExecutor();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void compile(String appId, String appCompileHome) throws Exception {
|
|
|
- ShellResult result = shell.exec(appCompileHome, compileCmd);
|
|
|
- if (!result.isSuccess()) {
|
|
|
- throw new Exception(JsonConverter.objectToJson(result.getResult()));
|
|
|
+ ShellResult result;
|
|
|
+ for (String compileCmd : compileCmds) {
|
|
|
+ result = shell.exec(appCompileHome, compileCmd.split("\\s+"));
|
|
|
+ if (!result.isSuccess()) {
|
|
|
+ throw new Exception(JsonConverter.objectToJson(result.getResult()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|