blob: 28091b6134d025dcc8caf6c694374d8e5a3715a7 [file] [log] [blame]
/*
* Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
apply plugin: 'kotlin'
apply plugin: 'java-gradle-plugin'
if (rootProject.ext.jvm_ir_enabled) {
kotlin.target.compilations.all {
kotlinOptions.useIR = true
}
}
// Gradle plugin must be compiled targeting the same Kotlin version as used by Gradle
kotlin.sourceSets.all {
languageSettings {
apiVersion = "1.3"
languageVersion = "1.3"
}
}
dependencies {
compile gradleApi()
compile project(":atomicfu-transformer")
compile 'org.jetbrains.kotlin:kotlin-stdlib'
compileOnly "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
testCompile gradleTestKit()
testCompile 'org.jetbrains.kotlin:kotlin-test'
testCompile 'org.jetbrains.kotlin:kotlin-test-junit'
testCompile 'junit:junit:4.12'
}
configurations {
testPluginClasspath
}
dependencies {
testPluginClasspath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
evaluationDependsOn(':atomicfu')
def atomicfu = project(':atomicfu')
def atomicfuJvmJarTask = atomicfu.tasks.getByName(atomicfu.kotlin.targets.jvm.artifactsTaskName)
def jsLegacy = atomicfu.kotlin.targets.hasProperty("jsLegacy")
? atomicfu.kotlin.targets.jsLegacy
: atomicfu.kotlin.targets.js
def atomicfuJsJarTask = atomicfu.tasks.getByName(jsLegacy.artifactsTaskName)
def atomicfuMetadataOutput = atomicfu.kotlin.targets.metadata.compilations["main"].output.allOutputs
// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
dependsOn(atomicfuJvmJarTask)
dependsOn(atomicfuJsJarTask)
dependsOn(atomicfuMetadataOutput)
def outputDir = file("$buildDir/$name")
outputs.dir outputDir
doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text = (sourceSets.main.runtimeClasspath + configurations.testPluginClasspath).join("\n")
file("$outputDir/atomicfu-jvm.txt").text = atomicfuJvmJarTask.archivePath
file("$outputDir/atomicfu-js.txt").text = atomicfuJsJarTask.archivePath
file("$outputDir/atomicfu-metadata.txt").text = atomicfuMetadataOutput.join("\n")
}
}
// Add the classpath file to the test runtime classpath
dependencies {
testRuntime files(createClasspathManifest)
}