Bump Rewrite dependencies
- Remove SbmApplicationProperties, the properties live in SpringRewriteProperties - Fix import - Add new property parseAdditionalResources from OR
This commit is contained in:
8
pom.xml
8
pom.xml
@@ -30,10 +30,10 @@
|
||||
|
||||
<!-- prod dependencies -->
|
||||
<spring-boot.version>3.1.3</spring-boot.version>
|
||||
<rewrite.version>8.5.1</rewrite.version>
|
||||
<rewrite-kotlin.version>1.8.2</rewrite-kotlin.version>
|
||||
<rewrite-polyglot.version>1.8.9</rewrite-polyglot.version>
|
||||
<rewrite-maven-plugin.version>5.3.2</rewrite-maven-plugin.version>
|
||||
<rewrite.version>8.12.0</rewrite.version>
|
||||
<rewrite-kotlin.version>1.8.4</rewrite-kotlin.version>
|
||||
<rewrite-polyglot.version>1.8.11</rewrite-polyglot.version>
|
||||
<rewrite-maven-plugin.version>5.17.1</rewrite-maven-plugin.version>
|
||||
<jaxb-api.version>2.3.1</jaxb-api.version>
|
||||
|
||||
<!-- testing dependencies -->
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.rewrite.boot.autoconfigure.ScopeConfiguration;
|
||||
import org.springframework.rewrite.parsers.events.RewriteParsingEventListenerAdapter;
|
||||
import org.springframework.rewrite.parsers.maven.*;
|
||||
import org.springframework.rewrite.project.resource.SbmApplicationProperties;
|
||||
import org.springframework.rewrite.scopes.annotations.ScanScope;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -49,7 +48,7 @@ import java.util.function.Consumer;
|
||||
* @author Fabian Krüger
|
||||
*/
|
||||
@AutoConfiguration(after = { ScopeConfiguration.class })
|
||||
@EnableConfigurationProperties({ SpringRewriteProperties.class, SbmApplicationProperties.class })
|
||||
@EnableConfigurationProperties({ SpringRewriteProperties.class })
|
||||
@Import({ org.springframework.rewrite.scopes.ScanScope.class, ScopeConfiguration.class,
|
||||
RewriteParserMavenConfiguration.class })
|
||||
public class RewriteParserConfiguration {
|
||||
|
||||
@@ -87,6 +87,11 @@ public class SpringRewriteProperties {
|
||||
*/
|
||||
private boolean failOnInvalidActiveRecipes = true;
|
||||
|
||||
/**
|
||||
* Whether resources outside 'src/main/resoources' should be parsed.
|
||||
*/
|
||||
private boolean parseAdditionalResources = true;
|
||||
|
||||
public boolean isSkipMavenParsing() {
|
||||
return skipMavenParsing;
|
||||
}
|
||||
@@ -159,4 +164,12 @@ public class SpringRewriteProperties {
|
||||
this.failOnInvalidActiveRecipes = failOnInvalidActiveRecipes;
|
||||
}
|
||||
|
||||
public boolean isParseAdditionalResources() {
|
||||
return parseAdditionalResources;
|
||||
}
|
||||
|
||||
public void setParseAdditionalResources(boolean parseAdditionalResources) {
|
||||
this.parseAdditionalResources = parseAdditionalResources;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 - 2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.rewrite.project.resource;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ConfigurationProperties(prefix = "sbm")
|
||||
public class SbmApplicationProperties {
|
||||
|
||||
private boolean gitSupportEnabled;
|
||||
|
||||
private boolean muleTriggerMeshTransformEnabled;
|
||||
|
||||
private String defaultBasePackage;
|
||||
|
||||
private boolean writeInMavenLocal;
|
||||
|
||||
private boolean javaParserLoggingCompilationWarningsAndErrors;
|
||||
|
||||
private List<String> ignoredPathsPatterns = new ArrayList<>();
|
||||
|
||||
public void setIgnoredPathsPatterns(List<String> patterns) {
|
||||
List<String> absolutePatterns = patterns.stream()
|
||||
.filter(pattern -> pattern.startsWith("/"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!absolutePatterns.isEmpty()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Found absolute ignore paths patterns defined in sbm.ignoredPathsPatterns. Patterns must be relative and not start with '/'. Invalid patterns found: ['"
|
||||
+ String.join("', '", absolutePatterns) + "'].");
|
||||
}
|
||||
|
||||
this.ignoredPathsPatterns = patterns;
|
||||
}
|
||||
|
||||
public boolean isGitSupportEnabled() {
|
||||
return gitSupportEnabled;
|
||||
}
|
||||
|
||||
public void setGitSupportEnabled(boolean gitSupportEnabled) {
|
||||
this.gitSupportEnabled = gitSupportEnabled;
|
||||
}
|
||||
|
||||
public boolean isMuleTriggerMeshTransformEnabled() {
|
||||
return muleTriggerMeshTransformEnabled;
|
||||
}
|
||||
|
||||
public void setMuleTriggerMeshTransformEnabled(boolean muleTriggerMeshTransformEnabled) {
|
||||
this.muleTriggerMeshTransformEnabled = muleTriggerMeshTransformEnabled;
|
||||
}
|
||||
|
||||
public String getDefaultBasePackage() {
|
||||
return defaultBasePackage;
|
||||
}
|
||||
|
||||
public void setDefaultBasePackage(String defaultBasePackage) {
|
||||
this.defaultBasePackage = defaultBasePackage;
|
||||
}
|
||||
|
||||
public boolean isWriteInMavenLocal() {
|
||||
return writeInMavenLocal;
|
||||
}
|
||||
|
||||
public void setWriteInMavenLocal(boolean writeInMavenLocal) {
|
||||
this.writeInMavenLocal = writeInMavenLocal;
|
||||
}
|
||||
|
||||
public boolean isJavaParserLoggingCompilationWarningsAndErrors() {
|
||||
return javaParserLoggingCompilationWarningsAndErrors;
|
||||
}
|
||||
|
||||
public void setJavaParserLoggingCompilationWarningsAndErrors(
|
||||
boolean javaParserLoggingCompilationWarningsAndErrors) {
|
||||
this.javaParserLoggingCompilationWarningsAndErrors = javaParserLoggingCompilationWarningsAndErrors;
|
||||
}
|
||||
|
||||
public List<String> getIgnoredPathsPatterns() {
|
||||
return ignoredPathsPatterns;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,8 +26,8 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.ibm.icu.impl.Assert.fail;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Fail.fail;
|
||||
|
||||
/**
|
||||
* @author Fabian Krüger
|
||||
|
||||
@@ -101,14 +101,14 @@ public class CompareParserRecipeRunTest {
|
||||
// Run the Comparing Parser reusing OpenRewrite code
|
||||
RecipeRun compRecipeRun = recipe.run(new InMemoryLargeSourceSet(compParsingResult.sourceFiles()),
|
||||
executionContext);
|
||||
assertThat(counter.get()).isEqualTo(2);
|
||||
assertThat(counter.get()).isEqualTo(1);
|
||||
assertThat(compRecipeRun.getChangeset().getAllResults()).hasSize(1);
|
||||
|
||||
// Run Parser independent from Maven
|
||||
counter.setRelease(0);
|
||||
RecipeRun sutRecipeRun = recipe.run(new InMemoryLargeSourceSet(sutParsingResult.sourceFiles()),
|
||||
executionContext);
|
||||
assertThat(counter.get()).isEqualTo(2); // differs, should be 2
|
||||
assertThat(counter.get()).isEqualTo(1);
|
||||
assertThat(sutRecipeRun.getChangeset().getAllResults()).hasSize(1); // is 0
|
||||
}
|
||||
|
||||
|
||||
@@ -47,26 +47,23 @@ public class MavenMojoProjectParserFactory {
|
||||
|
||||
public MavenMojoProjectParser create(Path baseDir, List<MavenProject> mavenProjects,
|
||||
PlexusContainer plexusContainer, MavenSession session) {
|
||||
return buildMavenMojoProjectParser(baseDir, mavenProjects, springRewriteProperties.isPomCacheEnabled(),
|
||||
springRewriteProperties.getPomCacheDirectory(), springRewriteProperties.isSkipMavenParsing(),
|
||||
springRewriteProperties.getIgnoredPathPatterns(), springRewriteProperties.getPlainTextMasks(),
|
||||
springRewriteProperties.getSizeThresholdMb(), springRewriteProperties.isRunPerSubmodule(),
|
||||
plexusContainer, session);
|
||||
return buildMavenMojoProjectParser(baseDir, plexusContainer, session);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private MavenMojoProjectParser buildMavenMojoProjectParser(Path baseDir, List<MavenProject> mavenProjects,
|
||||
boolean pomCacheEnabled, String pomCacheDirectory, boolean skipMavenParsing, Collection<String> exclusions,
|
||||
Collection<String> plainTextMasks, int sizeThresholdMb, boolean runPerSubmodule,
|
||||
PlexusContainer plexusContainer, MavenSession session) {
|
||||
private MavenMojoProjectParser buildMavenMojoProjectParser(Path baseDir, PlexusContainer plexusContainer,
|
||||
MavenSession session) {
|
||||
try {
|
||||
Log logger = new Slf4jToMavenLoggerAdapter(LoggerFactory.getLogger(MavenMojoProjectParser.class));
|
||||
RuntimeInformation runtimeInformation = plexusContainer.lookup(RuntimeInformation.class);
|
||||
SettingsDecrypter decrypter = plexusContainer.lookup(SettingsDecrypter.class);
|
||||
|
||||
MavenMojoProjectParser sut = new MavenMojoProjectParser(logger, baseDir, pomCacheEnabled, pomCacheDirectory,
|
||||
runtimeInformation, skipMavenParsing, exclusions, plainTextMasks, sizeThresholdMb, session,
|
||||
decrypter, runPerSubmodule);
|
||||
MavenMojoProjectParser sut = new MavenMojoProjectParser(logger, baseDir,
|
||||
springRewriteProperties.isPomCacheEnabled(), springRewriteProperties.getPomCacheDirectory(),
|
||||
runtimeInformation, springRewriteProperties.isSkipMavenParsing(),
|
||||
springRewriteProperties.getIgnoredPathPatterns(), springRewriteProperties.getPlainTextMasks(),
|
||||
springRewriteProperties.getSizeThresholdMb(), session, decrypter,
|
||||
springRewriteProperties.isRunPerSubmodule(), springRewriteProperties.isParseAdditionalResources());
|
||||
|
||||
return sut;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class ProvenanceMarkerFactoryTest {
|
||||
GitProvenance expectedGitProvenance = GitProvenance.fromProjectDirectory(baseDir,
|
||||
BuildEnvironment.build(System::getenv));
|
||||
GitProvenance gitProvenance = findMarker(markers, GitProvenance.class);
|
||||
assertThat(countGetters(gitProvenance)).isEqualTo(9);
|
||||
assertThat(countGetters(gitProvenance)).isEqualTo(10);
|
||||
assertThat(gitProvenance.getId()).isInstanceOf(UUID.class);
|
||||
assertThat(gitProvenance.getBranch()).isEqualTo(branch);
|
||||
assertThat(gitProvenance.getEol()).isEqualTo(GitProvenance.EOL.Native);
|
||||
@@ -139,6 +139,8 @@ class ProvenanceMarkerFactoryTest {
|
||||
assertThat(gitProvenance.getChange()).isEqualTo(gitHash);
|
||||
assertThat(gitProvenance.getOrganizationName()).isEqualTo("spring-projects");
|
||||
assertThat(gitProvenance.getOrganizationName("https://github.com")).isEqualTo("spring-projects");
|
||||
assertThat(gitProvenance.getCommitters()).isNotNull(); // notEmpty failed
|
||||
// in GH
|
||||
|
||||
OperatingSystemProvenance operatingSystemProvenance = findMarker(markers,
|
||||
OperatingSystemProvenance.class);
|
||||
|
||||
Reference in New Issue
Block a user