blob: 23d2b8408c1ff278036211c8114a8441eb53c21c [file] [log] [blame]
/*
* Copyright 2020 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.
*/
/**
* This file was created using the `create_project.py` script located in the
* `<AndroidX root>/development/project-creator` directory.
*
* Please use that script when creating a new project, rather than copying an existing project and
* modifying its settings.
*/
import androidx.build.Publish
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
}
// This task copies the apks provided by the `apkAssets` configuration and places them in the
// assets folder. This allows a build time generation of the sample apps.
def copyApkTaskProvider = tasks.register("copyApkAssets", Copy) {
description = "Copies the asset apks provided by testfixture projects"
dependsOn(configurations.getByName("apkAssets"))
from(configurations.getByName("apkAssets").incoming.artifactView {}.files)
into(layout.buildDirectory.dir("intermediates/apkAssets"))
// Note that the artifact directory included contain multiple output-metadata.json files built
// with the apks. Since we're not interested in those we can simply exclude duplicates.
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
// Define a configuration that can be resolved. This project is the consumer of test apks, i.e. it
// contains the integration tests.
configurations {
apkAssets {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
objects.named(LibraryElements, 'apkAssets')
)
}
}
}
dependencies {
api("androidx.annotation:annotation:1.1.0")
api(project(":wear:watchface:watchface-complications"))
api(project(":wear:watchface:watchface-data"))
api(libs.kotlinStdlib)
implementation("androidx.core:core:1.1.0")
implementation("androidx.preference:preference:1.1.0")
testImplementation(libs.testCore)
testImplementation(libs.testRules)
testImplementation(libs.mockitoCore4)
testImplementation(libs.robolectric)
testImplementation(libs.truth)
testImplementation(libs.kotlinTest)
testImplementation(libs.junit)
androidTestImplementation(libs.testExtJunit)
androidTestImplementation(libs.testCore)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.testRules)
androidTestImplementation(libs.truth)
androidTestApi(project(":wear:watchface:watchface-style-old-api-test-stub"))
apkAssets(project(":wear:watchface:watchface-style-old-api-test-service"))
}
// It makes sure that the apks are generated before the assets are packed.
afterEvaluate {
tasks.named("generateDebugAndroidTestAssets").configure { it.dependsOn(copyApkTaskProvider) }
}
android {
defaultConfig {
minSdkVersion 26
}
// Use Robolectric 4.+
testOptions.unitTests.includeAndroidResources = true
sourceSets.androidTest.assets.srcDir(copyApkTaskProvider)
namespace "androidx.wear.watchface.style"
}
androidx {
name = "Android Wear Watchface Style"
publish = Publish.SNAPSHOT_AND_RELEASE
inceptionYear = "2020"
description = "Android Wear Watchface Style"
metalavaK2UastEnabled = true
}