blob: de20b2b8fa60c54c0a746fabce77ea97452cc86d [file] [log] [blame]
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) {
// 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 = org.jetbrains.kotlin.gradle.dsl.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 "com.google.guava:guava:$guavaJREVersion"
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "com.google.truth:truth:$truthVersion"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}