Skip to content

Commit 4c6678e

Browse files
committed
Use URI for flat directory so tests work on Windows (#350)
1 parent 910a8f8 commit 4c6678e

File tree

5 files changed

+35
-12
lines changed

5 files changed

+35
-12
lines changed

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
2020
setup:
2121
withDependencies "gems ${slimGem}"
2222
withPreamble """
23-
jruby.gemInstallDir = '${projectDir.absolutePath}'
23+
jruby.gemInstallDir = '${pathAsUriStr(projectDir)}'.toURI()
2424
"""
2525

2626
when:
@@ -35,7 +35,7 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
3535
setup:
3636
withDefaultRepositories()
3737
withPreamble """
38-
jruby.gemInstallDir = '${projectDir.absolutePath}'
38+
jruby.gemInstallDir = '${pathAsUriStr(projectDir)}'.toURI()
3939
"""
4040
withDependencies """
4141
gems "rubygems:sinatra:1.4.5"
@@ -57,7 +57,7 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
5757
setup:
5858
withDefaultRepositories()
5959
withPreamble """
60-
jruby.gemInstallDir = '${projectDir.absolutePath}'
60+
jruby.gemInstallDir = '${pathAsUriStr(projectDir)}'.toURI()
6161
"""
6262
withDependencies 'gems "rubygems:jar-dependencies:0.1.16.pre"'
6363

@@ -74,7 +74,7 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
7474
setup:
7575
withDefaultRepositories()
7676
withPreamble """
77-
jruby.gemInstallDir = '${projectDir.absolutePath}'
77+
jruby.gemInstallDir = '${pathAsUriStr(projectDir)}'.toURI()
7878
"""
7979
withDependencies 'gems "rubygems:childprocess:1.0.1"'
8080

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class JRubyPrepareJarsIntegrationSpec extends IntegrationSpecification {
1212
given:
1313
buildFile.text = """
1414
${projectWithLocalRepo}
15-
jruby.gemInstallDir = '${projectDir.absolutePath}'
15+
jruby.gemInstallDir = '${pathAsUriStr(projectDir)}'.toURI()
1616
1717
dependencies {
1818
gems 'io.dropwizard.metrics:metrics-core:3.1.0'

base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,22 @@ class IntegrationSpecification extends Specification {
5454
"'${VersionFinder.findDependency(flatRepoLocation, organisation, artifact, extension)}'"
5555
}
5656

57+
String pathAsUriStr(final File path) {
58+
path.absoluteFile.toURI().toString()
59+
}
60+
5761
String getProjectWithLocalRepo() {
5862
"""
5963
plugins {
6064
id 'com.github.jruby-gradle.base'
6165
}
6266
6367
jruby.defaultRepositories = false
64-
repositories.flatDir dirs: '${flatRepoLocation.absolutePath}'
68+
repositories {
69+
flatDir {
70+
dirs '${pathAsUriStr(flatRepoLocation)}'.toURI()
71+
}
72+
}
6573
"""
6674
}
6775

@@ -72,8 +80,15 @@ class IntegrationSpecification extends Specification {
7280
}
7381
7482
jruby.defaultRepositories = false
75-
repositories.maven { url 'file://${mavenRepoLocation.absolutePath}' }
76-
repositories.flatDir dirs: '${flatRepoLocation.absolutePath}'
83+
84+
repositories {
85+
flatDir {
86+
dirs '${pathAsUriStr(flatRepoLocation)}'.toURI()
87+
}
88+
maven {
89+
url '${pathAsUriStr(mavenRepoLocation)}'.toURI()
90+
}
91+
}
7792
"""
7893
}
7994

@@ -84,7 +99,7 @@ class IntegrationSpecification extends Specification {
8499
}
85100
86101
jruby.defaultRepositories = true
87-
repositories.maven { url 'file://${mavenRepoLocation.absolutePath}' }
102+
repositories.maven { url '${pathAsUriStr(mavenRepoLocation)}'.toURI() }
88103
"""
89104
}
90105

jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/JRubyJarTestKitSpec.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,13 @@ class JRubyJarTestKitSpec extends IntegrationSpecification {
169169

170170
private void withLocalRepositories() {
171171
this.repoSetup = """
172-
repositories {
173-
repositories.flatDir dirs: '${flatRepoLocation.absolutePath}'
174-
repositories.maven { url 'file://${mavenRepoLocation.absolutePath}' }
172+
repositories {
173+
flatDir {
174+
dirs '${pathAsUriStr(flatRepoLocation)}'
175+
}
176+
maven {
177+
url '${pathAsUriStr(mavenRepoLocation)}'
178+
}
175179
}
176180
"""
177181
}

jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/helpers/IntegrationSpecification.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class IntegrationSpecification extends Specification {
4646
.forwardOutput()
4747
}
4848

49+
String pathAsUriStr(final File path) {
50+
path.absoluteFile.toURI().toString()
51+
}
52+
4953
private Map<String, String> loadTestProperties() {
5054
this.class.getResource('/jruby-gradle-testconfig.properties').withInputStream { strm ->
5155
Properties props = new Properties()

0 commit comments

Comments
 (0)