diff --git a/.github/actions/prepare-environment/action.yml b/.github/actions/prepare-environment/action.yml index 18627d6a4..e23595052 100644 --- a/.github/actions/prepare-environment/action.yml +++ b/.github/actions/prepare-environment/action.yml @@ -52,4 +52,3 @@ runs: git config --global user.name 'graalvm bot' git config --global user.email 'graalvmbot@users.noreply.github.com' echo "org.ajoberstar.grgit.auth.command.allow=true" >> gradle.properties - mkdir -p ~/test with whitespaces/.m2 diff --git a/.github/workflows/test-native-maven-plugin.yml b/.github/workflows/test-native-maven-plugin.yml index 874fcb9a1..3e13d60dd 100644 --- a/.github/workflows/test-native-maven-plugin.yml +++ b/.github/workflows/test-native-maven-plugin.yml @@ -68,30 +68,3 @@ jobs: with: name: maven-functional-tests-results-${{ matrix.os }} path: native-maven-plugin/build/reports/tests/ - - test-native-maven-plugin-with-whitespaces: - name: "๐Ÿงช Maven: ${{ matrix.test }} on ${{ matrix.os }}" - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - needs: populate-matrix - strategy: - fail-fast: false - matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}} - steps: - - name: "โ˜๏ธ Checkout repository" - uses: actions/checkout@v4 - - name: "๐Ÿ”ง Prepare environment" - uses: ./.github/actions/prepare-environment - with: - java-version: ${{ matrix.java-version }} - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "Set .m2 location to a folder with whitespaces" - run: echo "MAVEN_OPTS=-Dmaven.repo.local=~/test with whitespaces/.m2" >> $GITHUB_ENV - - name: "โ“ Check and test the plugin" - run: ./gradlew :native-maven-plugin:functionalTest --no-daemon --fail-fast --tests ${{ matrix.test }} - - name: "๐Ÿ“œ Upload unit test results" - if: always() - uses: actions/upload-artifact@v3 - with: - name: maven-functional-tests-results-${{ matrix.os }} - path: native-maven-plugin/build/reports/tests/ diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeImageMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeImageMojo.java index 9404bdba0..c05e2f37e 100644 --- a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeImageMojo.java +++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeImageMojo.java @@ -244,7 +244,7 @@ protected List getBuildArgs() throws MojoExecutionException { if (buildArgs != null && !buildArgs.isEmpty()) { for (String buildArg : buildArgs) { if(buildArg.startsWith("\\Q") || - buildArg.startsWith("--H:ConfigurationFileDirectories")) { + buildArg.startsWith("-H:ConfigurationFileDirectories")) { cliArgs.add(buildArg); continue; } @@ -252,7 +252,7 @@ protected List getBuildArgs() throws MojoExecutionException { int i=0; while(i < args.length) { String a =args[i]; - if (a.startsWith(""+System.getProperty("user.home").charAt(0))) { + if (a.charAt(0) == System.getProperty("user.home").charAt(0)) { StringBuilder path = new StringBuilder(a); i++; while( i< args.length && args[i].toLowerCase().charAt(0) <= 'z' && diff --git a/native-maven-plugin/src/testFixtures/groovy/org/graalvm/buildtools/maven/AbstractGraalVMMavenFunctionalTest.groovy b/native-maven-plugin/src/testFixtures/groovy/org/graalvm/buildtools/maven/AbstractGraalVMMavenFunctionalTest.groovy index 00c593bc6..8bd27d470 100644 --- a/native-maven-plugin/src/testFixtures/groovy/org/graalvm/buildtools/maven/AbstractGraalVMMavenFunctionalTest.groovy +++ b/native-maven-plugin/src/testFixtures/groovy/org/graalvm/buildtools/maven/AbstractGraalVMMavenFunctionalTest.groovy @@ -49,12 +49,15 @@ import org.eclipse.jetty.server.handler.ResourceHandler import spock.lang.Specification import spock.lang.TempDir +import java.nio.file.FileVisitResult import java.nio.file.Files import java.nio.file.Path +import java.nio.file.SimpleFileVisitor import java.nio.file.StandardCopyOption +import java.nio.file.attribute.BasicFileAttributes abstract class AbstractGraalVMMavenFunctionalTest extends Specification { - @TempDir + Path testDirectory Path testOrigin; @@ -71,6 +74,13 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification { boolean IS_MAC = System.getProperty("os.name", "unknown").contains("Mac"); def setup() { + var home_dir = Path.of(System.getProperty("user.home")) + testDirectory = home_dir.resolve("tests") + + if (Files.notExists(testDirectory)) { + Files.createDirectory(testDirectory) + } + executor = new IsolatedMavenExecutor( new File(System.getProperty("java.executable")), testDirectory.resolve("m2-home").toFile(), @@ -79,6 +89,21 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification { } def cleanup() { + + //cleanup test directory and all it's sub directories + Files.walkFileTree(testDirectory, new SimpleFileVisitor() { + @Override + FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return FileVisitResult.CONTINUE; + } + @Override + FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + }); + if (server != null) { server.stop() server.destroy() @@ -158,7 +183,7 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification { var resultingSystemProperties = [ "common.repo.uri": System.getProperty("common.repo.uri"), "seed.repo.uri": System.getProperty("seed.repo.uri"), - "maven.repo.local": testDirectory.resolve("local-repo").toFile().absolutePath + "maven.repo.local": testDirectory.resolve("local repo").toFile().absolutePath ] resultingSystemProperties.putAll(systemProperties)