| /* |
| * 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.SupportConfig |
| |
| plugins { |
| id("AndroidXPlugin") |
| id("kotlin") |
| } |
| |
| def generatedResources = "$buildDir/generated/resources" |
| def prebuiltsRoot = SupportConfig.getPrebuiltsRootPath(project) |
| def localSupportRepo = SupportConfig.getSupportRepoPath(project) |
| def agpDependency = AGP_LATEST |
| def debugKeystore = "${SupportConfig.getKeystore(project)}" |
| |
| sourceSets { |
| test.java.srcDirs += 'src/tests/kotlin' |
| test.resources.srcDirs += generatedResources |
| } |
| |
| |
| dependencies { |
| implementation(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("agpDependency=$agpDependency\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:publish"), |
| tasks.findByPath(":room:room-runtime:publish"), |
| tasks.findByPath(":room:room-migration:publish"), |
| tasks.findByPath(":room:room-compiler:publish"), |
| ) |