/* * Copyright (C) 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 * `/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.SoftwareType plugins { id("AndroidXPlugin") id("kotlin") } dependencies { implementation(project(":lifecycle:lifecycle-common")) implementation(libs.kotlinStdlib) implementation(libs.autoCommon) implementation(libs.javapoet) testImplementation(libs.googleCompileTesting) testImplementation(libs.jsr250) } // The following tasks are used to create test-library.jar used by ValidCasesTest.kt // We actually need to compile :lifecycle:lifecycle-common, but compileJava is easier def compileTestLibrarySource = tasks.register("compileTestLibrarySource", JavaCompile) { it.dependsOn(compileJava) it.source "src/test/test-data/lib/src" it.classpath = project.compileJava.classpath it.destinationDirectory.set(layout.buildDirectory.dir("test-data-lib-classes")) } def testLibraryJar = tasks.register("jarTestLibrarySource", Jar) { it.from(compileTestLibrarySource.map { it.destinationDirectory }) it.archiveFileName.set("test-library.jar") it.destinationDirectory.set(layout.buildDirectory.dir("test-data-lib-jar")) } sourceSets.test.output.dir(testLibraryJar.map { it.destinationDirectory }) tasks.withType(Test).configureEach { // https://github.com/google/compile-testing/issues/222 it.jvmArgs "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" } androidx { name = "Lifecycles Compiler" type = SoftwareType.ANNOTATION_PROCESSOR inceptionYear = "2017" description = "Android Lifecycles annotation processor" }