blob: 5fbee5bad11fb11d7cd0159666c9dd1a91637b63 [file] [log] [blame]
Chris Craik55d0f2d2018-06-27 13:55:20 -07001/*
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 Liutikas75e93a02019-05-28 16:31:38 -070017import androidx.build.Publish
Chris Craikf5d35eb2021-08-11 17:35:21 -070018import androidx.build.SupportConfigKt
Dustin Lambefedb92019-08-16 20:20:41 -070019import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
20
Chris Craik55d0f2d2018-06-27 13:55:20 -070021plugins {
Aurimas Liutikascdb9f9f2019-04-08 12:07:49 +010022 id("AndroidXPlugin")
23 id("com.android.library")
Chris Craik55d0f2d2018-06-27 13:55:20 -070024 id("kotlin-android")
Chris Craikf5d35eb2021-08-11 17:35:21 -070025 id("com.squareup.wire")
26}
27
28android {
29 sourceSets {
30 main.assets.srcDirs += new File(
31 SupportConfigKt.getPrebuiltsRoot(project),
Chris Craikfa08f9d2021-08-19 17:09:41 -070032 "androidx/traceprocessor/tracebox"
Chris Craikf5d35eb2021-08-11 17:35:21 -070033 )
34 androidTest.assets.srcDirs += new File(
35 SupportConfigKt.getPrebuiltsRoot(project),
36 "androidx/traceprocessor/testdata"
37 )
38 }
39}
40
41wire {
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 Craik55d0f2d2018-06-27 13:55:20 -070051}
52
53dependencies {
Aurimas Liutikas2c1a81e2021-05-24 16:43:05 -070054 implementation(libs.kotlinStdlib)
Dustin Lam79d9d242020-03-30 19:43:53 -070055 api("androidx.annotation:annotation:1.1.0")
56 api("androidx.annotation:annotation-experimental:1.0.0")
Chris Craikf75110b2020-11-06 08:15:24 -080057 implementation("androidx.tracing:tracing-ktx:1.0.0")
Aurimas Liutikas2c1a81e2021-05-24 16:43:05 -070058 implementation(libs.testMonitor)
Chris Craikf5d35eb2021-08-11 17:35:21 -070059 implementation(libs.wireRuntime)
Chris Craik55d0f2d2018-06-27 13:55:20 -070060
Aurimas Liutikas2c1a81e2021-05-24 16:43:05 -070061 androidTestImplementation(libs.testRules)
62 androidTestImplementation(libs.testExtJunit)
63 androidTestImplementation(libs.kotlinTest)
Chris Craik55d0f2d2018-06-27 13:55:20 -070064}
65
Aurimas Liutikas2ad31612019-04-01 04:23:03 -070066androidx {
Chris Craikfbfc7212021-01-27 11:54:18 -080067 name = "Android Benchmark - Common"
Aurimas Liutikas75e93a02019-05-28 16:31:38 -070068 publish = Publish.SNAPSHOT_AND_RELEASE
Chris Craik55d0f2d2018-06-27 13:55:20 -070069 mavenGroup = LibraryGroups.BENCHMARK
70 inceptionYear = "2018"
Chris Craikfbfc7212021-01-27 11:54:18 -080071 description = "Android Benchmark - Common"
Chris Craik55d0f2d2018-06-27 13:55:20 -070072}
Dustin Lambefedb92019-08-16 20:20:41 -070073
74// Allow usage of Kotlin's @Experimental annotation, which is itself experimental.
75tasks.withType(KotlinCompile).configureEach {
76 kotlinOptions {
Jim Sproch666614b2021-08-18 07:43:56 -070077 freeCompilerArgs += ["-Xopt-in=kotlin.Experimental"]
Dustin Lambefedb92019-08-16 20:20:41 -070078 }
Jim Sproch9e38b4f2021-01-06 14:21:06 -080079}
Aurimas Liutikas23f6c6c2021-11-19 15:27:40 -080080
81// https://github.com/square/wire/issues/1947
82// Remove when we upgrade to fixed wire library
83afterEvaluate {
84 tasks.named("compileReleaseKotlin").configure {
85 it.dependsOn("generateDebugProtos")
86 }
87 tasks.named("compileDebugKotlin").configure {
88 it.dependsOn("generateReleaseProtos")
89 }
90}
91