| 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 |
| Nick Anthony | b4f01cb | 2019-03-25 14:03:17 +0000 | [diff] [blame^] | 18 | import static androidx.build.dependencies.DependenciesKt.CHECKER_FRAMEWORK |
| Aurimas Liutikas | f866d10 | 2018-06-04 13:25:55 -0700 | [diff] [blame] | 19 | |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 20 | plugins { |
| Aurimas Liutikas | 21ff5d1 | 2018-08-15 15:33:13 -0700 | [diff] [blame] | 21 | id("AndroidXPlugin") |
| 22 | id("com.android.application") |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | // replace all tests etc with empty task, so we don't run anything |
| 26 | // it is more effective then task.enabled = false, because we avoid executing deps as well |
| 27 | def reentrance = false |
| 28 | project.tasks.whenTaskAdded { task -> |
| Jeff Gaston | aba1e6e | 2019-03-08 19:19:34 -0500 | [diff] [blame] | 29 | if (task instanceof org.gradle.api.tasks.testing.Test |
| Jeff Gaston | a3d28a7 | 2019-03-08 19:19:34 -0500 | [diff] [blame] | 30 | || task.name.startsWith("assemble") |
| 31 | || task.name == "transformDexArchiveWithExternalLibsDexMergerForPublicDebug" |
| 32 | || task.name == "transformResourcesWithMergeJavaResForPublicDebug" |
| 33 | || task.name == "checkPublicDebugDuplicateClasses") { |
| 34 | if (!reentrance) { |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 35 | reentrance = true |
| 36 | project.tasks.replace(task.name) |
| 37 | reentrance = false |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | android { |
| Jake Wharton | c2d7549 | 2018-07-13 19:24:58 -0400 | [diff] [blame] | 43 | defaultConfig { |
| Alan Viverette | 033f659 | 2018-11-28 17:18:38 -0500 | [diff] [blame] | 44 | minSdkVersion SupportConfig.COMPILE_SDK_VERSION |
| Jeff Gaston | f5cea860 | 2018-11-06 21:12:41 -0500 | [diff] [blame] | 45 | javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = false |
| Jake Wharton | c2d7549 | 2018-07-13 19:24:58 -0400 | [diff] [blame] | 46 | } |
| 47 | |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 48 | sourceSets { |
| 49 | main { |
| 50 | manifest.srcFile "AndroidManifest.xml" |
| 51 | } |
| 52 | } |
| Oussama Ben Abdelbaki | 892e5b0 | 2018-10-23 22:08:30 +0000 | [diff] [blame] | 53 | flavorDimensions "library-group" |
| Sergey Vasilinets | cb30642 | 2018-05-22 14:39:17 -0700 | [diff] [blame] | 54 | } |
| Nick Anthony | b4f01cb | 2019-03-25 14:03:17 +0000 | [diff] [blame^] | 55 | |
| 56 | dependencies { |
| 57 | /* |
| 58 | * This is needed to build Public Docs for media2:1.0.0-alpha04 and higher |
| 59 | * Our current guess is that Doclava isn't checking which dependencies are unique to |
| 60 | * the compileOnly configuration, since they're not supposed to be needed at runtime. |
| 61 | */ |
| 62 | compileOnly(CHECKER_FRAMEWORK) |
| 63 | } |
| 64 | |