Skip to content

Commit

Permalink
Merge branch '3.2.x'
Browse files Browse the repository at this point in the history
Closes gh-40548
  • Loading branch information
wilkinsona committed Apr 26, 2024
2 parents bccf004 + 89b13c8 commit ddeb114
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -48,9 +48,12 @@
*/
public class CheckAdditionalSpringConfigurationMetadata extends SourceTask {

private final File projectDir;

private final RegularFileProperty reportLocation;

public CheckAdditionalSpringConfigurationMetadata() {
this.projectDir = getProject().getProjectDir();
this.reportLocation = getProject().getObjects().fileProperty();
}

Expand Down Expand Up @@ -82,7 +85,7 @@ private Report createReport() throws IOException, JsonParseException, JsonMappin
ObjectMapper objectMapper = new ObjectMapper();
Report report = new Report();
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);
check("groups", json, analysis);
check("properties", json, analysis);
Expand Down
Expand Up @@ -49,11 +49,14 @@ public class CheckSpringConfigurationMetadata extends DefaultTask {

private List<String> exclusions = new ArrayList<>();

private final File projectDir;

private final RegularFileProperty reportLocation;

private final RegularFileProperty metadataLocation;

public CheckSpringConfigurationMetadata() {
this.projectDir = getProject().getProjectDir();
this.metadataLocation = getProject().getObjects().fileProperty();
this.reportLocation = getProject().getObjects().fileProperty();
}
Expand Down Expand Up @@ -93,7 +96,7 @@ void check() throws JsonParseException, IOException {
private Report createReport() throws IOException, JsonParseException, JsonMappingException {
ObjectMapper objectMapper = new ObjectMapper();
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);
List<Map<String, Object>> properties = (List<Map<String, Object>>) json.get("properties");
for (Map<String, Object> property : properties) {
Expand Down

0 comments on commit ddeb114

Please sign in to comment.