| import java.time.LocalDate |
| import java.time.format.DateTimeFormatter |
| |
| apply plugin: 'java-gradle-plugin' |
| apply plugin: 'kotlin' |
| apply plugin: 'jacoco-tools-base' |
| apply plugin: 'clone-artifacts' |
| apply plugin: 'license-report' |
| apply plugin: 'com.google.protobuf' |
| |
| configurations { |
| provided |
| includeInJar |
| includeInJarSources |
| } |
| |
| licenseReport { |
| whiteList = ['org.jetbrains.trove4j:trove4j:20160824'] |
| } |
| |
| // Set the version of the plugin in the manifest. This is used by 3rd party plugin (like Kotlin) |
| jar.manifest.attributes("Plugin-Version": version) |
| jar.manifest.attributes("Inception-Date": DateTimeFormatter.ISO_LOCAL_DATE.format(LocalDate.now())); |
| |
| |
| // Incremental update test support |
| File classesDir = new File(project.buildDir, "classes/incremental-test") |
| File baseClasses = new File(classesDir, "base") |
| File baseInstrumentedClasses = new File(classesDir, "baseInstrumented") |
| |
| sourceSets { |
| main { |
| java.srcDirs += 'src/fromGradle/java' |
| resources.srcDirs = ['src/main/resources', 'src/fromGradle/resources'] |
| compileClasspath += configurations.provided |
| } |
| |
| test { |
| compileClasspath += files(baseClasses) |
| runtimeClasspath += files(baseInstrumentedClasses) |
| } |
| |
| apiTest { |
| java.srcDirs += 'src/apiTest/kotlin' |
| resources.srcDirs += 'src/apiTest/resources' |
| compileClasspath += test.compileClasspath |
| runtimeClasspath += test.runtimeClasspath |
| } |
| } |
| |
| task apiTest(type: Test) { |
| testClassesDirs = sourceSets.apiTest.output.classesDirs |
| classpath = sourceSets.apiTest.runtimeClasspath |
| } |
| |
| check.dependsOn apiTest |
| apiTest.dependsOn publishLocal |
| |
| gradlePlugin { |
| testSourceSets sourceSets.apiTest |
| plugins { |
| androidApplication { |
| id = 'com.android.application' |
| implementationClass = 'com.android.build.gradle.AppPlugin' |
| } |
| } |
| } |
| |
| dependencies { |
| compile project(':base:builder') |
| compile project(':base:build-system:aapt2-proto') |
| compile project(':base:build-system:aaptcompiler') |
| compile project(':analytics-library:crash') |
| compile project(':base:lint-gradle-api') |
| compile project(':base:gradle-api') |
| compile project(':dataBinding:compilerCommon') |
| |
| compile libs.kotlin_stdlib |
| compile libs.transform_api_deprecated |
| compile libs.asm |
| compile libs.asm_analysis |
| compile libs.asm_commons |
| compile libs.asm_util |
| compile libs.jopt |
| compile libs.proguard |
| compile libs.bundle_tool |
| compile libs.jetifier_core |
| compile libs.jetifier_processor |
| compile libs.javapoet |
| compile libs.protobuf |
| compile libs.protobuf_util |
| compile libs.tink |
| compile libs.unified_test_platform |
| |
| compileOnly libs.kotlin_gradle_plugin |
| |
| compileOnly libs.jacoco_core |
| compileOnly libs.jacoco_report |
| |
| // Add gradleApi to classpath for compilation, but use provided configuration so that groovy is |
| // not exposed as a runtime dependency. |
| provided gradleApi() |
| |
| testCompile gradleApi() |
| testCompile libs.junit |
| testCompile libs.truth |
| testCompile libs.kotlin_test |
| testCompile libs.mockito_core |
| testCompile libs.guava |
| testCompile libs.equalsverifier |
| testCompile project(':base:project-test-lib') |
| testCompile project(':base:testutils') |
| testCompile 'org.jetbrains:annotations:13.0' |
| testCompile libs.jsoup |
| testCompile libs.jacoco_core |
| testCompile libs.jacoco_report |
| testCompile libs.kotlin_gradle_plugin |
| testCompile testFixtures(project(":base:repository")) |
| |
| // mlkit-common |
| includeInJar(project(':base:mlkit-common')) { |
| transitive = false |
| } |
| includeInJarSources(project(path:':base:mlkit-common', configuration:'sourcesOnly')) { |
| transitive = false |
| } |
| implementation libs.flatbuffers |
| implementation libs.tensorflow_lite_metadata |
| } |
| |
| protobuf { |
| protoc { |
| artifact = libs.proto_compiler |
| } |
| } |
| |
| compileKotlin { |
| kotlinOptions { |
| jvmTarget = "1.8" |
| freeCompilerArgs = ["-Xjvm-default=enable"] |
| } |
| } |
| |
| compileTestKotlin { |
| kotlinOptions { |
| jvmTarget = "1.8" |
| freeCompilerArgs = ["-Xjvm-default=enable"] |
| } |
| } |
| |
| group = 'com.android.tools.build' |
| archivesBaseName = 'gradle' |
| version = rootProject.ext.buildVersion |
| |
| project.ext.pomName = 'Gradle Plug-in for Android' |
| project.ext.pomDesc = 'Gradle plug-in to build Android applications.' |
| |
| apply from: "$rootDir/buildSrc/base/publish.gradle" |
| |
| test { |
| environment("CUSTOM_REPO", |
| new File(rootProject.ext.androidHostOut, "repo").toString() |
| + File.pathSeparator |
| + rootProject.file("../prebuilts/tools/common/m2/repository/").toString()) |
| |
| |
| testLogging { |
| events "failed" |
| } |
| |
| maxParallelForks = Runtime.runtime.availableProcessors() / 2 |
| |
| exclude "**/GradleCoreBazelSuite*" |
| |
| maxHeapSize = "2048m" |
| } |
| |
| File apiTestsOutDir = new File(rootProject.ext.androidHostOut, "apiTests") |
| apiTestsOutDir.mkdirs() |
| |
| clean { |
| delete apiTestsOutDir |
| } |
| |
| apiTest { |
| // Gradle embeds kotlin when dealing with kts files and that version can be different from |
| // the version Android Studio bundles. This is usually not an issue, but when generating |
| // build.gradle.kts files, we need to use the bundled Android Studio version so all dependencies |
| // are present in prebuilts. |
| environment("KOTLIN_PLUGIN", libs.kotlin_gradle_plugin) |
| |
| maxParallelForks = Runtime.runtime.availableProcessors() |
| |
| environment("API_TESTS_OUTDIR", apiTestsOutDir.toString()) |
| |
| environment("CUSTOM_REPO", |
| new File(rootProject.ext.androidHostOut, "repo").toString() |
| + File.pathSeparator |
| + rootProject.file("../prebuilts/tools/common/m2/repository/").toString()) |
| |
| dependsOn ':publishAndroidGradleLocal' |
| dependsOn ':base:apkparser:apkanalyzer-cli:publishLocal' |
| } |
| |
| javadoc { |
| exclude "**/internal/**" |
| |
| options.docTitle "Gradle Plugin for Android" |
| options.header "" |
| options.footer "Copyright (C) 2012 The Android Open Source Project" |
| } |
| |
| task javadocJar(type: Jar, dependsOn:javadoc) { |
| classifier 'javadoc' |
| from javadoc.destinationDir |
| |
| } |
| |
| tasks.withType(Javadoc) { |
| classpath += configurations.provided |
| } |
| |
| // Only package JavaDoc if using --init-script=buildSrc/base/release.gradle |
| if (project.hasProperty("release")) { |
| artifacts { |
| archives javadocJar |
| } |
| } |
| |
| tasks.processResources { |
| from(rootProject.file("../prebuilts/tools/common/aapt/aapt2_version.properties")) { |
| into "com/android/build/gradle/internal/res/" |
| } |
| } |
| |
| // Incremental update test support |
| javadoc { |
| classpath += configurations.provided |
| } |
| |
| // setup annotation processor output directory |
| File generatedSources = new File(project.buildDir, 'generated/generated') |
| tasks.compileJava { |
| doFirst { |
| generatedSources.mkdirs() |
| } |
| options.compilerArgs += ['-s', generatedSources] |
| outputs.dir(generatedSources) |
| } |
| |
| // Configure validateTaskProperties task |
| tasks.validateTaskProperties.configure { |
| // Always run this task so we can see the report in the console with every run |
| outputs.upToDateWhen { false } |
| |
| // Enable strict mode so we can see more warnings |
| enableStricterValidation = true |
| } |
| |
| // Support for embedding other gradle project classes. |
| sourceSets.main.compileClasspath += configurations.includeInJar |
| sourceSets.test.compileClasspath += configurations.includeInJar |
| sourceSets.test.runtimeClasspath += configurations.includeInJar |
| |
| tasks.jar { |
| dependsOn configurations.includeInJar |
| from { |
| configurations.includeInJar.collect({zipTree(it)}) |
| } |
| } |
| |
| tasks.sourcesJar { |
| dependsOn configurations.includeInJarSources |
| from { |
| configurations.includeInJarSources.collect({zipTree(it)}) |
| } |
| } |
| |