Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | b938b2e | 2017-07-24 14:47:17 -0700 | [diff] [blame] | 17 | import android.support.LibraryVersions |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 18 | import com.android.build.gradle.internal.coverage.JacocoPlugin |
| 19 | import com.android.build.gradle.internal.coverage.JacocoReportTask |
| 20 | import com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask |
Aurimas Liutikas | a015004 | 2017-04-21 09:46:12 -0700 | [diff] [blame] | 21 | import org.gradle.api.logging.configuration.ShowStacktrace |
Yigit Boyar | a9ac19d | 2017-09-20 16:11:49 -0700 | [diff] [blame] | 22 | import android.support.gmaven.GMavenVersionChecker |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 23 | |
| 24 | def supportRoot = ext.supportRootFolder |
| 25 | if (supportRoot == null) { |
| 26 | throw new RuntimeException("variable supportRootFolder is not set. you must set it before" + |
| 27 | " including this script") |
| 28 | } |
| 29 | def init = new Properties() |
| 30 | ext.init = init |
Alan Viverette | 1b86237 | 2017-03-22 11:32:28 -0400 | [diff] [blame] | 31 | ext.init.debugKeystore = file("${supportRoot}/development/keystore/debug.keystore") |
Yigit Boyar | a9ac19d | 2017-09-20 16:11:49 -0700 | [diff] [blame] | 32 | rootProject.ext.versionChecker = new GMavenVersionChecker(rootProject) |
Aurimas Liutikas | 9ab3b4c | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 33 | ext.runningInBuildServer = System.env.DIST_DIR != null && System.env.OUT_DIR != null |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 34 | |
| 35 | apply from: "${supportRoot}/buildSrc/dependencies.gradle" |
Alan Viverette | 5b3946f | 2017-04-27 09:59:22 -0400 | [diff] [blame] | 36 | ext.docs = [:] |
| 37 | ext.docs.offline = rootProject.getProperties().containsKey("offlineDocs") |
| 38 | ext.docs.dac = [ |
| 39 | libraryroot: "android/support", |
| 40 | dataname: "SUPPORT_DATA" |
| 41 | ] |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 42 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 43 | def enableDoclavaAndJDiff(p) { |
| 44 | p.configurations { |
| 45 | doclava |
| 46 | jdiff |
| 47 | } |
| 48 | |
| 49 | p.dependencies { |
Aurimas Liutikas | eca7a07 | 2017-07-11 01:11:52 +0000 | [diff] [blame] | 50 | doclava project(':doclava') |
| 51 | jdiff project(':jdiff') |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 52 | jdiff libs.xml_parser_apis |
| 53 | jdiff libs.xerces_impl |
| 54 | } |
| 55 | apply from: "${ext.supportRootFolder}/buildSrc/diff_and_docs.gradle" |
| 56 | } |
| 57 | |
Aurimas Liutikas | bb78f3f | 2017-06-19 11:30:37 -0700 | [diff] [blame] | 58 | def getFullSdkPath() { |
Aurimas Liutikas | b06771d | 2017-04-20 09:46:49 -0700 | [diff] [blame] | 59 | final String osName = System.getProperty("os.name").toLowerCase(); |
| 60 | final boolean isMacOsX = |
| 61 | osName.contains("mac os x") || osName.contains("darwin") || osName.contains("osx"); |
| 62 | final String platform = isMacOsX ? 'darwin' : 'linux' |
Aurimas Liutikas | bb78f3f | 2017-06-19 11:30:37 -0700 | [diff] [blame] | 63 | return "${repos.prebuiltsRoot}/fullsdk-${platform}" |
| 64 | } |
| 65 | |
| 66 | def setSdkInLocalPropertiesFile() { |
Aurimas Liutikas | d2d9bda | 2017-03-03 16:06:39 -0800 | [diff] [blame] | 67 | ext.buildToolsVersion = '26.0.0' |
Aurimas Liutikas | bb78f3f | 2017-06-19 11:30:37 -0700 | [diff] [blame] | 68 | final String fullSdkPath = getFullSdkPath(); |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 69 | if (file(fullSdkPath).exists()) { |
| 70 | gradle.ext.currentSdk = 26 |
Alan Viverette | eb9f332 | 2017-03-09 16:29:57 -0500 | [diff] [blame] | 71 | project.ext.androidJar = |
| 72 | files("${fullSdkPath}/platforms/android-${gradle.currentSdk}/android.jar") |
| 73 | project.ext.androidSrcJar = |
| 74 | file("${fullSdkPath}/platforms/android-${gradle.currentSdk}/android-stubs-src.jar") |
Alan Viverette | 810a148 | 2017-03-20 12:43:43 -0400 | [diff] [blame] | 75 | project.ext.androidApiTxt = null |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 76 | File props = file("local.properties") |
| 77 | props.write "sdk.dir=${fullSdkPath}" |
Aurimas Liutikas | 3c66600 | 2017-03-08 19:30:28 -0800 | [diff] [blame] | 78 | ext.usingFullSdk = true |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 79 | } else { |
| 80 | gradle.ext.currentSdk = 'current' |
Aurimas Liutikas | 9ab3b4c | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 81 | project.ext.androidJar = files("${repos.prebuiltsRoot}/sdk/current/android.jar") |
Alan Viverette | 810a148 | 2017-03-20 12:43:43 -0400 | [diff] [blame] | 82 | project.ext.androidSrcJar = null |
Aurimas Liutikas | 9ab3b4c | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 83 | project.ext.androidApiTxt = file("${repos.prebuiltsRoot}/sdk/api/26.txt") |
Aurimas Liutikas | bb78f3f | 2017-06-19 11:30:37 -0700 | [diff] [blame] | 84 | System.setProperty('android.dir', "${supportRootFolder}/../../") |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 85 | File props = file("local.properties") |
| 86 | props.write "android.dir=../../" |
Aurimas Liutikas | 3c66600 | 2017-03-08 19:30:28 -0800 | [diff] [blame] | 87 | ext.usingFullSdk = false |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 88 | } |
| 89 | } |
| 90 | |
| 91 | def setupRepoOutAndBuildNumber() { |
Yigit Boyar | ef30066 | 2017-05-01 11:52:07 -0700 | [diff] [blame] | 92 | // common support repo folder which works well for prebuilts. |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 93 | ext.supportRepoOut = '' |
Aurimas Liutikas | 76542da | 2017-06-29 17:00:29 -0700 | [diff] [blame] | 94 | ext.buildNumber = "0" |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 95 | /* |
| 96 | * With the build server you are given two env variables. |
| 97 | * The OUT_DIR is a temporary directory you can use to put things during the build. |
| 98 | * The DIST_DIR is where you want to save things from the build. |
| 99 | * |
| 100 | * The build server will copy the contents of DIST_DIR to somewhere and make it available. |
| 101 | */ |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 102 | if (ext.runningInBuildServer) { |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 103 | buildDir = new File(System.env.OUT_DIR + '/gradle/frameworks/support/build') |
| 104 | .getCanonicalFile() |
| 105 | project.ext.distDir = new File(System.env.DIST_DIR).getCanonicalFile() |
| 106 | |
| 107 | // the build server does not pass the build number so we infer it from the last folder of |
| 108 | // the dist path. |
| 109 | ext.buildNumber = project.ext.distDir.getName() |
Aurimas Liutikas | a015004 | 2017-04-21 09:46:12 -0700 | [diff] [blame] | 110 | |
| 111 | // the build server should always print out full stack traces for any failures. |
| 112 | gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 113 | } else { |
| 114 | buildDir = file("${ext.supportRootFolder}/../../out/host/gradle/frameworks/support/build") |
| 115 | project.ext.distDir = new File("${ext.supportRootFolder}/../../out/dist") |
| 116 | } |
| 117 | subprojects { |
| 118 | // Change buildDir first so that all plugins pick up the new value. |
| 119 | project.buildDir = new File("$project.parent.buildDir/../$project.name/build") |
| 120 | } |
| 121 | ext.supportRepoOut = new File(buildDir, 'support_repo') |
| 122 | ext.testApkDistOut = ext.distDir |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 123 | ext.testResultsDistDir = new File(distDir, "host-test-reports") |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 124 | ext.docsDir = new File(buildDir, 'javadoc') |
| 125 | } |
| 126 | |
Aurimas Liutikas | 38e8f4d | 2017-06-16 08:31:03 -0700 | [diff] [blame] | 127 | def configureBuildOnServer() { |
| 128 | def buildOnServerTask = rootProject.tasks.create("buildOnServer") |
| 129 | rootProject.tasks.whenTaskAdded { task -> |
| 130 | if ("createArchive".equals(task.name)) { |
| 131 | buildOnServerTask.dependsOn task |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | subprojects { |
| 136 | project.tasks.whenTaskAdded { task -> |
| 137 | if ("assembleErrorProne".equals(task.name) || "assembleAndroidTest".equals(task.name)) { |
| 138 | buildOnServerTask.dependsOn task |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 144 | def configureSubProjects() { |
| 145 | // lint every library |
| 146 | def lintTask = project.tasks.create("lint") |
| 147 | subprojects { |
Aurimas Liutikas | 6509a1a | 2017-05-09 16:25:43 -0700 | [diff] [blame] | 148 | repos.addMavenRepositories(repositories) |
| 149 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 150 | // Only modify Android projects. |
Aurimas Liutikas | eca7a07 | 2017-07-11 01:11:52 +0000 | [diff] [blame] | 151 | if (project.name.equals('doclava') |
| 152 | || project.name.equals('jdiff') |
| 153 | || project.name.equals('support-testutils') |
Hyundo Moon | da9ee6b | 2017-07-21 14:32:12 +0900 | [diff] [blame] | 154 | || project.name.equals('noto-emoji-compat') |
| 155 | || project.name.equals('support-media-compat-test-lib')) { |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 156 | // disable tests and return |
| 157 | project.tasks.whenTaskAdded { task -> |
| 158 | if (task instanceof org.gradle.api.tasks.testing.Test) { |
| 159 | task.enabled = false |
| 160 | } |
| 161 | } |
| 162 | return |
| 163 | } |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 164 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 165 | project.ext.currentSdk = gradle.ext.currentSdk |
| 166 | apply plugin: 'maven' |
| 167 | |
Aurimas Liutikas | b938b2e | 2017-07-24 14:47:17 -0700 | [diff] [blame] | 168 | version = LibraryVersions.SUPPORT_LIBRARY.toString(); |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 169 | group = 'com.android.support' |
| 170 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 171 | project.plugins.whenPluginAdded { plugin -> |
| 172 | def isAndroidLibrary = "com.android.build.gradle.LibraryPlugin" |
| 173 | .equals(plugin.class.name) |
| 174 | def isAndroidApp = "com.android.build.gradle.AppPlugin".equals(plugin.class.name) |
| 175 | def isJavaLibrary = "org.gradle.api.plugins.JavaPlugin".equals(plugin.class.name) |
| 176 | |
| 177 | if (isAndroidLibrary || isAndroidApp) { |
| 178 | project.android.buildToolsVersion = rootProject.buildToolsVersion |
| 179 | |
| 180 | // Enable code coverage for debug builds only if we are not running inside the IDE, |
| 181 | // since enabling coverage reports breaks the method parameter resolution in the IDE |
| 182 | // debugger. |
| 183 | project.android.buildTypes.debug.testCoverageEnabled = |
Sergey Vasilinets | ac8e72b | 2017-04-26 15:55:17 -0700 | [diff] [blame] | 184 | !project.hasProperty('android.injected.invoked.from.ide') |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 185 | |
| 186 | // Copy the class files in a jar to be later used to generate code coverage report |
| 187 | project.android.testVariants.all { v -> |
| 188 | // check if the variant has any source files |
| 189 | // and test coverage is enabled |
| 190 | if (v.buildType.testCoverageEnabled |
| 191 | && v.sourceSets.any { !it.java.sourceFiles.isEmpty() }) { |
| 192 | def jarifyTask = project.tasks.create( |
| 193 | name: "package${v.name.capitalize()}ClassFilesForCoverageReport", |
| 194 | type: Jar) { |
| 195 | from v.testedVariant.javaCompile.destinationDir |
| 196 | exclude "**/R.class" |
| 197 | exclude "**/R\$*.class" |
| 198 | exclude "**/BuildConfig.class" |
| 199 | destinationDir file(project.distDir) |
Aurimas Liutikas | 76542da | 2017-06-29 17:00:29 -0700 | [diff] [blame] | 200 | archiveName "${project.name}-${v.baseName}-allclasses.jar" |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 201 | } |
Aurimas Liutikas | 21b7fce | 2017-06-23 09:52:08 -0700 | [diff] [blame] | 202 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 203 | def collectJacocoAntPackages = project.tasks.create( |
| 204 | name: "collectJacocoAntPackages", |
| 205 | type: Jar) { |
Aurimas Liutikas | 21b7fce | 2017-06-23 09:52:08 -0700 | [diff] [blame] | 206 | inputs.files project.configurations[JacocoPlugin.ANT_CONFIGURATION_NAME] |
| 207 | from { |
Aurimas Liutikas | 585a934 | 2017-06-25 16:07:56 -0700 | [diff] [blame] | 208 | project.configurations[JacocoPlugin.ANT_CONFIGURATION_NAME] |
| 209 | .resolvedConfiguration |
| 210 | .resolvedArtifacts.collect{ zipTree(it.getFile()) }} { |
Aurimas Liutikas | 21b7fce | 2017-06-23 09:52:08 -0700 | [diff] [blame] | 211 | // exclude all the signatures the jar might have |
| 212 | exclude "META-INF/*.SF" |
| 213 | exclude "META-INF/*.DSA" |
| 214 | exclude "META-INF/*.RSA" |
| 215 | } |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 216 | destinationDir file(project.distDir) |
Aurimas Liutikas | 21b7fce | 2017-06-23 09:52:08 -0700 | [diff] [blame] | 217 | archiveName "jacocoant.jar" |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 218 | } |
Aurimas Liutikas | 21b7fce | 2017-06-23 09:52:08 -0700 | [diff] [blame] | 219 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 220 | jarifyTask.dependsOn v.getJavaCompiler() |
Aurimas Liutikas | 21b7fce | 2017-06-23 09:52:08 -0700 | [diff] [blame] | 221 | v.assemble.dependsOn jarifyTask , collectJacocoAntPackages |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | |
| 225 | // Enforce NewApi lint check as fatal. |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 226 | project.android.lintOptions.fatal 'NewApi' |
Aurimas Liutikas | 6c62570 | 2017-09-20 14:35:47 -0700 | [diff] [blame] | 227 | lintTask.dependsOn {project.lint} |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | if (isAndroidLibrary || isJavaLibrary) { |
| 231 | // Add library to the aggregate dependency report. |
| 232 | task allDeps(type: DependencyReportTask) {} |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 233 | |
Aurimas Liutikas | 6509a1a | 2017-05-09 16:25:43 -0700 | [diff] [blame] | 234 | project.afterEvaluate { |
| 235 | Upload uploadTask = (Upload) project.tasks.uploadArchives; |
| 236 | uploadTask.repositories.mavenDeployer { |
Aurimas Liutikas | 279780d | 2017-08-09 14:03:59 -0700 | [diff] [blame] | 237 | repository(url: uri("$rootProject.ext.supportRepoOut")) |
| 238 | setUniqueVersion(true) |
Aurimas Liutikas | 6509a1a | 2017-05-09 16:25:43 -0700 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | // Before the upload, make sure the repo is ready. |
| 242 | uploadTask.dependsOn rootProject.tasks.prepareRepo |
| 243 | |
Aurimas Liutikas | 6509a1a | 2017-05-09 16:25:43 -0700 | [diff] [blame] | 244 | // Make the mainupload depend on this one. |
| 245 | mainUpload.dependsOn uploadTask |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 246 | } |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 247 | } |
| 248 | } |
| 249 | |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 250 | // Copy instrumentation test APKs and app APKs into the dist dir |
| 251 | // For test apks, they are uploaded only if we have java test sources. |
| 252 | // For regular app apks, they are uploaded only if they have java sources. |
| 253 | project.tasks.whenTaskAdded { task -> |
| 254 | if (task.name.startsWith("packageDebug")) { |
| 255 | def testApk = task.name.contains("AndroidTest") |
| 256 | task.doLast { |
| 257 | def source = testApk ? project.android.sourceSets.androidTest |
| 258 | : project.android.sourceSets.main |
Aurimas Liutikas | ef3b492 | 2017-06-28 10:44:59 -0700 | [diff] [blame] | 259 | if (task.hasProperty("outputDirectory") && !source.java.sourceFiles.isEmpty()) { |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 260 | copy { |
Aurimas Liutikas | ef3b492 | 2017-06-28 10:44:59 -0700 | [diff] [blame] | 261 | from(task.outputDirectory) |
| 262 | include '*.apk' |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 263 | into(rootProject.ext.testApkDistOut) |
| 264 | rename { String fileName -> |
Hyundo Moon | 9938e17 | 2017-07-26 20:51:11 +0900 | [diff] [blame] | 265 | // Exclude media-compat-test-* modules from existing support library |
| 266 | // presubmit tests. |
| 267 | if (fileName.contains("media-compat-test")) { |
| 268 | fileName.replace("-debug-androidTest", "") |
Yigit Boyar | 96a0fcd | 2017-08-25 18:18:28 -0700 | [diff] [blame] | 269 | } else { |
| 270 | // multiple modules may have the same name so prefix the name with |
| 271 | // the module's path to ensure it is unique. |
| 272 | // e.g. palette-v7-debug-androidTest.apk becomes |
| 273 | // support-palette-v7_palette-v7-debug-androidTest.apk |
| 274 | "${project.getPath().replace(':', '-').substring(1)}_${fileName}" |
Hyundo Moon | 9938e17 | 2017-07-26 20:51:11 +0900 | [diff] [blame] | 275 | } |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 276 | } |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // copy host side test results to DIST |
| 284 | project.tasks.whenTaskAdded { task -> |
| 285 | if (task instanceof org.gradle.api.tasks.testing.Test) { |
| 286 | def junitReport = task.reports.junitXml |
| 287 | if (junitReport.enabled) { |
| 288 | def zipTask = project.tasks.create(name : "zipResultsOf${task.name.capitalize()}", type : Zip) { |
| 289 | destinationDir(testResultsDistDir) |
Yigit Boyar | 278676d | 2017-03-10 15:29:11 -0800 | [diff] [blame] | 290 | // first one is always :, drop it. |
| 291 | archiveName("${project.getPath().split(":").join("_").substring(1)}.zip") |
Yigit Boyar | 7bfacb7 | 2017-03-02 14:27:41 -0800 | [diff] [blame] | 292 | } |
| 293 | if (project.rootProject.ext.runningInBuildServer) { |
| 294 | task.ignoreFailures = true |
| 295 | } |
| 296 | task.finalizedBy zipTask |
| 297 | task.doFirst { |
| 298 | zipTask.from(junitReport.destination) |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 304 | project.afterEvaluate { p -> |
| 305 | // remove dependency on the test so that we still get coverage even if some tests fail |
| 306 | p.tasks.findAll { it instanceof JacocoReportTask }.each { task -> |
| 307 | def toBeRemoved = new ArrayList() |
| 308 | def dependencyList = task.taskDependencies.values |
| 309 | dependencyList.each { dep -> |
| 310 | if (dep instanceof String) { |
| 311 | def t = tasks.findByName(dep) |
| 312 | if (t instanceof DeviceProviderInstrumentTestTask) { |
| 313 | toBeRemoved.add(dep) |
| 314 | task.mustRunAfter(t) |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | toBeRemoved.each { dep -> |
| 319 | dependencyList.remove(dep) |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | def setupRelease() { |
| 327 | apply from: "${ext.supportRootFolder}/buildSrc/release.gradle" |
| 328 | } |
| 329 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 330 | ext.init.enableDoclavaAndJDiff = this.&enableDoclavaAndJDiff |
| 331 | ext.init.setSdkInLocalPropertiesFile = this.&setSdkInLocalPropertiesFile |
| 332 | ext.init.setupRepoOutAndBuildNumber = this.&setupRepoOutAndBuildNumber |
| 333 | ext.init.setupRelease = this.&setupRelease |
Aurimas Liutikas | 38e8f4d | 2017-06-16 08:31:03 -0700 | [diff] [blame] | 334 | ext.init.configureSubProjects = this.&configureSubProjects |
Yigit Boyar | e1bbf71 | 2017-03-08 13:52:37 -0800 | [diff] [blame] | 335 | ext.init.configureBuildOnServer = this.&configureBuildOnServer |