blob: 3ea38d6be99cf0ee254e1e6823a975cd56760b86 [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
Jake Whartonc2d75492018-07-13 19:24:58 -040062 }
63
Sergey Vasilinetscb306422018-05-22 14:39:17 -070064 sourceSets {
65 main {
66 manifest.srcFile "AndroidManifest.xml"
67 }
68 }
Oussama Ben Abdelbaki892e5b02018-10-23 22:08:30 +000069 flavorDimensions "library-group"
Jeff Gaston072ea462020-07-22 13:54:22 -040070
71 lintOptions {
72 checkReleaseBuilds false
73 }
Sergey Vasilinetscb306422018-05-22 14:39:17 -070074}
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000075
Andrea Falconeadd45a92019-10-31 15:29:00 -040076configurations.all {
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000077 /*
Andrea Falconeadd45a92019-10-31 15:29:00 -040078 * Room uses auto-common which depends on a version of Guava which strictly depends on a
79 * version of checkerframework that is different from the one we specify. This forces the same
80 * resolution strategy for Guava that is used by room and media already so that the compatible
81 * version of checkerframeworks is also used
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000082 */
Andrea Falconeadd45a92019-10-31 15:29:00 -040083 resolutionStrategy {
84 force GUAVA
85 }
Nick Anthonyb4f01cb2019-03-25 14:03:17 +000086}
87