| /* |
| * Copyright (C) 2019 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| import static androidx.build.dependencies.DependenciesKt.* |
| import androidx.build.CompilationTarget |
| import androidx.build.LibraryGroups |
| import androidx.build.LibraryVersions |
| import androidx.build.AndroidXExtension |
| import androidx.build.SupportConfig |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("kotlin") |
| } |
| |
| def generatedResources = "$buildDir/generated/resources" |
| def prebuiltsRoot = SupportConfig.getPrebuiltsRootPath(project) |
| def localSupportRepo = SupportConfig.getSupportRepoPath(project) |
| def agpVersion = SupportConfig.getAGPVersion(project) |
| def debugKeystore = "${SupportConfig.getKeystore(project)}" |
| |
| sourceSets { |
| test.java.srcDirs += 'src/tests/kotlin' |
| test.resources.srcDirs += generatedResources |
| } |
| |
| |
| dependencies { |
| compile(KOTLIN_STDLIB) |
| testImplementation(JUNIT) |
| testImplementation(TRUTH) |
| testImplementation gradleTestKit() |
| |
| } |
| |
| task generateSdkResource() { |
| inputs.property("prebuiltsRoot", prebuiltsRoot) |
| inputs.property("localSupportRepo", localSupportRepo) |
| inputs.property("compileSdkVersion", SupportConfig.TARGET_SDK_VERSION) |
| inputs.property("buildToolsVersion", SupportConfig.BUILD_TOOLS_VERSION) |
| inputs.property("minSdkVersion", SupportConfig.DEFAULT_MIN_SDK_VERSION) |
| inputs.property("debugKeystore", debugKeystore) |
| outputs.dir(generatedResources) |
| doLast { |
| new File(generatedResources, "sdk.prop").withWriter('UTF-8') { writer -> |
| writer.write("prebuiltsRepo=$prebuiltsRoot\n") |
| writer.write("localSupportRepo=$localSupportRepo\n") |
| writer.write("agpVersion=$agpVersion\n") |
| writer.write("compileSdkVersion=$SupportConfig.TARGET_SDK_VERSION\n") |
| writer.write("buildToolsVersion=$SupportConfig.BUILD_TOOLS_VERSION\n") |
| writer.write("minSdkVersion=$SupportConfig.DEFAULT_MIN_SDK_VERSION\n") |
| writer.write("debugKeystore=$debugKeystore\n") |
| } |
| } |
| } |
| |
| tasks.findByName("compileTestKotlin").dependsOn(generateSdkResource) |
| |
| tasks.findByPath("test").dependsOn( |
| tasks.findByPath(":room:room-common:uploadArchives"), |
| tasks.findByPath(":room:room-runtime:uploadArchives"), |
| tasks.findByPath(":room:room-migration:uploadArchives"), |
| tasks.findByPath(":room:room-compiler:uploadArchives"), |
| ) |
| |
| uploadArchives.enabled = false |