2017-02-16 11:02:36 +00:00
|
|
|
apply plugin: 'kotlin'
|
|
|
|
apply plugin: 'kotlin-kapt'
|
2017-03-21 15:24:21 +00:00
|
|
|
apply plugin: 'idea'
|
2017-02-17 12:53:44 +00:00
|
|
|
apply plugin: 'net.corda.plugins.publish-utils'
|
2017-02-16 11:02:36 +00:00
|
|
|
|
|
|
|
description 'Corda node database schemas'
|
|
|
|
|
2017-03-21 15:24:21 +00:00
|
|
|
buildscript {
|
|
|
|
ext.generatedSourcesDir = "${projectDir}/generated/source/kapt/main"
|
|
|
|
}
|
|
|
|
|
2017-03-16 14:04:55 +00:00
|
|
|
// Kapt plugin is hardcoded in output directory and sourcesets. Use a separate sourceset to keep the generated
|
|
|
|
// files in git and outside of the build directory (to avoid cleaning issues)
|
2017-02-16 11:02:36 +00:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
kotlin {
|
|
|
|
srcDir "${buildDir}/generated/source/kapt/main/"
|
|
|
|
}
|
|
|
|
}
|
2017-03-16 14:04:55 +00:00
|
|
|
generated {
|
2017-03-16 10:20:03 +00:00
|
|
|
java {
|
2017-03-21 15:24:21 +00:00
|
|
|
srcDir generatedSourcesDir
|
2017-03-17 12:17:50 +00:00
|
|
|
compileClasspath += sourceSets.main.compileClasspath + sourceSets.main.output
|
2017-02-16 11:02:36 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-17 12:17:50 +00:00
|
|
|
test {
|
|
|
|
compileClasspath += sourceSets.generated.output + sourceSets.main.compileClasspath
|
|
|
|
runtimeClasspath += compileClasspath
|
|
|
|
}
|
2017-02-16 11:02:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile project(':core')
|
2017-03-22 15:52:54 +00:00
|
|
|
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
2017-03-23 17:32:14 +00:00
|
|
|
testCompile "junit:junit:$junit_version"
|
2017-02-16 11:02:36 +00:00
|
|
|
|
|
|
|
// Requery: SQL based query & persistence for Kotlin
|
|
|
|
kapt "io.requery:requery-processor:$requery_version"
|
|
|
|
|
|
|
|
// For H2 database support in persistence
|
2017-03-20 10:27:45 +00:00
|
|
|
testCompile "com.h2database:h2:$h2_version"
|
2017-02-16 11:02:36 +00:00
|
|
|
}
|
2017-03-14 14:44:13 +00:00
|
|
|
|
2017-03-14 17:03:53 +00:00
|
|
|
// Generated files will be removed by gradle clean. Since we aren't running kapt every time we must preserve these files
|
|
|
|
// Note: The lines that actually invoke kapt are those in the project.afterEvaluate block.
|
|
|
|
task buildKapt(type: Copy) {
|
2017-03-14 16:53:05 +00:00
|
|
|
from "${buildDir}/generated"
|
|
|
|
into "${projectDir}/generated"
|
|
|
|
}
|
|
|
|
|
2017-03-16 14:04:55 +00:00
|
|
|
// Kapt hijacks anything named "compile"
|
|
|
|
task buildGenerated(type: JavaCompile) {
|
|
|
|
source = sourceSets.generated.allJava
|
|
|
|
classpath = sourceSets.generated.compileClasspath + sourceSets.main.compileClasspath + sourceSets.main.output
|
|
|
|
destinationDir = file("$buildDir/classes/generated")
|
|
|
|
}
|
|
|
|
|
2017-03-14 14:44:13 +00:00
|
|
|
// Remove the dependency on compile in kapt to avoid automatic kapt running - run :node-schemas:kaptKotlin explicitly.
|
2017-03-14 16:53:05 +00:00
|
|
|
project.afterEvaluate {
|
2017-03-16 14:04:55 +00:00
|
|
|
jar.dependsOn.each { jar.dependsOn.remove it }
|
|
|
|
buildGenerated.dependsOn.each { buildGenerated.dependsOn.remove it }
|
|
|
|
jar.dependsOn buildGenerated
|
2017-03-17 12:17:50 +00:00
|
|
|
compileTestKotlin.dependsOn buildGenerated
|
2017-03-16 14:04:55 +00:00
|
|
|
buildGenerated.dependsOn classes
|
2017-03-14 17:03:53 +00:00
|
|
|
compileKotlin.dependsOn.remove kaptKotlin
|
2017-03-17 12:17:50 +00:00
|
|
|
compileTestKotlin.dependsOn.remove kaptTestKotlin
|
2017-03-14 17:03:53 +00:00
|
|
|
buildKapt.dependsOn kaptKotlin
|
|
|
|
buildKapt.mustRunAfter kaptKotlin
|
2017-03-16 14:04:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
|
|
|
from sourceSets.generated.output
|
|
|
|
}
|
2017-03-21 15:24:21 +00:00
|
|
|
|
|
|
|
idea {
|
|
|
|
module {
|
|
|
|
sourceDirs += project.sourceSets.generated.allSource
|
|
|
|
}
|
|
|
|
}
|