gradle-plugin, tests: Escape windows path separator in konan.home
This commit is contained in:
@@ -63,9 +63,9 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
dependsOn ':dist'
|
dependsOn ':cross_dist'
|
||||||
//testLogging.showStandardStreams = true
|
//testLogging.showStandardStreams = true
|
||||||
systemProperty("konan.home", rootProject.file('dist'))
|
systemProperty("konan.home", rootProject.file('dist').canonicalPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
+5
-5
@@ -185,7 +185,7 @@ class IncrementalSpecification extends Specification {
|
|||||||
}
|
}
|
||||||
def results = buildTwice(project) { KonanInteropProject it ->
|
def results = buildTwice(project) { KonanInteropProject it ->
|
||||||
def manifest = it.generateSrcFile('manifest', "#some manifest file")
|
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:
|
then:
|
||||||
@@ -198,7 +198,7 @@ class IncrementalSpecification extends Specification {
|
|||||||
def project = KonanInteropProject.createEmpty(tmpFolder) { KonanInteropProject it ->
|
def project = KonanInteropProject.createEmpty(tmpFolder) { KonanInteropProject it ->
|
||||||
it.generateSrcFile('main.kt')
|
it.generateSrcFile('main.kt')
|
||||||
manifest = it.generateSrcFile('manifest', "#some manifest file\n")
|
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 ->
|
def results = buildTwice(project) { KonanInteropProject it ->
|
||||||
manifest.append("#something else\n")
|
manifest.append("#something else\n")
|
||||||
@@ -232,7 +232,7 @@ class IncrementalSpecification extends Specification {
|
|||||||
project.generateSrcFile('main.kt')
|
project.generateSrcFile('main.kt')
|
||||||
def defFile = project.generateDefFile("foo.def", "#some content")
|
def defFile = project.generateDefFile("foo.def", "#some content")
|
||||||
def results = buildTwice(project) { KonanInteropProject it ->
|
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:
|
then:
|
||||||
@@ -245,7 +245,7 @@ class IncrementalSpecification extends Specification {
|
|||||||
project.generateSrcFile('main.kt')
|
project.generateSrcFile('main.kt')
|
||||||
def header = project.generateSrcFile('header.h', "#define CONST 1")
|
def header = project.generateSrcFile('header.h', "#define CONST 1")
|
||||||
def results = buildTwice(project) { KonanInteropProject it ->
|
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:
|
then:
|
||||||
@@ -294,7 +294,7 @@ class IncrementalSpecification extends Specification {
|
|||||||
recompilationAndInteropProcessingHappened(*results)
|
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'() {
|
def 'target change should cause recompilation and interop reprocessing'() {
|
||||||
when:
|
when:
|
||||||
def newTarget
|
def newTarget
|
||||||
|
|||||||
+11
-1
@@ -9,7 +9,7 @@ class KonanProject {
|
|||||||
|
|
||||||
File getProjectDirRoot() { return projectDir.root }
|
File getProjectDirRoot() { return projectDir.root }
|
||||||
|
|
||||||
String konanHome = System.getProperty("konan.home") ?: { throw new IllegalStateException("konan.home isn't specified") }()
|
String konanHome
|
||||||
|
|
||||||
File buildFile
|
File buildFile
|
||||||
File propertiesFile
|
File propertiesFile
|
||||||
@@ -26,6 +26,16 @@ class KonanProject {
|
|||||||
|
|
||||||
protected KonanProject(TemporaryFolder projectDir) {
|
protected KonanProject(TemporaryFolder projectDir) {
|
||||||
this.projectDir = 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() {
|
void generateFolders() {
|
||||||
|
|||||||
Reference in New Issue
Block a user