61 lines
1.9 KiB
Groovy
61 lines
1.9 KiB
Groovy
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
import org.robolectric.gradle.DeployedRoboJavaModulePlugin
|
|
import org.robolectric.gradle.RoboJavaModulePlugin
|
|
|
|
apply plugin: RoboJavaModulePlugin
|
|
apply plugin: DeployedRoboJavaModulePlugin
|
|
apply plugin: 'kotlin'
|
|
apply plugin: "com.diffplug.spotless"
|
|
|
|
spotless {
|
|
kotlin {
|
|
target '**/*.kt'
|
|
ktfmt('0.42').googleStyle()
|
|
}
|
|
}
|
|
|
|
tasks.withType(GenerateModuleMetadata).configureEach {
|
|
// We don't want to release gradle module metadata now to avoid
|
|
// potential compatibility problems.
|
|
enabled = false
|
|
}
|
|
|
|
compileKotlin {
|
|
// Use java/main classes directory to replace default kotlin/main to
|
|
// avoid d8 error when dexing & desugaring kotlin classes with non-exist
|
|
// kotlin/main directory because this module doesn't have kotlin code
|
|
// in production. If utils module starts to add Kotlin code in main source
|
|
// set, we can remove this destinationDirectory modification.
|
|
destinationDirectory = file("${projectDir}/build/classes/java/main")
|
|
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
|
|
}
|
|
|
|
afterEvaluate {
|
|
configurations {
|
|
runtimeElements {
|
|
attributes {
|
|
// We should add artifactType with jar to ensure standard runtimeElements variant
|
|
// has a max priority selection sequence than other variants that brought by
|
|
// kotlin plugin.
|
|
attribute(
|
|
Attribute.of("artifactType", String.class),
|
|
ArtifactTypeDefinition.JAR_TYPE
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
api project(":pluginapi")
|
|
api project(":utils")
|
|
api libs.auto.value.annotations
|
|
api libs.guava
|
|
annotationProcessor libs.auto.value
|
|
|
|
testImplementation libs.junit4
|
|
testImplementation libs.mockito
|
|
testImplementation libs.truth
|
|
testImplementation libs.kotlin.stdlib
|
|
}
|