1 /* 2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink 6 import org.jetbrains.dokka.gradle.DokkaTask 7 import java.net.URL 8 <lambda>null9configurations { 10 create("r8") 11 } 12 <lambda>null13dependencies { 14 compileOnly("com.google.android:android:${version("android")}") 15 compileOnly("androidx.annotation:annotation:${version("androidx_annotation")}") 16 17 testImplementation("com.google.android:android:${version("android")}") 18 testImplementation("org.robolectric:robolectric:${version("robolectric")}") 19 testImplementation("org.smali:baksmali:${version("baksmali")}") 20 21 "r8"("com.android.tools.build:builder:4.0.0-alpha06") // Contains r8-2.0.4-dev 22 } 23 24 val optimizedDexDir = File(buildDir, "dex-optim/") 25 val unOptimizedDexDir = File(buildDir, "dex-unoptim/") 26 27 val optimizedDexFile = File(optimizedDexDir, "classes.dex") 28 val unOptimizedDexFile = File(unOptimizedDexDir, "classes.dex") 29 <lambda>null30val runR8 by tasks.registering(RunR8::class) { 31 outputDex = optimizedDexDir 32 inputConfig = file("testdata/r8-test-rules.pro") 33 34 dependsOn("jar") 35 } 36 <lambda>null37val runR8NoOptim by tasks.registering(RunR8::class) { 38 outputDex = unOptimizedDexDir 39 inputConfig = file("testdata/r8-test-rules-no-optim.pro") 40 41 dependsOn("jar") 42 } 43 <lambda>null44tasks.test { 45 // Ensure the R8-processed dex is built and supply its path as a property to the test. 46 dependsOn(runR8) 47 dependsOn(runR8NoOptim) 48 49 inputs.files(optimizedDexFile, unOptimizedDexFile) 50 51 systemProperty("dexPath", optimizedDexFile.absolutePath) 52 systemProperty("noOptimDexPath", unOptimizedDexFile.absolutePath) 53 54 // Output custom metric with the size of the optimized dex 55 doLast { 56 println("##teamcity[buildStatisticValue key='optimizedDexSize' value='${optimizedDexFile.length()}']") 57 } 58 } 59 60 externalDocumentationLink( 61 url = "https://developer.android.com/reference/" 62 ) 63