项目结构变更
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.aicheck</groupId>
|
<groupId>com.codechecker</groupId>
|
||||||
<artifactId>class-checker</artifactId>
|
<artifactId>code-checker</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<build>
|
<build>
|
||||||
<finalName>class-checker</finalName>
|
<finalName>code-checker</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<transformers>
|
<transformers>
|
||||||
<transformer>
|
<transformer>
|
||||||
<mainClass>com.aicheck.ClassCheckMain</mainClass>
|
<mainClass>com.codechecker.CodeCheckMain</mainClass>
|
||||||
</transformer>
|
</transformer>
|
||||||
</transformers>
|
</transformers>
|
||||||
<filters>
|
<filters>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.aicheck</groupId>
|
<groupId>com.codechecker</groupId>
|
||||||
<artifactId>class-checker</artifactId>
|
<artifactId>code-checker</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>class-checker</finalName>
|
<finalName>code-checker</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<transformers>
|
<transformers>
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||||
<mainClass>com.aicheck.ClassCheckMain</mainClass>
|
<mainClass>com.codechecker.CodeCheckMain</mainClass>
|
||||||
</transformer>
|
</transformer>
|
||||||
</transformers>
|
</transformers>
|
||||||
<filters>
|
<filters>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.aicheck;
|
package com.codechecker;
|
||||||
|
|
||||||
import com.aicheck.analyzer.ClassChangeAnalyzer;
|
import com.codechecker.analyzer.ClassChangeAnalyzer;
|
||||||
import com.aicheck.analyzer.EndpointIndexBuilder;
|
import com.codechecker.analyzer.EndpointIndexBuilder;
|
||||||
import com.aicheck.api.analyzer.ApiChangeAnalyzer;
|
import com.codechecker.api.analyzer.ApiChangeAnalyzer;
|
||||||
import com.aicheck.api.model.EndpointChangeReport;
|
import com.codechecker.api.model.EndpointChangeReport;
|
||||||
import com.aicheck.api.notify.ApiChangeNotifier;
|
import com.codechecker.api.notify.ApiChangeNotifier;
|
||||||
import com.aicheck.config.AppConfig;
|
import com.codechecker.config.AppConfig;
|
||||||
import com.aicheck.git.GitChangeScanner;
|
import com.codechecker.git.GitChangeScanner;
|
||||||
import com.aicheck.model.ApiEndpoint;
|
import com.codechecker.model.ApiEndpoint;
|
||||||
import com.aicheck.model.ClassChangeReport;
|
import com.codechecker.model.ClassChangeReport;
|
||||||
import com.aicheck.notify.WeComNotifier;
|
import com.codechecker.notify.WeComNotifier;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
import picocli.CommandLine.Command;
|
import picocli.CommandLine.Command;
|
||||||
import picocli.CommandLine.Option;
|
import picocli.CommandLine.Option;
|
||||||
@@ -22,9 +22,9 @@ import java.util.concurrent.Callable;
|
|||||||
/**
|
/**
|
||||||
* CLI 入口:加载配置 → 扫描 git 变更 → 分析影响 → 输出/发送企微通知。
|
* CLI 入口:加载配置 → 扫描 git 变更 → 分析影响 → 输出/发送企微通知。
|
||||||
*/
|
*/
|
||||||
@Command(name = "class-checker", mixinStandardHelpOptions = true,
|
@Command(name = "code-checker", mixinStandardHelpOptions = true,
|
||||||
description = "检测类变更与 API 变更并发送企业微信通知")
|
description = "检测类变更与 API 变更并发送企业微信通知")
|
||||||
public class ClassCheckMain implements Callable<Integer> {
|
public class CodeCheckMain implements Callable<Integer> {
|
||||||
@Option(names = "--config", required = true, description = "配置文件路径")
|
@Option(names = "--config", required = true, description = "配置文件路径")
|
||||||
private Path config;
|
private Path config;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class ClassCheckMain implements Callable<Integer> {
|
|||||||
|
|
||||||
/** 程序入口 */
|
/** 程序入口 */
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
int exitCode = new CommandLine(new ClassCheckMain()).execute(args);
|
int exitCode = new CommandLine(new CodeCheckMain()).execute(args);
|
||||||
System.exit(exitCode);
|
System.exit(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,17 +53,22 @@ public class ClassCheckMain implements Callable<Integer> {
|
|||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
AppConfig appConfig = AppConfig.load(config.toAbsolutePath());
|
AppConfig appConfig = AppConfig.load(config.toAbsolutePath());
|
||||||
|
if (!appConfig.isMasterEnabled()) {
|
||||||
|
System.out.println("变更检测已全部关闭(checker.enabled=false)");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
GitChangeScanner gitScanner = new GitChangeScanner(repoRoot.toAbsolutePath());
|
GitChangeScanner gitScanner = new GitChangeScanner(repoRoot.toAbsolutePath());
|
||||||
int totalSent = 0;
|
int totalSent = 0;
|
||||||
|
|
||||||
if (appConfig.isEnabled()) {
|
if (appConfig.isClassCheckEnabled()) {
|
||||||
totalSent += runClassChangeCheck(appConfig, gitScanner);
|
totalSent += executeClassCheck(appConfig, gitScanner);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("类变更检测已关闭(class_check.enabled=false)");
|
System.out.println("类变更检测已关闭(class_check.enabled=false)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appConfig.isApiCheckEnabled()) {
|
if (appConfig.isApiCheckEnabled()) {
|
||||||
totalSent += runApiChangeCheck(appConfig, gitScanner);
|
totalSent += executeApiCheck(appConfig, gitScanner);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("API 变更检测已关闭(api_check.enabled=false)");
|
System.out.println("API 变更检测已关闭(api_check.enabled=false)");
|
||||||
}
|
}
|
||||||
@@ -74,7 +79,7 @@ public class ClassCheckMain implements Callable<Integer> {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int runClassChangeCheck(AppConfig appConfig, GitChangeScanner gitScanner) throws Exception {
|
private int executeClassCheck(AppConfig appConfig, GitChangeScanner gitScanner) throws Exception {
|
||||||
System.out.println("=== 类变更检测 ===");
|
System.out.println("=== 类变更检测 ===");
|
||||||
EndpointIndexBuilder indexBuilder = new EndpointIndexBuilder();
|
EndpointIndexBuilder indexBuilder = new EndpointIndexBuilder();
|
||||||
Map<String, ApiEndpoint> endpointIndex = indexBuilder.buildIndex(repoRoot.toAbsolutePath(), appConfig);
|
Map<String, ApiEndpoint> endpointIndex = indexBuilder.buildIndex(repoRoot.toAbsolutePath(), appConfig);
|
||||||
@@ -95,7 +100,7 @@ public class ClassCheckMain implements Callable<Integer> {
|
|||||||
return reports.size();
|
return reports.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int runApiChangeCheck(AppConfig appConfig, GitChangeScanner gitScanner) throws Exception {
|
private int executeApiCheck(AppConfig appConfig, GitChangeScanner gitScanner) throws Exception {
|
||||||
System.out.println("=== API 变更检测 ===");
|
System.out.println("=== API 变更检测 ===");
|
||||||
ApiChangeAnalyzer analyzer = new ApiChangeAnalyzer(gitScanner);
|
ApiChangeAnalyzer analyzer = new ApiChangeAnalyzer(gitScanner);
|
||||||
List<EndpointChangeReport> reports = analyzer.analyze(
|
List<EndpointChangeReport> reports = analyzer.analyze(
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package com.aicheck.analyzer;
|
package com.codechecker.analyzer;
|
||||||
|
|
||||||
import com.aicheck.config.AppConfig;
|
import com.codechecker.config.AppConfig;
|
||||||
import com.aicheck.git.GitChangeScanner;
|
import com.codechecker.git.GitChangeScanner;
|
||||||
import com.aicheck.model.ChangedClassFile;
|
import com.codechecker.model.ChangedClassFile;
|
||||||
import com.aicheck.model.ClassChangeKind;
|
import com.codechecker.model.ClassChangeKind;
|
||||||
import com.aicheck.model.ClassChangeReport;
|
import com.codechecker.model.ClassChangeReport;
|
||||||
import com.aicheck.model.FieldChange;
|
import com.codechecker.model.FieldChange;
|
||||||
import com.aicheck.model.FieldInfo;
|
import com.codechecker.model.FieldInfo;
|
||||||
import com.aicheck.parser.ClassDeclParser;
|
import com.codechecker.parser.ClassDeclParser;
|
||||||
import com.aicheck.parser.ClassFieldParser;
|
import com.codechecker.parser.ClassFieldParser;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -32,7 +32,7 @@ public class ClassChangeAnalyzer {
|
|||||||
|
|
||||||
/** 扫描变更文件并逐条分析,无实质变更的 MODIFIED 会被跳过 */
|
/** 扫描变更文件并逐条分析,无实质变更的 MODIFIED 会被跳过 */
|
||||||
public List<ClassChangeReport> analyze(Path repoRoot, AppConfig config, String oldSha, String newSha,
|
public List<ClassChangeReport> analyze(Path repoRoot, AppConfig config, String oldSha, String newSha,
|
||||||
Map<String, com.aicheck.model.ApiEndpoint> endpointIndex) throws IOException {
|
Map<String, com.codechecker.model.ApiEndpoint> endpointIndex) throws IOException {
|
||||||
List<ChangedClassFile> changedFiles = gitScanner.scanChangedClasses(oldSha, newSha);
|
List<ChangedClassFile> changedFiles = gitScanner.scanChangedClasses(oldSha, newSha);
|
||||||
List<ClassChangeReport> reports = new ArrayList<>();
|
List<ClassChangeReport> reports = new ArrayList<>();
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class ClassChangeAnalyzer {
|
|||||||
|
|
||||||
/** 处理删除:标记 DELETED 并分析影响(基于旧源码) */
|
/** 处理删除:标记 DELETED 并分析影响(基于旧源码) */
|
||||||
private ClassChangeReport analyzeDeleted(ChangedClassFile changedFile, AppConfig config, Path repoRoot,
|
private ClassChangeReport analyzeDeleted(ChangedClassFile changedFile, AppConfig config, Path repoRoot,
|
||||||
String oldSha, Map<String, com.aicheck.model.ApiEndpoint> endpointIndex)
|
String oldSha, Map<String, com.codechecker.model.ApiEndpoint> endpointIndex)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String path = changedFile.getRelativePath();
|
String path = changedFile.getRelativePath();
|
||||||
String oldSource = gitScanner.readFileAtCommit(oldSha, path);
|
String oldSource = gitScanner.readFileAtCommit(oldSha, path);
|
||||||
@@ -75,7 +75,7 @@ public class ClassChangeAnalyzer {
|
|||||||
/** 处理修改/重命名:字段 diff → 判定 changeKind → 影响分析 */
|
/** 处理修改/重命名:字段 diff → 判定 changeKind → 影响分析 */
|
||||||
private ClassChangeReport analyzeModifiedOrRenamed(ChangedClassFile changedFile, AppConfig config,
|
private ClassChangeReport analyzeModifiedOrRenamed(ChangedClassFile changedFile, AppConfig config,
|
||||||
Path repoRoot, String oldSha, String newSha,
|
Path repoRoot, String oldSha, String newSha,
|
||||||
Map<String, com.aicheck.model.ApiEndpoint> endpointIndex)
|
Map<String, com.codechecker.model.ApiEndpoint> endpointIndex)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String oldPath = changedFile.pathForOldCommit();
|
String oldPath = changedFile.pathForOldCommit();
|
||||||
String newPath = changedFile.getRelativePath();
|
String newPath = changedFile.getRelativePath();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.aicheck.analyzer;
|
package com.codechecker.analyzer;
|
||||||
|
|
||||||
import com.aicheck.config.AppConfig;
|
import com.codechecker.config.AppConfig;
|
||||||
import com.aicheck.model.ApiEndpoint;
|
import com.codechecker.model.ApiEndpoint;
|
||||||
import com.aicheck.parser.EndpointParser;
|
import com.codechecker.parser.EndpointParser;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.aicheck.analyzer;
|
package com.codechecker.analyzer;
|
||||||
|
|
||||||
import com.aicheck.model.FieldChange;
|
import com.codechecker.model.FieldChange;
|
||||||
import com.aicheck.model.FieldInfo;
|
import com.codechecker.model.FieldInfo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.aicheck.analyzer;
|
package com.codechecker.analyzer;
|
||||||
|
|
||||||
import com.aicheck.config.AppConfig;
|
import com.codechecker.config.AppConfig;
|
||||||
import com.aicheck.model.ApiEndpoint;
|
import com.codechecker.model.ApiEndpoint;
|
||||||
import com.aicheck.model.ClassChangeReport;
|
import com.codechecker.model.ClassChangeReport;
|
||||||
import com.aicheck.model.ClassType;
|
import com.codechecker.model.ClassType;
|
||||||
import com.aicheck.parser.ConversionParser;
|
import com.codechecker.parser.ConversionParser;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.aicheck.api.analyzer;
|
package com.codechecker.api.analyzer;
|
||||||
|
|
||||||
import com.aicheck.api.model.EndpointChangeReport;
|
import com.codechecker.api.model.EndpointChangeReport;
|
||||||
import com.aicheck.api.model.EndpointSnapshot;
|
import com.codechecker.api.model.EndpointSnapshot;
|
||||||
import com.aicheck.api.parser.EndpointSnapshotParser;
|
import com.codechecker.api.parser.EndpointSnapshotParser;
|
||||||
import com.aicheck.api.scanner.ApiFileChangeScanner;
|
import com.codechecker.api.scanner.ApiFileChangeScanner;
|
||||||
import com.aicheck.config.AppConfig;
|
import com.codechecker.config.AppConfig;
|
||||||
import com.aicheck.git.GitChangeScanner;
|
import com.codechecker.git.GitChangeScanner;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -13,7 +13,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 变更分析编排(与 {@link com.aicheck.analyzer.ClassChangeAnalyzer} 平行、互不调用)。
|
* API 变更分析编排(与 {@link com.codechecker.analyzer.ClassChangeAnalyzer} 平行、互不调用)。
|
||||||
*/
|
*/
|
||||||
public class ApiChangeAnalyzer {
|
public class ApiChangeAnalyzer {
|
||||||
private final GitChangeScanner gitScanner;
|
private final GitChangeScanner gitScanner;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.aicheck.api.analyzer;
|
package com.codechecker.api.analyzer;
|
||||||
|
|
||||||
import com.aicheck.api.model.ApiChangeKind;
|
import com.codechecker.api.model.ApiChangeKind;
|
||||||
import com.aicheck.api.model.EndpointChangeReport;
|
import com.codechecker.api.model.EndpointChangeReport;
|
||||||
import com.aicheck.api.model.EndpointSnapshot;
|
import com.codechecker.api.model.EndpointSnapshot;
|
||||||
import com.aicheck.api.model.ParameterChange;
|
import com.codechecker.api.model.ParameterChange;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.aicheck.api.analyzer;
|
package com.codechecker.api.analyzer;
|
||||||
|
|
||||||
import com.aicheck.analyzer.FieldDiffEngine;
|
import com.codechecker.analyzer.FieldDiffEngine;
|
||||||
import com.aicheck.api.model.EndpointSnapshot;
|
import com.codechecker.api.model.EndpointSnapshot;
|
||||||
import com.aicheck.api.model.MethodParameterSnapshot;
|
import com.codechecker.api.model.MethodParameterSnapshot;
|
||||||
import com.aicheck.api.model.ParameterChange;
|
import com.codechecker.api.model.ParameterChange;
|
||||||
import com.aicheck.api.parser.NestedDtoFieldParser;
|
import com.codechecker.api.parser.NestedDtoFieldParser;
|
||||||
import com.aicheck.api.parser.NestedFieldInfo;
|
import com.codechecker.api.parser.NestedFieldInfo;
|
||||||
import com.aicheck.model.FieldChange;
|
import com.codechecker.model.FieldChange;
|
||||||
import com.aicheck.model.FieldInfo;
|
import com.codechecker.model.FieldInfo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.aicheck.api.model;
|
package com.codechecker.api.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 变更类型(与类变更 {@link com.aicheck.model.ClassChangeKind} 独立)。
|
* API 变更类型(与类变更 {@link com.codechecker.model.ClassChangeKind} 独立)。
|
||||||
*/
|
*/
|
||||||
public enum ApiChangeKind {
|
public enum ApiChangeKind {
|
||||||
NEW_ENDPOINT,
|
NEW_ENDPOINT,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.model;
|
package com.codechecker.api.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.model;
|
package com.codechecker.api.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.model;
|
package com.codechecker.api.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口方法入参快照。
|
* 接口方法入参快照。
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.model;
|
package com.codechecker.api.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 参数或 RequestBody 嵌套字段变更。
|
* API 参数或 RequestBody 嵌套字段变更。
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.aicheck.api.notify;
|
package com.codechecker.api.notify;
|
||||||
|
|
||||||
import com.aicheck.api.model.ApiChangeKind;
|
import com.codechecker.api.model.ApiChangeKind;
|
||||||
import com.aicheck.api.model.EndpointChangeReport;
|
import com.codechecker.api.model.EndpointChangeReport;
|
||||||
import com.aicheck.api.model.ParameterChange;
|
import com.codechecker.api.model.ParameterChange;
|
||||||
import com.aicheck.common.MarkdownStyles;
|
import com.codechecker.common.MarkdownStyles;
|
||||||
import com.aicheck.common.WeComMarkdownSender;
|
import com.codechecker.common.WeComMarkdownSender;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.aicheck.api.parser;
|
package com.codechecker.api.parser;
|
||||||
|
|
||||||
import com.aicheck.api.model.EndpointSnapshot;
|
import com.codechecker.api.model.EndpointSnapshot;
|
||||||
import com.aicheck.api.model.MethodParameterSnapshot;
|
import com.codechecker.api.model.MethodParameterSnapshot;
|
||||||
import com.aicheck.parser.TypeNameUtils;
|
import com.codechecker.parser.TypeNameUtils;
|
||||||
import com.github.javaparser.StaticJavaParser;
|
import com.github.javaparser.StaticJavaParser;
|
||||||
import com.github.javaparser.ast.CompilationUnit;
|
import com.github.javaparser.ast.CompilationUnit;
|
||||||
import com.github.javaparser.ast.NodeList;
|
import com.github.javaparser.ast.NodeList;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.parser;
|
package com.codechecker.api.parser;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.parser;
|
package com.codechecker.api.parser;
|
||||||
|
|
||||||
import com.github.javaparser.ast.body.MethodDeclaration;
|
import com.github.javaparser.ast.body.MethodDeclaration;
|
||||||
import com.github.javaparser.ast.comments.JavadocComment;
|
import com.github.javaparser.ast.comments.JavadocComment;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.aicheck.api.parser;
|
package com.codechecker.api.parser;
|
||||||
|
|
||||||
import com.aicheck.model.FieldInfo;
|
import com.codechecker.model.FieldInfo;
|
||||||
import com.aicheck.parser.ClassFieldParser;
|
import com.codechecker.parser.ClassFieldParser;
|
||||||
import com.aicheck.parser.TypeNameUtils;
|
import com.codechecker.parser.TypeNameUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.api.parser;
|
package com.codechecker.api.parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DTO 嵌套字段扁平化条目(dot path)。
|
* DTO 嵌套字段扁平化条目(dot path)。
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.aicheck.api.scanner;
|
package com.codechecker.api.scanner;
|
||||||
|
|
||||||
import com.aicheck.git.GitChangeScanner;
|
import com.codechecker.git.GitChangeScanner;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.common;
|
package com.codechecker.common;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企微 Markdown v1 公共样式(类变更 / API 变更通知共用)。
|
* 企微 Markdown v1 公共样式(类变更 / API 变更通知共用)。
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.common;
|
package com.codechecker.common;
|
||||||
|
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.config;
|
package com.codechecker.config;
|
||||||
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
|
||||||
@@ -14,7 +14,8 @@ import java.util.Map;
|
|||||||
* 读取 .gitea/config.yaml,提供检测开关、扫描目录、企微配置等。
|
* 读取 .gitea/config.yaml,提供检测开关、扫描目录、企微配置等。
|
||||||
*/
|
*/
|
||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
private boolean enabled = true;
|
private boolean masterEnabled = true;
|
||||||
|
private boolean classCheckEnabled = true;
|
||||||
private boolean dtoEntityConversionEnabled = true;
|
private boolean dtoEntityConversionEnabled = true;
|
||||||
private List<String> modelDirs = new ArrayList<>();
|
private List<String> modelDirs = new ArrayList<>();
|
||||||
private List<String> controllerScanDirs = new ArrayList<>();
|
private List<String> controllerScanDirs = new ArrayList<>();
|
||||||
@@ -42,8 +43,11 @@ public class AppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AppConfig config = new AppConfig();
|
AppConfig config = new AppConfig();
|
||||||
|
Map<String, Object> checker = mapOrEmpty(root.get("checker"));
|
||||||
|
config.masterEnabled = boolOrDefault(checker.get("enabled"), true);
|
||||||
|
|
||||||
Map<String, Object> classCheck = mapOrEmpty(root.get("class_check"));
|
Map<String, Object> classCheck = mapOrEmpty(root.get("class_check"));
|
||||||
config.enabled = boolOrDefault(classCheck.get("enabled"), true);
|
config.classCheckEnabled = boolOrDefault(classCheck.get("enabled"), true);
|
||||||
|
|
||||||
Map<String, Object> conversion = mapOrEmpty(classCheck.get("dto_entity_conversion"));
|
Map<String, Object> conversion = mapOrEmpty(classCheck.get("dto_entity_conversion"));
|
||||||
config.dtoEntityConversionEnabled = boolOrDefault(conversion.get("enabled"), true);
|
config.dtoEntityConversionEnabled = boolOrDefault(conversion.get("enabled"), true);
|
||||||
@@ -115,9 +119,14 @@ public class AppConfig {
|
|||||||
return value == null ? "" : value.toString();
|
return value == null ? "" : value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 类变更检测总开关 */
|
/** 变更检测总开关(checker.enabled,控制 class_check + api_check) */
|
||||||
public boolean isEnabled() {
|
public boolean isMasterEnabled() {
|
||||||
return enabled;
|
return masterEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 类变更检测开关(class_check.enabled) */
|
||||||
|
public boolean isClassCheckEnabled() {
|
||||||
|
return classCheckEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Dto→Entity 类转换检测开关 */
|
/** Dto→Entity 类转换检测开关 */
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.aicheck.git;
|
package com.codechecker.git;
|
||||||
|
|
||||||
import com.aicheck.model.ChangedClassFile;
|
import com.codechecker.model.ChangedClassFile;
|
||||||
import com.aicheck.model.ClassType;
|
import com.codechecker.model.ClassType;
|
||||||
import com.aicheck.parser.ClassDeclParser;
|
import com.codechecker.parser.ClassDeclParser;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Git 扫描得到的单个 Java 模型类变更记录。
|
* Git 扫描得到的单个 Java 模型类变更记录。
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单次类变更的类型,决定通知内容与影响分析策略。
|
* 单次类变更的类型,决定通知内容与影响分析策略。
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目标模型类后缀类型,决定通知模版中展示哪些影响段落。
|
* 目标模型类后缀类型,决定通知模版中展示哪些影响段落。
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段级 diff 结果,用于通知中的 [新增]/[删除]/[修改]/[重命名] 行。
|
* 字段级 diff 结果,用于通知中的 [新增]/[删除]/[修改]/[重命名] 行。
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.model;
|
package com.codechecker.model;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.aicheck.notify;
|
package com.codechecker.notify;
|
||||||
|
|
||||||
import com.aicheck.model.ApiEndpoint;
|
import com.codechecker.model.ApiEndpoint;
|
||||||
import com.aicheck.model.ClassChangeReport;
|
import com.codechecker.model.ClassChangeReport;
|
||||||
import com.aicheck.model.ClassType;
|
import com.codechecker.model.ClassType;
|
||||||
import com.aicheck.model.FieldChange;
|
import com.codechecker.model.FieldChange;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.parser;
|
package com.codechecker.parser;
|
||||||
|
|
||||||
import com.github.javaparser.StaticJavaParser;
|
import com.github.javaparser.StaticJavaParser;
|
||||||
import com.github.javaparser.ast.CompilationUnit;
|
import com.github.javaparser.ast.CompilationUnit;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.aicheck.parser;
|
package com.codechecker.parser;
|
||||||
|
|
||||||
import com.aicheck.model.FieldInfo;
|
import com.codechecker.model.FieldInfo;
|
||||||
import com.github.javaparser.StaticJavaParser;
|
import com.github.javaparser.StaticJavaParser;
|
||||||
import com.github.javaparser.ast.CompilationUnit;
|
import com.github.javaparser.ast.CompilationUnit;
|
||||||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.parser;
|
package com.codechecker.parser;
|
||||||
|
|
||||||
import com.github.javaparser.StaticJavaParser;
|
import com.github.javaparser.StaticJavaParser;
|
||||||
import com.github.javaparser.ast.CompilationUnit;
|
import com.github.javaparser.ast.CompilationUnit;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.aicheck.parser;
|
package com.codechecker.parser;
|
||||||
|
|
||||||
import com.aicheck.model.ApiEndpoint;
|
import com.codechecker.model.ApiEndpoint;
|
||||||
import com.github.javaparser.StaticJavaParser;
|
import com.github.javaparser.StaticJavaParser;
|
||||||
import com.github.javaparser.ast.CompilationUnit;
|
import com.github.javaparser.ast.CompilationUnit;
|
||||||
import com.github.javaparser.ast.NodeList;
|
import com.github.javaparser.ast.NodeList;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.aicheck.parser;
|
package com.codechecker.parser;
|
||||||
|
|
||||||
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
||||||
import com.github.javaparser.ast.type.Type;
|
import com.github.javaparser.ast.type.Type;
|
||||||
@@ -1,52 +1,35 @@
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
# 类变更检测配置
|
# 变更检测配置
|
||||||
# 由 CI 流水线加载;jar 位于 .gitea/workflows/class-checker.jar
|
# 由 CI 流水线加载;jar 位于 .gitea/workflows/code-checker.jar
|
||||||
# 修改后 push 即可生效,无需重新打包 jar(除非改动了 Java 源码)
|
# 修改后 push 即可生效,无需重新打包 jar(除非改动了 Java 源码)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
# 总开关。false 时跳过全部检测,流水线直接成功退出
|
|
||||||
class_check:
|
# 总开关:false 时跳过 class_check + api_check,流水线直接退出
|
||||||
|
checker:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# Dto → Entity 类转换影响检测开关
|
# 类变更检测(Vo/Dto/Entity/Model 字段增删改等)
|
||||||
# true:分析 Dto 变更是否通过 convert() 或 BeanUtils.copyProperties 影响到 Entity
|
class_check:
|
||||||
# false:通知中「② 类转换影响」段落显示「未开启检测」
|
enabled: true
|
||||||
dto_entity_conversion:
|
dto_entity_conversion:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
# 模型类源码目录(相对仓库根路径,可配置多个)
|
|
||||||
# 用于声明 Vo/Dto/Entity/Model 所在模块;当前版本按 git diff 全仓库扫描,
|
|
||||||
# 类名须以 Dto、Vo、VO、Entity、Model 结尾才会纳入检测
|
|
||||||
model_dirs:
|
model_dirs:
|
||||||
- jnpf-ftb/jnpf-ftb-entity/src/main/java
|
- jnpf-ftb/jnpf-ftb-entity/src/main/java
|
||||||
|
|
||||||
# 接口索引扫描目录,用于分析类变更对 API 的影响范围
|
# 接口索引扫描目录,用于分析类变更对 API 的影响范围
|
||||||
endpoint_scan:
|
endpoint_scan:
|
||||||
controllers:
|
controllers:
|
||||||
# Spring @RestController / @Controller 所在目录
|
|
||||||
# 解析 @RequestMapping 等注解,建立「HTTP 方法 + 路径 → 入参/返回值类型」索引
|
|
||||||
- jnpf-ftb/jnpf-ftb-biz/src/main/java
|
- jnpf-ftb/jnpf-ftb-biz/src/main/java
|
||||||
feign_apis:
|
feign_apis:
|
||||||
# OpenFeign @FeignClient 接口所在目录
|
|
||||||
# 解析 Feign 接口方法签名,补充远程调用端的影响范围
|
|
||||||
- jnpf-ftb/jnpf-ftb-api/src/main/java
|
- jnpf-ftb/jnpf-ftb-api/src/main/java
|
||||||
|
|
||||||
conversion_scan:
|
conversion_scan:
|
||||||
# Dto → Entity 转换代码扫描目录(相对仓库根路径,可配置多个)
|
|
||||||
# 在这些目录中搜索 BeanUtils.copyProperties(source, target) 等调用,
|
|
||||||
# 判断哪些 Entity 会因 Dto 字段变更而受影响
|
|
||||||
- jnpf-ftb/jnpf-ftb-biz/src/main/java
|
- jnpf-ftb/jnpf-ftb-biz/src/main/java
|
||||||
|
|
||||||
# 企业微信通知开关 # false:不发送企微,完整通知内容仅打印到 CI 日志
|
|
||||||
wecom:
|
|
||||||
enabled: true
|
|
||||||
webhook_url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=61f08cc9-b734-4dff-a931-7f33654c0a81"
|
|
||||||
|
|
||||||
# true:无变更时打印「无类变更,静默退出」后正常结束(不发送通知)
|
# API 变更检测(路径 / 请求方式 / 参数),与 class_check 同级
|
||||||
notify:
|
|
||||||
only_on_change: true
|
|
||||||
|
|
||||||
# API 变更检测(路径 / 请求方式 / 参数),与 class_check 共用同一 jar 与 wecom 配置
|
|
||||||
api_check:
|
api_check:
|
||||||
enabled: true
|
enabled: true
|
||||||
exclude_framework_params: true
|
exclude_framework_params: true
|
||||||
@@ -55,3 +38,11 @@ api_check:
|
|||||||
- jnpf-ftb/jnpf-ftb-biz/src/main/java
|
- jnpf-ftb/jnpf-ftb-biz/src/main/java
|
||||||
feign_apis:
|
feign_apis:
|
||||||
- jnpf-ftb/jnpf-ftb-api/src/main/java
|
- jnpf-ftb/jnpf-ftb-api/src/main/java
|
||||||
|
|
||||||
|
# 企业微信通知开关
|
||||||
|
wecom:
|
||||||
|
enabled: true
|
||||||
|
webhook_url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=61f08cc9-b734-4dff-a931-7f33654c0a81"
|
||||||
|
|
||||||
|
notify:
|
||||||
|
only_on_change: true
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
name: 类变更检测
|
|
||||||
run-name: ${{ gitea.actor }}的类变更检测
|
|
||||||
|
|
||||||
#on: [push]
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- class-check
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
class-change-check:
|
|
||||||
if: ${{ gitea.ref != 'refs/heads/pre' && gitea.ref != 'refs/heads/dev' && gitea.ref != 'refs/heads/master-2.0' }}
|
|
||||||
runs-on: jdk11
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 检出代码
|
|
||||||
run: |
|
|
||||||
git config --global http.sslVerify false
|
|
||||||
git clone "https://${{ gitea.token }}@git.niujiekeji.com/${{ gitea.repository }}.git" .
|
|
||||||
git checkout ${{ gitea.sha }}
|
|
||||||
#
|
|
||||||
# run: |
|
|
||||||
# git clone --depth=2 \
|
|
||||||
# "http://oauth2:${{ gitea.token }}@host.docker.internal:3000/${{ gitea.repository }}.git" \
|
|
||||||
# .
|
|
||||||
# git checkout ${{ gitea.sha }}
|
|
||||||
|
|
||||||
- name: 检查配置文件与预编译 jar
|
|
||||||
run: |
|
|
||||||
if [ ! -f .gitea/config.yaml ]; then
|
|
||||||
echo "错误: 缺少 .gitea/config.yaml"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -f .gitea/workflows/class-checker.jar ]; then
|
|
||||||
echo "错误: 缺少 .gitea/workflows/class-checker.jar"
|
|
||||||
echo "请本地执行: powershell -File scripts/build-class-checker.ps1"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 验证 JDK
|
|
||||||
run: |
|
|
||||||
echo "Java: $(java -version 2>&1 | head -1)"
|
|
||||||
|
|
||||||
- name: 执行类变更检测
|
|
||||||
run: |
|
|
||||||
OLD_SHA=$(git rev-parse HEAD~1 2>/dev/null || echo "")
|
|
||||||
if [ -z "$OLD_SHA" ]; then
|
|
||||||
echo "首次提交,跳过类变更检测"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
COMMIT_TIME=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')
|
|
||||||
java -jar .gitea/workflows/class-checker.jar \
|
|
||||||
--config .gitea/config.yaml \
|
|
||||||
--repo-root . \
|
|
||||||
--old-sha "$OLD_SHA" \
|
|
||||||
--new-sha "$(git rev-parse HEAD)" \
|
|
||||||
--modifier "${{ gitea.actor }}" \
|
|
||||||
--modify-time "$COMMIT_TIME"
|
|
||||||
53
.gitea/workflows/code-check.yml
Normal file
53
.gitea/workflows/code-check.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: CodeChecker 变更检测
|
||||||
|
|
||||||
|
run-name: ${{ gitea.actor }}的CodeChecker变更检测
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
on:
|
||||||
|
|
||||||
|
push:
|
||||||
|
|
||||||
|
branches:
|
||||||
|
|
||||||
|
- class-check
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
code-check:
|
||||||
|
|
||||||
|
if: ${{ gitea.ref != 'refs/heads/pre' && gitea.ref != 'refs/heads/dev' && gitea.ref != 'refs/heads/master-2.0' }}
|
||||||
|
|
||||||
|
runs-on: jdk11
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: 检出代码
|
||||||
|
|
||||||
|
run: |
|
||||||
|
|
||||||
|
git config --global http.sslVerify false
|
||||||
|
|
||||||
|
git clone "https://${{ gitea.token }}@git.niujiekeji.com/${{ gitea.repository }}.git" .
|
||||||
|
|
||||||
|
git checkout ${{ gitea.sha }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: 检查配置文件与预编译 jar
|
||||||
|
|
||||||
|
run: |
|
||||||
|
|
||||||
|
if [ ! -f .gitea/config.yaml ]; then
|
||||||
|
|
||||||
|
echo "错误: 缺少 .gitea/config.yaml"
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
fi
|
||||||
Binary file not shown.
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.jar
|
*.jar
|
||||||
!.gitea/workflows/class-checker.jar
|
!.gitea/workflows/code-checker.jar
|
||||||
*.war
|
*.war
|
||||||
*.nar
|
*.nar
|
||||||
*.ear
|
*.ear
|
||||||
@@ -29,6 +29,6 @@ replay_pid*
|
|||||||
.env.gitea
|
.env.gitea
|
||||||
gitea-runner/data/
|
gitea-runner/data/
|
||||||
|
|
||||||
# maven build output(提交 .gitea/workflows/class-checker.jar 即可)
|
# maven build output(提交 .gitea/workflows/code-checker.jar 即可)
|
||||||
.gitea/checker/target/
|
.gitea/checker/target/
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# 本地打包 class-checker 并复制到 .gitea/workflows/
|
# 本地打包 CodeChecker 并复制到 .gitea/workflows/
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||||
$CheckerDir = Join-Path $Root ".gitea\checker"
|
$CheckerDir = Join-Path $Root ".gitea\checker"
|
||||||
$WorkflowsDir = Join-Path $Root ".gitea\workflows"
|
$WorkflowsDir = Join-Path $Root ".gitea\workflows"
|
||||||
$TargetJar = Join-Path $CheckerDir "target\class-checker.jar"
|
$TargetJar = Join-Path $CheckerDir "target\code-checker.jar"
|
||||||
$OutputJar = Join-Path $WorkflowsDir "class-checker.jar"
|
$OutputJar = Join-Path $WorkflowsDir "code-checker.jar"
|
||||||
|
|
||||||
Write-Host ">> 编译 class-checker..."
|
Write-Host ">> 编译 CodeChecker..."
|
||||||
Push-Location $Root
|
Push-Location $Root
|
||||||
& mvn -q -f .gitea/checker/pom.xml package -DskipTests
|
& mvn -q -f .gitea/checker/pom.xml package -DskipTests
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
@@ -22,4 +22,4 @@ if (-not (Test-Path $TargetJar)) {
|
|||||||
New-Item -ItemType Directory -Force -Path $WorkflowsDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $WorkflowsDir | Out-Null
|
||||||
Copy-Item -Force $TargetJar $OutputJar
|
Copy-Item -Force $TargetJar $OutputJar
|
||||||
Write-Host ">> 已输出: $OutputJar"
|
Write-Host ">> 已输出: $OutputJar"
|
||||||
Write-Host ">> 请 commit 并 push .gitea/workflows/class-checker.jar"
|
Write-Host ">> 请 commit 并 push .gitea/workflows/code-checker.jar"
|
||||||
Reference in New Issue
Block a user