blob: 072278fb4afe6a9ab9b0637a4f58f2f3f73e81ec [file] [log] [blame]
Sergey Vasilinetscb306422018-05-22 14:39:17 -07001/*
2 * Copyright 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 Liutikasf866d102018-06-04 13:25:55 -070017import androidx.build.SupportConfig
Andrea Falconeadd45a92019-10-31 15:29:00 -040018import static androidx.build.dependencies.DependenciesKt.GUAVA
Aurimas Liutikasf866d102018-06-04 13:25:55 -070019
Aurimas Liutikas01738392019-05-15 18:21:43 -070020buildscript {
21 // TODO: Remove this when this test app no longer depends on 1.0.0 of vectordrawable-animated.
22 // vectordrawable and vectordrawable-animated were accidentally using the same package name
23 // which is no longer valid in namespaced resource world.
24 project.ext['android.uniquePackageNames'] = false
25}
26
Sergey Vasilinetscb306422018-05-22 14:39:17 -070027plugins {
Aurimas Liutikas21ff5d12018-08-15 15:33:13 -070028 id("AndroidXPlugin")
29 id("com.android.application")
Sergey Vasilinetscb306422018-05-22 14:39:17 -070030}
31
32// replace all tests etc with empty task, so we don't run anything
33// it is more effective then task.enabled = false, because we avoid executing deps as well
34def reentrance = false
35project.tasks.whenTaskAdded { task ->
Jeff Gastonaba1e6e2019-03-08 19:19:34 -050036 if (task instanceof org.gradle.api.tasks.testing.Test
Jeff Gastona3d28a72019-03-08 19:19:34 -050037 || task.name.startsWith("assemble")
Jeff Gastond0400e72019-07-10 16:23:35 -040038 || task.name == "lint"
Jeff Gastona3d28a72019-03-08 19:19:34 -050039 || task.name == "transformDexArchiveWithExternalLibsDexMergerForPublicDebug"
40 || task.name == "transformResourcesWithMergeJavaResForPublicDebug"
41 || task.name == "checkPublicDebugDuplicateClasses") {
42 if (!reentrance) {
Sergey Vasilinetscb306422018-05-22 14:39:17 -070043 reentrance = true
Aurimas Liutikasb8c52512019-10-17 15:12:56 -070044 project.tasks.named(task.name) {
45 actions = []
46 dependsOn = []
47 }
Sergey Vasilinetscb306422018-05-22 14:39:17 -070048 reentrance = false
49 }
50 }
51}
52
Jeff Gastond0400e72019-07-10 16:23:35 -040053// Also replace some tasks that will have already been created (and not trigger `whenTaskAdded`)
Aurimas Liutikasb8c52512019-10-17 15:12:56 -070054project.tasks.named("lint") {
55 actions = []
56 dependsOn = []
57}
Jeff Gastond0400e72019-07-10 16:23:35 -040058
Sergey Vasilinetscb306422018-05-22 14:39:17 -070059android {
Jake Whartonc2d75492018-07-13 19:24:58 -040060 defaultConfig {
Aurimas Liutikas95dcadd2019-04-24 16:59:07 -070061 minSdkVersion SupportConfig.TARGET_SDK_VERSION
Jeff Gastonf5cea8602018-11-06 21:12:41 -050062 javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = false
Jake Whartonc2d75492018-07-13 19:24:58 -040063 }
64
Sergey Vasilinetscb306422018-05-22 14:39:17 -070065 sourceSets {
66 main {
67 manifest.srcFile "AndroidManifest.xml"
68 }
69 }
Oussama Ben Abdelbaki892e5b02018-10-23 22:08:30 +000070 flavorDimensions "library-group"
Sergey Vasilinetscb306422018-05-22 14:39:17 -070071}
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000072
Andrea Falconeadd45a92019-10-31 15:29:00 -040073configurations.all {
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000074 /*
Andrea Falconeadd45a92019-10-31 15:29:00 -040075 * Room uses auto-common which depends on a version of Guava which strictly depends on a
76 * version of checkerframework that is different from the one we specify. This forces the same
77 * resolution strategy for Guava that is used by room and media already so that the compatible
78 * version of checkerframeworks is also used
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000079 */
Andrea Falconeadd45a92019-10-31 15:29:00 -040080 resolutionStrategy {
81 force GUAVA
82 }
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000083}
84