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

Add Windows build profile #1011

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ammachado
Copy link
Contributor

@ammachado ammachado commented Nov 22, 2023

Add a new windows profile to the maven build to simulate Windows line endings on a Linux/macOS machine.

Build the build is still failing, even considering the work done on #958, #965 and #969.

Run mvn -Pwindows clean install to verify the failing tests.

@fabapp2
Copy link
Contributor

fabapp2 commented Nov 23, 2023

Hi @ammachado
Thank you for keeping up the great work. 🚀

What doesn't work when you build the current main branch under Windows?
"It works on my machine" 😬

image

@ammachado
Copy link
Contributor Author

Hi @fabapp2, thanks for looking into this.

I'm using a Windows VM on my macOS machine, and I'm running the arm64 version of Windows 11 22H2 (Microsoft Windows [Version 10.0.22621.2715]), using Microsoft Build of OpenJDK with Hotspot 17.0.9+8:

openjdk version "17.0.9" 2023-10-17 LTS
OpenJDK Runtime Environment Microsoft-8552009 (build 17.0.9+8-LTS)
OpenJDK 64-Bit Server VM Microsoft-8552009 (build 17.0.9+8-LTS, mixed mode)

I had to make two small changes to get the project running: RocksDB is not supported on Windows Arm64 (no substitute) and Snappy must be upgraded to work on Windows Amr64:

diff --git a/components/sbm-core/src/main/java/org/springframework/sbm/build/migration/MavenPomCacheProvider.java b/components/sbm-core/src/main/java/org/springframework/sbm/build/migration/MavenPomCacheProvider.java
index 1036ff29..095dbbb6 100644
--- a/components/sbm-core/src/main/java/org/springframework/sbm/build/migration/MavenPomCacheProvider.java
+++ b/components/sbm-core/src/main/java/org/springframework/sbm/build/migration/MavenPomCacheProvider.java
@@ -31,7 +31,7 @@ public class MavenPomCacheProvider {
        private final MavenPomCache pomCache;

        public MavenPomCacheProvider(Optional<MavenPomCache> mavenPomCacheProvider) {
-               this.pomCache = mavenPomCacheProvider.orElseGet(this::rocksdb);
+               this.pomCache = mavenPomCacheProvider.orElseGet(org.openrewrite.maven.cache.InMemoryMavenPomCache::new);
        }

        @NotNull
diff --git a/pom.xml b/pom.xml
index 17874499..ec6002c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,6 +266,12 @@
                 <artifactId>spring-asciidoctor-backends</artifactId>
                 <version>${spring-asciidoctor-backends.version}</version>
             </dependency>
+
+            <dependency>
+                <groupId>org.xerial.snappy</groupId>
+                <artifactId>snappy-java</artifactId>
+                <version>1.1.10.5</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <dependencies>

And this is what I get:

[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   RemovedPropertyTest.removeProperties:48 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeProperties:48 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeProperties:48 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeProperties:48 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeProperties:48 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeProperties:48 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeYaml:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeYaml:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeYaml:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeYaml:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeYaml:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   RemovedPropertyTest.removeYaml:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runPropertiesTestsDataSource:49 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runPropertiesTestsDataSource:49 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runPropertiesTestsDataSource:49 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runPropertiesTestsDataSource:49 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runYamlTestsData:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runYamlTestsData:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runYamlTestsData:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[ERROR]   UpdatePropertyTest.runYamlTestsData:37 » ArrayIndexOutOfBounds Index 1 out of bounds for length 1
[INFO]
[ERROR] Tests run: 238, Failures: 0, Errors: 20, Skipped: 4
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for spring-boot-migrator 0.15.2-SNAPSHOT:
[INFO]
[INFO] spring-boot-migrator ............................... SUCCESS [  1.385 s]
[INFO] test-helper ........................................ SUCCESS [  1.721 s]
[INFO] sbm-openrewrite .................................... SUCCESS [ 50.446 s]
[INFO] sbm-utils .......................................... SUCCESS [  0.160 s]
[INFO] sbm-core ........................................... SUCCESS [02:35 min]
[INFO] recipe-test-support ................................ SUCCESS [  0.181 s]
[INFO] sbm-support-boot ................................... SUCCESS [01:07 min]
[INFO] sbm-recipes-spring-framework ....................... SUCCESS [ 20.216 s]
[INFO] sbm-support-jee .................................... SUCCESS [ 15.997 s]
[INFO] sbm-recipes-jee-to-boot ............................ SUCCESS [02:04 min]
[INFO] sbm-recipes-mule-to-boot ........................... SUCCESS [02:02 min]
[INFO] sbm-recipes-spring-cloud ........................... SUCCESS [ 32.383 s]
[INFO] openrewrite-spring-recipes ......................... SUCCESS [ 16.272 s]
[INFO] sbm-support-weblogic ............................... SUCCESS [ 17.658 s]
[INFO] sbm-recipes-boot-upgrade ........................... FAILURE [03:31 min]
[INFO] spring-shell ....................................... SKIPPED
[INFO] spring-boot-upgrade ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13:58 min
[INFO] Finished at: 2023-11-23T15:47:23-08:00
[INFO] ------------------------------------------------------------------------

This fixes the problem:

diff --git a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/config/ConfigRecipeTestHelper.java b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/config/ConfigRecipeTestHelper.java
index 9dc167e6..1901a597 100644
--- a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/config/ConfigRecipeTestHelper.java
+++ b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/config/ConfigRecipeTestHelper.java
@@ -62,9 +62,9 @@ public class ConfigRecipeTestHelper {
     public static Pair<String, String> provideIO(String inputFilePath) throws IOException {

         String fileContent = Files.readString(Path.of(inputFilePath));
-        String[] k = fileContent.split("expected:.*" + LS);
+        String[] k = fileContent.split("expected:.*" + System.lineSeparator());

-        return new ImmutablePair<>(k[0].replaceAll("input:.*" + LS, ""), k[1]);
+        return new ImmutablePair<>(k[0].replaceAll("input:.*" + System.lineSeparator(), ""), k[1]);
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants