|
|
@@ -2,7 +2,6 @@ package cn.reghao.autodop.dmaster.app.util.buildtool.packer;
|
|
|
|
|
|
import cn.reghao.autodop.common.msg.rpc.dto.app.PackType;
|
|
|
import cn.reghao.autodop.common.util.compression.ZipFiles;
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.config.build.LocalBuildDir;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.config.build.PackerConfig;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
@@ -42,14 +41,21 @@ public class ZipPack implements CodePacker {
|
|
|
|
|
|
@Override
|
|
|
public String pack(String appId, String commitId, String appRootPath) throws Exception {
|
|
|
+ if (binfilesDirname == null) {
|
|
|
+ throw new Exception("存放编译产物的目录不能是 null");
|
|
|
+ }
|
|
|
+
|
|
|
String binfilesDirPath = appRootPath + File.separator + binfilesDirname;
|
|
|
String filename = String.format("%s_%s.zip", appId, commitId);
|
|
|
- String dst = targetPath + File.separator + filename;
|
|
|
- if (new File(dst).exists()) {
|
|
|
- throw new Exception(dst + " 已存在");
|
|
|
+ String dest = targetPath + File.separator + filename;
|
|
|
+ // TODO 实现域名自定义
|
|
|
+ String url = String.format("http://localhost:4020/api/app/bd/dl/%s", filename);
|
|
|
+ File target = new File(dest);
|
|
|
+ if (!target.exists()) {
|
|
|
+ ZipFiles.zip(new File(binfilesDirPath), dest);
|
|
|
}
|
|
|
- ZipFiles.zip(new File(binfilesDirPath), dst);
|
|
|
- return String.format("http://localhost:4020/api/app/bd/dl/%s", filename);
|
|
|
+
|
|
|
+ return url;
|
|
|
}
|
|
|
|
|
|
@Override
|