| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 1 | /* |
| 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 Liutikas | f866d10 | 2018-06-04 13:25:55 -0700 | [diff] [blame] | 17 | import androidx.build.SupportConfig |
| Andrea Falcone | add45a9 | 2019-10-31 15:29:00 -0400 | [diff] [blame] | 18 | import static androidx.build.dependencies.DependenciesKt.GUAVA |
| Aurimas Liutikas | f866d10 | 2018-06-04 13:25:55 -0700 | [diff] [blame] | 19 | |
| Aurimas Liutikas | 0173839 | 2019-05-15 18:21:43 -0700 | [diff] [blame] | 20 | buildscript { |
| 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 Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 27 | plugins { |
| Aurimas Liutikas | 21ff5d1 | 2018-08-15 15:33:13 -0700 | [diff] [blame] | 28 | id("AndroidXPlugin") |
| 29 | id("com.android.application") |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 30 | } |
| 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 |
| 34 | def reentrance = false |
| 35 | project.tasks.whenTaskAdded { task -> |
| Jeff Gaston | aba1e6e | 2019-03-08 19:19:34 -0500 | [diff] [blame] | 36 | if (task instanceof org.gradle.api.tasks.testing.Test |
| Jeff Gaston | a3d28a7 | 2019-03-08 19:19:34 -0500 | [diff] [blame] | 37 | || task.name.startsWith("assemble") |
| Jeff Gaston | d0400e7 | 2019-07-10 16:23:35 -0400 | [diff] [blame] | 38 | || task.name == "lint" |
| Jeff Gaston | a3d28a7 | 2019-03-08 19:19:34 -0500 | [diff] [blame] | 39 | || task.name == "transformDexArchiveWithExternalLibsDexMergerForPublicDebug" |
| 40 | || task.name == "transformResourcesWithMergeJavaResForPublicDebug" |
| 41 | || task.name == "checkPublicDebugDuplicateClasses") { |
| 42 | if (!reentrance) { |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 43 | reentrance = true |
| Aurimas Liutikas | b8c5251 | 2019-10-17 15:12:56 -0700 | [diff] [blame] | 44 | project.tasks.named(task.name) { |
| 45 | actions = [] |
| 46 | dependsOn = [] |
| 47 | } |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 48 | reentrance = false |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| Jeff Gaston | d0400e7 | 2019-07-10 16:23:35 -0400 | [diff] [blame] | 53 | // Also replace some tasks that will have already been created (and not trigger `whenTaskAdded`) |
| Aurimas Liutikas | b8c5251 | 2019-10-17 15:12:56 -0700 | [diff] [blame] | 54 | project.tasks.named("lint") { |
| 55 | actions = [] |
| 56 | dependsOn = [] |
| 57 | } |
| Jeff Gaston | d0400e7 | 2019-07-10 16:23:35 -0400 | [diff] [blame] | 58 | |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 59 | android { |
| Jake Wharton | c2d7549 | 2018-07-13 19:24:58 -0400 | [diff] [blame] | 60 | defaultConfig { |
| Aurimas Liutikas | 95dcadd | 2019-04-24 16:59:07 -0700 | [diff] [blame] | 61 | minSdkVersion SupportConfig.TARGET_SDK_VERSION |
| Jeff Gaston | f5cea860 | 2018-11-06 21:12:41 -0500 | [diff] [blame] | 62 | javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = false |
| Jake Wharton | c2d7549 | 2018-07-13 19:24:58 -0400 | [diff] [blame] | 63 | } |
| 64 | |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 65 | sourceSets { |
| 66 | main { |
| 67 | manifest.srcFile "AndroidManifest.xml" |
| 68 | } |
| 69 | } |
| Oussama Ben Abdelbaki | 892e5b0 | 2018-10-23 22:08:30 +0000 | [diff] [blame] | 70 | flavorDimensions "library-group" |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 71 | } |
| Nick Anthony | b4f01cb | 2019-03-25 14:03:17 +0000 | [diff] [blame] | 72 | |
| Andrea Falcone | add45a9 | 2019-10-31 15:29:00 -0400 | [diff] [blame] | 73 | configurations.all { |
| Nick Anthony | b4f01cb | 2019-03-25 14:03:17 +0000 | [diff] [blame] | 74 | /* |
| Andrea Falcone | add45a9 | 2019-10-31 15:29:00 -0400 | [diff] [blame] | 75 | * 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 Anthony | b4f01cb | 2019-03-25 14:03:17 +0000 | [diff] [blame] | 79 | */ |
| Andrea Falcone | add45a9 | 2019-10-31 15:29:00 -0400 | [diff] [blame] | 80 | resolutionStrategy { |
| 81 | force GUAVA |
| 82 | } |
| Nick Anthony | b4f01cb | 2019-03-25 14:03:17 +0000 | [diff] [blame] | 83 | } |
| 84 | |