| import org.gradle.internal.jvm.Jvm |
| import org.robolectric.gradle.DeployedRoboJavaModulePlugin |
| import org.robolectric.gradle.RoboJavaModulePlugin |
| |
| apply plugin: RoboJavaModulePlugin |
| apply plugin: DeployedRoboJavaModulePlugin |
| |
| class GenerateSdksFileTask extends DefaultTask { |
| @OutputFile File outFile |
| |
| @TaskAction |
| public void writeProperties() throws Exception { |
| File outDir = outFile.parentFile |
| if (!outDir.directory) outDir.mkdirs() |
| outFile.withPrintWriter { out -> |
| out << "# GENERATED by ${this} -- do not edit\n" |
| |
| AndroidSdk.ALL_SDKS.each { androidSdk -> |
| def config = project.configurations.create("processor_sdk${androidSdk.apiLevel}") |
| project.dependencies.add("processor_sdk${androidSdk.apiLevel}", androidSdk.coordinates) |
| def sdkPath = config.files.first().getAbsolutePath() |
| out << "${sdkPath}\n" |
| } |
| } |
| } |
| } |
| |
| task('generateSdksFile', type: GenerateSdksFileTask) { |
| outFile = new File(project.rootProject.buildDir, 'sdks.txt') |
| } |
| |
| tasks['classes'].dependsOn(generateSdksFile) |
| |
| dependencies { |
| api project(":annotations") |
| api project(":shadowapi") |
| |
| compileOnly "com.google.code.findbugs:jsr305:3.0.2" |
| api "org.ow2.asm:asm:${asmVersion}" |
| api "org.ow2.asm:asm-commons:${asmVersion}" |
| api "com.google.guava:guava:$guavaJREVersion" |
| api "com.google.code.gson:gson:2.8.6" |
| implementation 'com.google.auto:auto-common:1.1.2' |
| |
| def toolsJar = Jvm.current().getToolsJar() |
| if (toolsJar != null) { |
| implementation files(toolsJar) |
| } |
| |
| testImplementation "javax.annotation:jsr250-api:1.0" |
| testImplementation "junit:junit:${junitVersion}" |
| testImplementation "org.mockito:mockito-core:${mockitoVersion}" |
| testImplementation "com.google.testing.compile:compile-testing:0.18" |
| testImplementation "com.google.truth:truth:${truthVersion}" |
| } |