Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Aurimas Liutikas | 75e93a0 | 2019-05-28 16:31:38 -0700 | [diff] [blame] | 17 | import androidx.build.Publish |
Chris Craik | f5d35eb | 2021-08-11 17:35:21 -0700 | [diff] [blame] | 18 | import androidx.build.SupportConfigKt |
Dustin Lam | befedb9 | 2019-08-16 20:20:41 -0700 | [diff] [blame] | 19 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 20 | |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 21 | plugins { |
Aurimas Liutikas | cdb9f9f | 2019-04-08 12:07:49 +0100 | [diff] [blame] | 22 | id("AndroidXPlugin") |
| 23 | id("com.android.library") |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 24 | id("kotlin-android") |
Chris Craik | f5d35eb | 2021-08-11 17:35:21 -0700 | [diff] [blame] | 25 | id("com.squareup.wire") |
| 26 | } |
| 27 | |
| 28 | android { |
| 29 | sourceSets { |
| 30 | main.assets.srcDirs += new File( |
| 31 | SupportConfigKt.getPrebuiltsRoot(project), |
Chris Craik | fa08f9d | 2021-08-19 17:09:41 -0700 | [diff] [blame] | 32 | "androidx/traceprocessor/tracebox" |
Chris Craik | f5d35eb | 2021-08-11 17:35:21 -0700 | [diff] [blame] | 33 | ) |
| 34 | androidTest.assets.srcDirs += new File( |
| 35 | SupportConfigKt.getPrebuiltsRoot(project), |
| 36 | "androidx/traceprocessor/testdata" |
| 37 | ) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | wire { |
| 42 | kotlin {} |
| 43 | |
| 44 | // prune unused config components which have deprecated fields |
| 45 | prune 'perfetto.protos.TraceConfig.IncidentReportConfig' |
| 46 | prune 'perfetto.protos.ProcessStatsConfig.Quirks' |
| 47 | |
| 48 | sourcePath { |
| 49 | srcDir 'src/main/proto' |
| 50 | } |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | dependencies { |
Aurimas Liutikas | 2c1a81e | 2021-05-24 16:43:05 -0700 | [diff] [blame] | 54 | implementation(libs.kotlinStdlib) |
Dustin Lam | 79d9d24 | 2020-03-30 19:43:53 -0700 | [diff] [blame] | 55 | api("androidx.annotation:annotation:1.1.0") |
| 56 | api("androidx.annotation:annotation-experimental:1.0.0") |
Chris Craik | f75110b | 2020-11-06 08:15:24 -0800 | [diff] [blame] | 57 | implementation("androidx.tracing:tracing-ktx:1.0.0") |
Aurimas Liutikas | 2c1a81e | 2021-05-24 16:43:05 -0700 | [diff] [blame] | 58 | implementation(libs.testMonitor) |
Chris Craik | f5d35eb | 2021-08-11 17:35:21 -0700 | [diff] [blame] | 59 | implementation(libs.wireRuntime) |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 60 | |
Aurimas Liutikas | 2c1a81e | 2021-05-24 16:43:05 -0700 | [diff] [blame] | 61 | androidTestImplementation(libs.testRules) |
| 62 | androidTestImplementation(libs.testExtJunit) |
| 63 | androidTestImplementation(libs.kotlinTest) |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Aurimas Liutikas | 2ad3161 | 2019-04-01 04:23:03 -0700 | [diff] [blame] | 66 | androidx { |
Chris Craik | fbfc721 | 2021-01-27 11:54:18 -0800 | [diff] [blame] | 67 | name = "Android Benchmark - Common" |
Aurimas Liutikas | 75e93a0 | 2019-05-28 16:31:38 -0700 | [diff] [blame] | 68 | publish = Publish.SNAPSHOT_AND_RELEASE |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 69 | mavenGroup = LibraryGroups.BENCHMARK |
| 70 | inceptionYear = "2018" |
Chris Craik | fbfc721 | 2021-01-27 11:54:18 -0800 | [diff] [blame] | 71 | description = "Android Benchmark - Common" |
Chris Craik | 55d0f2d | 2018-06-27 13:55:20 -0700 | [diff] [blame] | 72 | } |
Dustin Lam | befedb9 | 2019-08-16 20:20:41 -0700 | [diff] [blame] | 73 | |
| 74 | // Allow usage of Kotlin's @Experimental annotation, which is itself experimental. |
| 75 | tasks.withType(KotlinCompile).configureEach { |
| 76 | kotlinOptions { |
Jim Sproch | 666614b | 2021-08-18 07:43:56 -0700 | [diff] [blame] | 77 | freeCompilerArgs += ["-Xopt-in=kotlin.Experimental"] |
Dustin Lam | befedb9 | 2019-08-16 20:20:41 -0700 | [diff] [blame] | 78 | } |
Jim Sproch | 9e38b4f | 2021-01-06 14:21:06 -0800 | [diff] [blame] | 79 | } |
Aurimas Liutikas | 23f6c6c | 2021-11-19 15:27:40 -0800 | [diff] [blame] | 80 | |
| 81 | // https://github.com/square/wire/issues/1947 |
| 82 | // Remove when we upgrade to fixed wire library |
| 83 | afterEvaluate { |
| 84 | tasks.named("compileReleaseKotlin").configure { |
| 85 | it.dependsOn("generateDebugProtos") |
| 86 | } |
| 87 | tasks.named("compileDebugKotlin").configure { |
| 88 | it.dependsOn("generateReleaseProtos") |
| 89 | } |
| 90 | } |
| 91 | |