普通文本  |  53行  |  1.53 KB

import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.SupportLibraryExtension

plugins {
    id("SupportKotlinLibraryPlugin")
}

sourceSets {
    test.java.srcDirs += 'src/tests/kotlin'
}

// Temporary hack to stop AS to adding two guavas into test's classpath
configurations.all {
    resolutionStrategy {
        force GUAVA
    }
}

dependencies {
    compile(project(":lifecycle:lifecycle-common"))
    compile(KOTLIN_STDLIB)
    compile(AUTO_COMMON)
    compile(JAVAPOET)
    testCompile(GOOGLE_COMPILE_TESTING)
    testCompile(JSR250)
    testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
}

// we actually need to compile :lifecycle:lifecycle-common, but compileJava is easier
task compileTestLibrarySource(type: JavaCompile, dependsOn: compileJava) {
    source "src/tests/test-data/lib/src"
    classpath = project.compileJava.classpath
    destinationDir = new File(project.buildDir, 'test-data/lib/classes')
}

task jarTestLibrarySource(type: Jar, dependsOn: compileTestLibrarySource) {
    from compileTestLibrarySource.destinationDir
    archiveName = "test-library.jar"
    destinationDir = file("src/tests/test-data/lib/")
}

supportLibrary {
    name = "Android Lifecycles Compiler"
    publish = true
    mavenVersion = LibraryVersions.LIFECYCLES_EXT
    mavenGroup = LibraryGroups.LIFECYCLE
    inceptionYear = "2017"
    description = "Android Lifecycles annotation processor"
    url = SupportLibraryExtension.ARCHITECTURE_URL
}