From 1d3e9a6ffa6fdb48e35a28c53bc534b9ad6bb2d8 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Fri, 11 Aug 2017 19:18:15 +0700 Subject: [PATCH] gradle-plugin, tests: Create directories in the 'createFile' method --- .../gradle/plugin/test/IncrementalSpecification.groovy | 3 --- .../kotlin/gradle/plugin/test/KonanProject.groovy | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/IncrementalSpecification.groovy b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/IncrementalSpecification.groovy index 22215c9b3ab..9a5cf62f963 100644 --- a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/IncrementalSpecification.groovy +++ b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/IncrementalSpecification.groovy @@ -119,7 +119,6 @@ class IncrementalSpecification extends BaseKonanSpecification { when: def project = KonanInteropProject.createEmpty(projectDirectory) { KonanInteropProject it -> it.generateSrcFile('main.kt') - it.createSubDir('src', 'foo', 'kotlin') it.generateSrcFile(["src", "foo", "kotlin"], 'bar.kt', """ fun main(args: Array) { println("Hello!") } """.stripIndent()) @@ -137,7 +136,6 @@ class IncrementalSpecification extends BaseKonanSpecification { when: def project = KonanInteropProject.createEmpty(projectDirectory) { KonanInteropProject it -> it.generateSrcFile('main.kt') - it.createSubDir('src', 'lib', 'kotlin') it.generateSrcFile(["src", "lib", "kotlin"], "lib.kt", "fun bar() { println(\"Hello!\") }") it.buildFile.append(""" konanArtifacts { @@ -254,7 +252,6 @@ class IncrementalSpecification extends BaseKonanSpecification { when: def project = KonanInteropProject.createEmpty(projectDirectory) { KonanInteropProject it -> it.generateSrcFile('main.kt') - it.createSubDir('src', 'lib', 'kotlin') it.generateSrcFile(["src", "lib", "kotlin"], 'lib.kt', 'fun foo() { println(42) }') it.buildFile.append(""" konanArtifacts { diff --git a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/KonanProject.groovy b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/KonanProject.groovy index 4ecf3d91a10..8eac3dd1eb1 100644 --- a/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/KonanProject.groovy +++ b/tools/kotlin-native-gradle-plugin/src/test/groovy/org/jetbrains/kotlin/gradle/plugin/test/KonanProject.groovy @@ -59,7 +59,9 @@ class KonanProject { /** Creates a file with the given content in project subdirectory specified by parentDirectory. */ File createFile(Path parentDirectory = projectPath, String fileName, String content) { - def result = projectPath.resolve(parentDirectory).resolve(fileName).toFile() + def parent = projectPath.resolve(parentDirectory) + Files.createDirectories(parent) + def result = parent.resolve(fileName).toFile() result.createNewFile() result.write(content) return result @@ -304,7 +306,7 @@ class KonanInteropProject extends KonanProject { return result } - /** Creates a project with the default build file and without any source or def files. */ + /** Creates a project with the default build file, without any source and with an empty def file. */ static KonanInteropProject createEmpty(File projectDir) { def result = new KonanInteropProject(projectDir) result.with { @@ -316,7 +318,7 @@ class KonanInteropProject extends KonanProject { return result } - /** Creates a project with the default build file and without any source or def files. */ + /** Creates a project with the default build file, without any source and with an empty def file. */ static KonanInteropProject createEmpty(File projectDir, Closure config) { def result = createEmpty(projectDir) config(result)