|
|
@@ -1,5 +1,8 @@
|
|
|
package cn.reghao.devops.manager.config.spring;
|
|
|
|
|
|
+import cn.reghao.devops.common.build.model.constant.CompileType;
|
|
|
+import cn.reghao.devops.manager.app.db.repository.config.build.CompilerConfigRepository;
|
|
|
+import cn.reghao.devops.manager.app.model.po.config.build.CompilerConfig;
|
|
|
import cn.reghao.devops.manager.app.service.config.BuildDirService;
|
|
|
import cn.reghao.devops.manager.log.Appenders;
|
|
|
import cn.reghao.devops.manager.log.LoggerConfig;
|
|
|
@@ -29,13 +32,16 @@ public class AppLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
private final MachineService machineService;
|
|
|
private final RoleRepository roleRepository;
|
|
|
private final LogHandler logHandler;
|
|
|
+ private final CompilerConfigRepository compilerConfigRepository;
|
|
|
|
|
|
public AppLifecycle(BuildDirService buildDirService, MachineService machineService,
|
|
|
- RoleRepository roleRepository, LogHandler logHandler) {
|
|
|
+ RoleRepository roleRepository, LogHandler logHandler,
|
|
|
+ CompilerConfigRepository compilerConfigRepository) {
|
|
|
this.buildDirService = buildDirService;
|
|
|
this.machineService = machineService;
|
|
|
this.roleRepository = roleRepository;
|
|
|
this.logHandler = logHandler;
|
|
|
+ this.compilerConfigRepository = compilerConfigRepository;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -43,6 +49,7 @@ public class AppLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
initLogConfig();
|
|
|
initBuildDir();
|
|
|
initRoles();
|
|
|
+ checkCompilerConfig();
|
|
|
log.info("devops-manager 初始化完成");
|
|
|
}
|
|
|
|
|
|
@@ -104,4 +111,20 @@ public class AppLifecycle implements ApplicationRunner, DisposableBean {
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ private void checkCompilerConfig() {
|
|
|
+ List<CompilerConfig> list = compilerConfigRepository.findAll();
|
|
|
+ for (CompilerConfig compilerConfig : list) {
|
|
|
+ if (compilerConfig.getType().equals(CompileType.none.getName())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String name = compilerConfig.getName();
|
|
|
+ String homePath = compilerConfig.getHomePath();
|
|
|
+ File file = new File(homePath);
|
|
|
+ if (!file.exists()) {
|
|
|
+ log.error("编译配置 {} 的编译器 {} 不存在", name, homePath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|