68 lines
2.1 KiB
Groovy
68 lines
2.1 KiB
Groovy
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
import org.robolectric.gradle.DeployedRoboJavaModulePlugin
|
|
import org.robolectric.gradle.RoboJavaModulePlugin
|
|
|
|
apply plugin: RoboJavaModulePlugin
|
|
apply plugin: 'kotlin'
|
|
apply plugin: DeployedRoboJavaModulePlugin
|
|
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 utils 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(":annotations")
|
|
api project(":pluginapi")
|
|
api libs.javax.inject
|
|
api libs.javax.annotation.api
|
|
|
|
// For @VisibleForTesting and ByteStreams
|
|
implementation libs.guava
|
|
compileOnly libs.findbugs.jsr305
|
|
|
|
testCompileOnly libs.auto.service.annotations
|
|
testAnnotationProcessor libs.auto.service
|
|
testAnnotationProcessor libs.error.prone.core
|
|
implementation libs.error.prone.annotations
|
|
|
|
testImplementation libs.junit4
|
|
testImplementation libs.truth
|
|
testImplementation libs.kotlin.stdlib
|
|
}
|