mirror of
https://github.com/corda/corda.git
synced 2024-12-23 14:52:29 +00:00
8ef1d767c9
* Consolidate repositories into root build.gradle
79 lines
2.5 KiB
Groovy
79 lines
2.5 KiB
Groovy
apply plugin: 'kotlin'
|
|
apply plugin: 'kotlin-kapt'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'net.corda.plugins.publish-utils'
|
|
|
|
description 'Corda node database schemas'
|
|
|
|
buildscript {
|
|
ext.generatedSourcesDir = "${projectDir}/generated/source/kapt/main"
|
|
}
|
|
|
|
// 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)
|
|
sourceSets {
|
|
main {
|
|
kotlin {
|
|
srcDir "${buildDir}/generated/source/kapt/main/"
|
|
}
|
|
}
|
|
generated {
|
|
java {
|
|
srcDir generatedSourcesDir
|
|
compileClasspath += sourceSets.main.compileClasspath + sourceSets.main.output
|
|
}
|
|
}
|
|
test {
|
|
compileClasspath += sourceSets.generated.output + sourceSets.main.compileClasspath
|
|
runtimeClasspath += compileClasspath
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile project(':core')
|
|
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
|
testCompile "junit:junit:$junit_version"
|
|
|
|
// Requery: SQL based query & persistence for Kotlin
|
|
kapt "io.requery:requery-processor:$requery_version"
|
|
|
|
// For H2 database support in persistence
|
|
testCompile "com.h2database:h2:$h2_version"
|
|
}
|
|
|
|
// 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) {
|
|
from "${buildDir}/generated"
|
|
into "${projectDir}/generated"
|
|
}
|
|
|
|
// 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")
|
|
}
|
|
|
|
// Remove the dependency on compile in kapt to avoid automatic kapt running - run :node-schemas:kaptKotlin explicitly.
|
|
project.afterEvaluate {
|
|
jar.dependsOn.each { jar.dependsOn.remove it }
|
|
buildGenerated.dependsOn.each { buildGenerated.dependsOn.remove it }
|
|
jar.dependsOn buildGenerated
|
|
compileTestKotlin.dependsOn buildGenerated
|
|
buildGenerated.dependsOn classes
|
|
compileKotlin.dependsOn.remove kaptKotlin
|
|
compileTestKotlin.dependsOn.remove kaptTestKotlin
|
|
buildKapt.dependsOn kaptKotlin
|
|
buildKapt.mustRunAfter kaptKotlin
|
|
}
|
|
|
|
jar {
|
|
from sourceSets.generated.output
|
|
}
|
|
|
|
idea {
|
|
module {
|
|
sourceDirs += project.sourceSets.generated.allSource
|
|
}
|
|
} |