mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Merge branch '3.1.x' into 3.2.x
Closes gh-40547
This commit is contained in:
commit
89b13c897a
@ -48,9 +48,12 @@ import org.gradle.api.tasks.TaskAction;
|
|||||||
*/
|
*/
|
||||||
public class CheckAdditionalSpringConfigurationMetadata extends SourceTask {
|
public class CheckAdditionalSpringConfigurationMetadata extends SourceTask {
|
||||||
|
|
||||||
|
private final File projectDir;
|
||||||
|
|
||||||
private final RegularFileProperty reportLocation;
|
private final RegularFileProperty reportLocation;
|
||||||
|
|
||||||
public CheckAdditionalSpringConfigurationMetadata() {
|
public CheckAdditionalSpringConfigurationMetadata() {
|
||||||
|
this.projectDir = getProject().getProjectDir();
|
||||||
this.reportLocation = getProject().getObjects().fileProperty();
|
this.reportLocation = getProject().getObjects().fileProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +85,7 @@ public class CheckAdditionalSpringConfigurationMetadata extends SourceTask {
|
|||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
Report report = new Report();
|
Report report = new Report();
|
||||||
for (File file : getSource().getFiles()) {
|
for (File file : getSource().getFiles()) {
|
||||||
Analysis analysis = report.analysis(getProject().getProjectDir().toPath().relativize(file.toPath()));
|
Analysis analysis = report.analysis(this.projectDir.toPath().relativize(file.toPath()));
|
||||||
Map<String, Object> json = objectMapper.readValue(file, Map.class);
|
Map<String, Object> json = objectMapper.readValue(file, Map.class);
|
||||||
check("groups", json, analysis);
|
check("groups", json, analysis);
|
||||||
check("properties", json, analysis);
|
check("properties", json, analysis);
|
||||||
|
@ -49,11 +49,14 @@ public class CheckSpringConfigurationMetadata extends DefaultTask {
|
|||||||
|
|
||||||
private List<String> exclusions = new ArrayList<>();
|
private List<String> exclusions = new ArrayList<>();
|
||||||
|
|
||||||
|
private final File projectDir;
|
||||||
|
|
||||||
private final RegularFileProperty reportLocation;
|
private final RegularFileProperty reportLocation;
|
||||||
|
|
||||||
private final RegularFileProperty metadataLocation;
|
private final RegularFileProperty metadataLocation;
|
||||||
|
|
||||||
public CheckSpringConfigurationMetadata() {
|
public CheckSpringConfigurationMetadata() {
|
||||||
|
this.projectDir = getProject().getProjectDir();
|
||||||
this.metadataLocation = getProject().getObjects().fileProperty();
|
this.metadataLocation = getProject().getObjects().fileProperty();
|
||||||
this.reportLocation = getProject().getObjects().fileProperty();
|
this.reportLocation = getProject().getObjects().fileProperty();
|
||||||
}
|
}
|
||||||
@ -93,7 +96,7 @@ public class CheckSpringConfigurationMetadata extends DefaultTask {
|
|||||||
private Report createReport() throws IOException, JsonParseException, JsonMappingException {
|
private Report createReport() throws IOException, JsonParseException, JsonMappingException {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
File file = this.metadataLocation.get().getAsFile();
|
File file = this.metadataLocation.get().getAsFile();
|
||||||
Report report = new Report(getProject().getProjectDir().toPath().relativize(file.toPath()));
|
Report report = new Report(this.projectDir.toPath().relativize(file.toPath()));
|
||||||
Map<String, Object> json = objectMapper.readValue(file, Map.class);
|
Map<String, Object> json = objectMapper.readValue(file, Map.class);
|
||||||
List<Map<String, Object>> properties = (List<Map<String, Object>>) json.get("properties");
|
List<Map<String, Object>> properties = (List<Map<String, Object>>) json.get("properties");
|
||||||
for (Map<String, Object> property : properties) {
|
for (Map<String, Object> property : properties) {
|
||||||
|
Loading…
Reference in New Issue
Block a user