blob: 97284b8bd222dd1f5179e88b644aefc355b17ae5 [file] [log] [blame]
/*
* Copyright (C) 2016 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 org.gradle.internal.jvm.Jvm
import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.CompilationTarget
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.SupportConfig
import androidx.build.AndroidXExtension
import androidx.build.SdkHelperKt
import androidx.build.Publish
plugins {
id("AndroidXPlugin")
id("kotlin")
}
def antlrOut = "$buildDir/generated/antlr/grammar-gen/"
sourceSets {
main.java.srcDirs += 'src/main/grammar-gen'
test.java.srcDirs += 'src/tests/kotlin'
main.java.srcDirs += antlrOut
}
// Temporary hack to stop AS to adding two guavas into test's classpath
configurations.all {
resolutionStrategy {
force GUAVA
}
}
dependencies {
compile(project(":room:room-common"))
compile(project(":room:room-migration"))
compile(KOTLIN_STDLIB)
compile(AUTO_COMMON)
compile(AUTO_VALUE_ANNOTATIONS)
compile(JAVAPOET)
compile(ANTLR)
compile(XERIAL)
compile(KOTLIN_METADATA_JVM)
compile(APACHE_COMMONS_CODEC)
testCompile(GOOGLE_COMPILE_TESTING)
testCompile project(":paging:paging-common")
testCompile(JUNIT)
testCompile(INTELLIJ_ANNOTATIONS)
testCompile(JSR250)
testCompile(MOCKITO_CORE)
testCompile fileTree(dir: "${SdkHelperKt.getSdkPath(project.rootDir)}/platforms/$SupportConfig.COMPILE_SDK_VERSION/",
include : "android.jar")
testCompile fileTree(dir: "${new File(project(":room:room-runtime").buildDir, "libJar")}",
include : "*.jar")
testCompile fileTree(dir: "${new File(project(":sqlite:sqlite").buildDir, "libJar")}",
include : "*.jar")
testCompile files(Jvm.current().getToolsJar())
}
def generateAntlrTask = task('generateAntlrGrammar', type: JavaExec) {
def outFolder = file(antlrOut)
outputs.dir(outFolder)
inputs.file("$projectDir/SQLite.g4")
classpath configurations.runtime
main "org.antlr.v4.Tool"
args "SQLite.g4", "-visitor", "-o", new File(outFolder, "androidx/room/parser").path,
"-package", "androidx.room.parser"
}
tasks.findByName("compileKotlin").dependsOn(generateAntlrTask)
tasks.findByName("compileKotlin").dependsOn(":room:room-runtime:jarDebug")
tasks.findByName("compileKotlin").dependsOn(":sqlite:sqlite:jarDebug")
androidx {
name = "Android Room Compiler"
publish = Publish.SNAPSHOT_AND_RELEASE
toolingProject = true
mavenVersion = LibraryVersions.ROOM
mavenGroup = LibraryGroups.ROOM
inceptionYear = "2017"
description = "Android Room annotation processor"
url = AndroidXExtension.ARCHITECTURE_URL
compilationTarget = CompilationTarget.HOST
}