Skip to content

Commit c87de63

Browse files
committed
change testing dir and use repo with whitespaces
1 parent 988cfad commit c87de63

File tree

4 files changed

+29
-32
lines changed

4 files changed

+29
-32
lines changed

.github/actions/prepare-environment/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ runs:
5252
git config --global user.name 'graalvm bot'
5353
git config --global user.email 'graalvmbot@users.noreply.github.com'
5454
echo "org.ajoberstar.grgit.auth.command.allow=true" >> gradle.properties
55-
mkdir -p ~/test with whitespaces/.m2

.github/workflows/test-native-maven-plugin.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,3 @@ jobs:
6868
with:
6969
name: maven-functional-tests-results-${{ matrix.os }}
7070
path: native-maven-plugin/build/reports/tests/
71-
72-
test-native-maven-plugin-with-whitespaces:
73-
name: "🧪 Maven: ${{ matrix.test }} on ${{ matrix.os }}"
74-
runs-on: ${{ matrix.os }}
75-
timeout-minutes: 60
76-
needs: populate-matrix
77-
strategy:
78-
fail-fast: false
79-
matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}}
80-
steps:
81-
- name: "☁️ Checkout repository"
82-
uses: actions/checkout@v4
83-
- name: "🔧 Prepare environment"
84-
uses: ./.github/actions/prepare-environment
85-
with:
86-
java-version: ${{ matrix.java-version }}
87-
github-token: ${{ secrets.GITHUB_TOKEN }}
88-
- name: "Set .m2 location to a folder with whitespaces"
89-
run: echo "MAVEN_OPTS=-Dmaven.repo.local=~/test with whitespaces/.m2" >> $GITHUB_ENV
90-
- name: "❓ Check and test the plugin"
91-
run: ./gradlew :native-maven-plugin:functionalTest --no-daemon --fail-fast --tests ${{ matrix.test }}
92-
- name: "📜 Upload unit test results"
93-
if: always()
94-
uses: actions/upload-artifact@v3
95-
with:
96-
name: maven-functional-tests-results-${{ matrix.os }}
97-
path: native-maven-plugin/build/reports/tests/

native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeImageMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ protected List<String> getBuildArgs() throws MojoExecutionException {
244244
if (buildArgs != null && !buildArgs.isEmpty()) {
245245
for (String buildArg : buildArgs) {
246246
if(buildArg.startsWith("\\Q") ||
247-
buildArg.startsWith("--H:ConfigurationFileDirectories")) {
247+
buildArg.startsWith("-H:ConfigurationFileDirectories")) {
248248
cliArgs.add(buildArg);
249249
continue;
250250
}
251251
String[] args = buildArg.split("\\s+");
252252
int i=0;
253253
while(i < args.length) {
254254
String a =args[i];
255-
if (a.startsWith(""+System.getProperty("user.home").charAt(0))) {
255+
if (a.charAt(0) == System.getProperty("user.home").charAt(0)) {
256256
StringBuilder path = new StringBuilder(a);
257257
i++;
258258
while( i< args.length && args[i].toLowerCase().charAt(0) <= 'z' &&

native-maven-plugin/src/testFixtures/groovy/org/graalvm/buildtools/maven/AbstractGraalVMMavenFunctionalTest.groovy

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ import org.eclipse.jetty.server.handler.ResourceHandler
4949
import spock.lang.Specification
5050
import spock.lang.TempDir
5151

52+
import java.nio.file.FileVisitResult
5253
import java.nio.file.Files
5354
import java.nio.file.Path
55+
import java.nio.file.SimpleFileVisitor
5456
import java.nio.file.StandardCopyOption
57+
import java.nio.file.attribute.BasicFileAttributes
5558

5659
abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
57-
@TempDir
60+
5861
Path testDirectory
5962

6063
Path testOrigin;
@@ -71,6 +74,13 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
7174
boolean IS_MAC = System.getProperty("os.name", "unknown").contains("Mac");
7275

7376
def setup() {
77+
var home_dir = Path.of(System.getProperty("user.home"))
78+
testDirectory = home_dir.resolve("tests")
79+
80+
if (Files.notExists(testDirectory)) {
81+
Files.createDirectory(testDirectory)
82+
}
83+
7484
executor = new IsolatedMavenExecutor(
7585
new File(System.getProperty("java.executable")),
7686
testDirectory.resolve("m2-home").toFile(),
@@ -79,6 +89,21 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
7989
}
8090

8191
def cleanup() {
92+
93+
//cleanup test directory and all it's sub directories
94+
Files.walkFileTree(testDirectory, new SimpleFileVisitor<Path>() {
95+
@Override
96+
FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
97+
Files.delete(file);
98+
return FileVisitResult.CONTINUE;
99+
}
100+
@Override
101+
FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
102+
Files.delete(dir);
103+
return FileVisitResult.CONTINUE;
104+
}
105+
});
106+
82107
if (server != null) {
83108
server.stop()
84109
server.destroy()
@@ -158,7 +183,7 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
158183
var resultingSystemProperties = [
159184
"common.repo.uri": System.getProperty("common.repo.uri"),
160185
"seed.repo.uri": System.getProperty("seed.repo.uri"),
161-
"maven.repo.local": testDirectory.resolve("local-repo").toFile().absolutePath
186+
"maven.repo.local": testDirectory.resolve("local repo").toFile().absolutePath
162187
]
163188
resultingSystemProperties.putAll(systemProperties)
164189

0 commit comments

Comments
 (0)