Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp/945 decouple sbm support rewrite from maven #946

Merged
6 changes: 3 additions & 3 deletions .github/workflows/build-sbm-revamp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
run: mvn -DskipTests --batch-mode install --projects :sbm-support-weblogic

- name: sbm-recipes-jee-to-boot (build)
run: mvn -DskipTests --batch-mode --projects :sbm-recipes-jee-to-boot
run: mvn -DskipTests --batch-mode install --projects :sbm-recipes-jee-to-boot

- name: sbm-recipes-spring-cloud (build)
run: mvn -DskipTests --batch-mode --projects :sbm-recipes-spring-cloud
run: mvn -DskipTests --batch-mode install --projects :sbm-recipes-spring-cloud

- name: sbm-recipes-boot-upgrade (build)
run: mvn -DskipTests --batch-mode --projects :sbm-recipes-boot-upgrade
run: mvn -DskipTests --batch-mode install --projects :sbm-recipes-boot-upgrade
5 changes: 5 additions & 0 deletions components/recipe-test-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<type>test-jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.springframework.core.io.Resource;
import org.springframework.sbm.engine.commands.ScanCommand;
import org.springframework.sbm.engine.context.ProjectContext;
import org.springframework.sbm.parsers.RewriteExecutionContext;
import org.springframework.sbm.project.parser.ProjectContextInitializer;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.sbm.test;

import org.apache.commons.io.FileUtils;
import org.springframework.sbm.engine.commands.ApplicableRecipeListCommand;
import org.springframework.sbm.engine.commands.ApplyCommand;
import org.springframework.sbm.engine.commands.ScanCommand;
Expand All @@ -26,7 +27,6 @@
import freemarker.template.Configuration;
import lombok.AccessLevel;
import lombok.Setter;
import org.apache.commons.io.FileUtils;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;

Expand Down
8 changes: 7 additions & 1 deletion components/sbm-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.14.1</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@
import org.springframework.sbm.engine.context.ProjectContextHolder;
import org.springframework.sbm.java.api.JavaSource;
import org.springframework.sbm.parsers.JavaParserBuilder;
import org.springframework.sbm.parsers.SortedProjects;
import org.springframework.sbm.parsers.SourceFileParser;
import org.springframework.sbm.utils.JavaHelper;
import org.springframework.stereotype.Component;

import java.io.ByteArrayInputStream;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Stream;

/**
* @author Fabian Krüger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,18 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Parser;
import org.openrewrite.SourceFile;
import org.openrewrite.internal.ListUtils;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.marker.JavaSourceSet;
import org.openrewrite.java.tree.J;
import org.openrewrite.marker.GitProvenance;
import org.openrewrite.marker.Marker;
import org.openrewrite.marker.ci.BuildEnvironment;
import org.openrewrite.maven.MavenExecutionContextView;
import org.openrewrite.maven.MavenSettings;
import org.openrewrite.maven.tree.*;
import org.openrewrite.maven.utilities.MavenArtifactDownloader;
import org.openrewrite.xml.tree.Xml;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.io.Resource;
import org.springframework.sbm.build.impl.MavenBuildFileUtil;
import org.springframework.sbm.build.impl.RewriteMavenParser;
import org.springframework.sbm.engine.events.*;
import org.springframework.sbm.parsers.RewriteMavenProjectParser;
import org.springframework.sbm.parsers.RewriteProjectParser;
import org.springframework.sbm.scopes.ProjectMetadata;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;

/**
* Parse a Maven project on disk into a list of {@link org.openrewrite.SourceFile} including
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.springframework.beans.factory.UnsatisfiedDependencyException;
import org.springframework.sbm.engine.context.ProjectContext;
import org.springframework.sbm.java.api.JavaSourceAndType;
import org.springframework.sbm.parsers.MavenExecutionResultException;
import org.springframework.sbm.project.resource.TestProjectContext;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.springframework.sbm.project.resource;

import freemarker.template.Configuration;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.jetbrains.annotations.NotNull;
import org.openrewrite.ExecutionContext;
Expand All @@ -31,7 +30,6 @@
import org.springframework.sbm.build.impl.OpenRewriteMavenBuildFile;
import org.springframework.sbm.engine.context.ProjectContext;
import org.springframework.sbm.engine.context.ProjectContextSerializer;
import org.springframework.sbm.java.impl.RewriteJavaParser;
import org.springframework.sbm.java.util.JavaSourceUtil;
import org.springframework.sbm.project.TestDummyResource;
import org.springframework.sbm.project.parser.DependencyHelper;
Expand Down Expand Up @@ -190,7 +188,7 @@ private static Path createProjectRoot() {
Path sbm = tempDirectory.resolve("sbm");
// FileUtils.cleanDirectory(sbm.toFile());
Path randDir = sbm.resolve(RandomStringUtils.randomAlphanumeric(5));
FileUtils.forceMkdir(randDir.toFile());
Files.createDirectories(randDir);
return randDir;
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down Expand Up @@ -596,9 +594,12 @@ public ProjectContext build() {
executionContext);
*/

// Writing to filesystem and parsing again changes th eresource order
// Writing to filesystem and parsing again changes the resource order
try {
FileUtils.cleanDirectory(projectRoot.toFile());
Files.walk(projectRoot)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
15 changes: 15 additions & 0 deletions components/sbm-openrewrite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@
<artifactId>sbm-support-rewrite</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.openrewrite</groupId>
<artifactId>rewrite-java-17</artifactId>
<version>${openrewrite.version}</version>
</dependency>
<dependency>
<groupId>org.rocksdb</groupId>
<artifactId>rocksdbjni</artifactId>
<version>8.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions components/sbm-recipes-jee-to-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
<artifactId>sbm-support-jee</artifactId>
<version>0.15.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
</dependency>

<!-- Override Jackson coming from spring boot -->
<!-- <dependency>-->
Expand Down
20 changes: 10 additions & 10 deletions components/test-helper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
<artifactId>spring-core</artifactId>
</dependency>

<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-spi</artifactId>
<version>1.9.15</version>
</dependency>

<!-- shrinkwrap -->
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
Expand Down Expand Up @@ -77,11 +71,17 @@
<artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId>
<version>${shrinkwrap.resolvers.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.jboss.shrinkwrap.resolver</groupId>-->
<!-- <artifactId>shrinkwrap-resolver-bom</artifactId>-->
<!-- <version>${shrinkwrap.resolvers.version}</version>-->
<!-- <type>pom</type>-->
<!-- </dependency>-->

<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>${shrinkwrap.resolvers.version}</version>
<type>pom</type>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-spi</artifactId>
<version>1.9.15</version>
</dependency>
</dependencies>
</project>
51 changes: 26 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,26 @@
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<version>1.9.14</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>1.9.14</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-impl</artifactId>
<version>1.9.14</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.wagon</groupId>-->
<!-- <artifactId>wagon-http</artifactId>-->
<!-- <version>3.5.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.resolver</groupId>-->
<!-- <artifactId>maven-resolver-transport-http</artifactId>-->
<!-- <version>1.9.14</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.resolver</groupId>-->
<!-- <artifactId>maven-resolver-api</artifactId>-->
<!-- <version>1.9.14</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.resolver</groupId>-->
<!-- <artifactId>maven-resolver-impl</artifactId>-->
<!-- <version>1.9.14</version>-->
<!-- </dependency>-->

<dependency>
<groupId>org.projectlombok</groupId>
Expand Down Expand Up @@ -131,11 +131,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>${maven-invoker.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.maven.shared</groupId>-->
<!-- <artifactId>maven-invoker</artifactId>-->
<!-- <version>${maven-invoker.version}</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.openrewrite</groupId>
<artifactId>rewrite-core</artifactId>
Expand Down
Loading
Loading