gradle-plugin, tests: Escape windows path separator in konan.home

This commit is contained in:
Ilya Matveev
2017-07-18 14:58:23 +07:00
committed by ilmat192
parent da3be1f04b
commit 2ed2b262d2
3 changed files with 18 additions and 8 deletions
@@ -63,9 +63,9 @@ dependencies {
}
test {
dependsOn ':dist'
dependsOn ':cross_dist'
//testLogging.showStandardStreams = true
systemProperty("konan.home", rootProject.file('dist'))
systemProperty("konan.home", rootProject.file('dist').canonicalPath)
}
jar {
@@ -185,7 +185,7 @@ class IncrementalSpecification extends Specification {
}
def results = buildTwice(project) { KonanInteropProject it ->
def manifest = it.generateSrcFile('manifest', "#some manifest file")
it.buildFile.append("konanArtifacts['main'].manifest '${manifest.canonicalPath}'")
it.buildFile.append("konanArtifacts['main'].manifest '${manifest.canonicalPath.replace('\\', '\\\\')}'")
}
then:
@@ -198,7 +198,7 @@ class IncrementalSpecification extends Specification {
def project = KonanInteropProject.createEmpty(tmpFolder) { KonanInteropProject it ->
it.generateSrcFile('main.kt')
manifest = it.generateSrcFile('manifest', "#some manifest file\n")
it.buildFile.append("konanArtifacts['main'].manifest '${manifest.canonicalPath}'")
it.buildFile.append("konanArtifacts['main'].manifest '${manifest.canonicalPath.replace('\\', '\\\\')}'")
}
def results = buildTwice(project) { KonanInteropProject it ->
manifest.append("#something else\n")
@@ -232,7 +232,7 @@ class IncrementalSpecification extends Specification {
project.generateSrcFile('main.kt')
def defFile = project.generateDefFile("foo.def", "#some content")
def results = buildTwice(project) { KonanInteropProject it ->
it.buildFile.append("konanInterop['stdio'].defFile file('${defFile.canonicalPath}')\n")
it.buildFile.append("konanInterop['stdio'].defFile file('${defFile.canonicalPath.replace('\\', '\\\\')}')\n")
}
then:
@@ -245,7 +245,7 @@ class IncrementalSpecification extends Specification {
project.generateSrcFile('main.kt')
def header = project.generateSrcFile('header.h', "#define CONST 1")
def results = buildTwice(project) { KonanInteropProject it ->
it.buildFile.append("konanInterop['stdio'].headers '${header.canonicalPath}'\n")
it.buildFile.append("konanInterop['stdio'].headers '${header.canonicalPath.replace('\\', '\\\\')}'\n")
}
then:
@@ -294,7 +294,7 @@ class IncrementalSpecification extends Specification {
recompilationAndInteropProcessingHappened(*results)
}
@IgnoreIf({ System.getProperty('os.name').contains('windows') })
@IgnoreIf(System.getProperty('os.name').contains('windows'))
def 'target change should cause recompilation and interop reprocessing'() {
when:
def newTarget
@@ -9,7 +9,7 @@ class KonanProject {
File getProjectDirRoot() { return projectDir.root }
String konanHome = System.getProperty("konan.home") ?: { throw new IllegalStateException("konan.home isn't specified") }()
String konanHome
File buildFile
File propertiesFile
@@ -26,6 +26,16 @@ class KonanProject {
protected KonanProject(TemporaryFolder projectDir) {
this.projectDir = projectDir
def konanHome = System.getProperty("konan.home")
if (konanHome == null) {
throw new IllegalStateException("konan.home isn't specified")
}
def konanHomeDir = new File(konanHome)
if (!konanHomeDir.exists() || !konanHomeDir.directory) {
throw new IllegalStateException("konan.home doesn't exist or is not a directory: $konanHomeDir.canonicalPath")
}
// Escape windows path separator
this.konanHome = konanHomeDir.canonicalPath.replace('\\', '\\\\')
}
void generateFolders() {