1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
import build.*
import codegen.GenerateKotlinDependencyExtensions
plugins {
id("public-kotlin-dsl-module")
}
base {
archivesBaseName = "gradle-kotlin-dsl"
}
dependencies {
compileOnly(gradleApi())
compile(project(":tooling-models"))
compile(futureKotlin("stdlib-jre8"))
compile(futureKotlin("reflect"))
compile(futureKotlin("compiler-embeddable"))
compile(futureKotlin("sam-with-receiver-compiler-plugin")) {
isTransitive = false
}
testCompile(project(":test-fixtures"))
}
// --- Enable automatic generation of API extensions -------------------
val apiExtensionsOutputDir = file("src/generated/kotlin")
java.sourceSets["main"].kotlin {
srcDir(apiExtensionsOutputDir)
}
val generateKotlinDependencyExtensions by task<GenerateKotlinDependencyExtensions> {
val publishedPluginsVersion: String by rootProject.extra
outputFile = File(apiExtensionsOutputDir, "org/gradle/kotlin/dsl/KotlinDependencyExtensions.kt")
embeddedKotlinVersion = kotlinVersion
kotlinDslPluginsVersion = publishedPluginsVersion
kotlinDslRepository = kotlinRepo
}
val generateExtensions by tasks.creating {
dependsOn(generateKotlinDependencyExtensions)
}
val compileKotlin by tasks
compileKotlin.dependsOn(generateExtensions)
val clean: Delete by tasks
clean.delete(apiExtensionsOutputDir)
// -- Testing ----------------------------------------------------------
val prepareIntegrationTestFixtures by rootProject.tasks
val customInstallation by rootProject.tasks
tasks {
"test" {
dependsOn(prepareIntegrationTestFixtures)
dependsOn(customInstallation)
}
}
withParallelTests()
// --- Utility functions -----------------------------------------------
inline
fun <reified T : Task> task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
|