| | |
| | | private String adbPath; |
| | | |
| | | @Override |
| | | public ApkBuildTask triggerBuild(String buildType, String repoAlias, String branch) throws Exception { |
| | | public ApkBuildTask triggerBuild(String buildType, String androidTarget, String repoAlias, String branch, String serverUrl) throws Exception { |
| | | // 检查是否有正在进行中的任务(状态0=等待中,1=打包中) |
| | | List<ApkBuildTask> pendingTasks = this.baseMapper.selectPendingTasks(); |
| | | if (!pendingTasks.isEmpty()) { |
| | | ApkBuildTask runningTask = pendingTasks.get(0); |
| | | throw new RuntimeException("已有打包任务正在进行中(ID: " + runningTask.getId() |
| | | + ", 项目: " |
| | | + (runningTask.getProjectName() != null ? runningTask.getProjectName() : runningTask.getRepoAlias()) |
| | | + "),请等待完成后再创建新任务"); |
| | | } |
| | | |
| | | // 构建请求JSON |
| | | JSONObject requestBody = new JSONObject(); |
| | | requestBody.put("build_type", buildType); |
| | | requestBody.put("android_target", androidTarget); |
| | | requestBody.put("repo_alias", repoAlias); |
| | | requestBody.put("branch", branch); |
| | | requestBody.put("server_url", serverUrl); |
| | | |
| | | // 发送打包请求 |
| | | Map<String, Object> headers = new HashMap<>(); |