| 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 libs.findbugs.jsr305 |
| api libs.asm |
| api libs.asm.commons |
| api libs.guava |
| api libs.gson |
| implementation libs.auto.common |
| |
| def toolsJar = Jvm.current().getToolsJar() |
| if (toolsJar != null) { |
| implementation files(toolsJar) |
| } |
| |
| testImplementation libs.javax.annotation.jsr250.api |
| testImplementation libs.junit4 |
| testImplementation libs.mockito |
| testImplementation libs.compile.testing |
| testImplementation libs.truth |
| } |