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) { // 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(":annotations") api project(":pluginapi") api "javax.inject:javax.inject:1" api "javax.annotation:javax.annotation-api:1.3.2" // For @VisibleForTesting and ByteStreams implementation "com.google.guava:guava:$guavaJREVersion" compileOnly "com.google.code.findbugs:jsr305:3.0.2" testCompileOnly "com.google.auto.service:auto-service-annotations:$autoServiceVersion" testAnnotationProcessor "com.google.auto.service:auto-service:$autoServiceVersion" testAnnotationProcessor "com.google.errorprone:error_prone_core:$errorproneVersion" implementation "com.google.errorprone:error_prone_annotations:$errorproneVersion" testImplementation "junit:junit:${junitVersion}" testImplementation "com.google.truth:truth:${truthVersion}" testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" testImplementation "org.mockito:mockito-core:${mockitoVersion}" }