blob: 0d62cf8db775bc0324290f4ba93c1c805c0c9c47 [file] [log] [blame]
Yigit Boyar19b41102016-11-20 10:46:32 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Aurimas Liutikas7f40a7e2017-10-27 17:55:06 -070016
Aurimas Liutikas3196ef12018-01-02 16:02:50 -080017
18import android.support.SupportConfig
19
Aurimas Liutikasf4ec12f2017-11-22 12:55:43 -080020import static android.support.dependencies.DependenciesKt.*
Aurimas Liutikas7f40a7e2017-10-27 17:55:06 -070021import android.support.LibraryGroups
Yigit Boyard809f482017-09-13 16:02:16 -070022import android.support.LibraryVersions
Yigit Boyar8fe76242017-09-18 09:36:51 -070023import android.support.SupportLibraryExtension
24
Yigit Boyard809f482017-09-13 16:02:16 -070025apply plugin: android.support.SupportKotlinLibraryPlugin
Yigit Boyar19b41102016-11-20 10:46:32 -080026
27def antlrOut = "$buildDir/generated/antlr/grammar-gen/"
28sourceSets {
29 main.java.srcDirs += 'src/main/grammar-gen'
30 test.java.srcDirs += 'src/tests/kotlin'
31 main.java.srcDirs += antlrOut
32}
Sergey Vasilinets0af2c3f2017-07-20 12:48:16 -070033
34// Temporary hack to stop AS to adding two guavas into test's classpath
35configurations.all {
36 resolutionStrategy {
Aurimas Liutikas81b5bac2017-11-28 13:26:43 -080037 force GUAVA
Sergey Vasilinets0af2c3f2017-07-20 12:48:16 -070038 }
39}
40
Yigit Boyar19b41102016-11-20 10:46:32 -080041dependencies {
Yigit Boyar9c3bbb72017-01-13 11:04:36 -080042 // taken from ButterKnife
Yigit Boyar2259e4d2016-11-25 18:26:10 -080043 def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
44 def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
Aurimas Liutikasf4ec12f2017-11-22 12:55:43 -080045 compile(project(":room:common"))
46 compile(project(":room:migration"))
Aurimas Liutikas81b5bac2017-11-28 13:26:43 -080047 compile(KOTLIN_STDLIB)
48 compile(AUTO_COMMON)
49 compile(JAVAPOET)
50 compile(ANTLR)
51 compile(XERIAL)
52 compile(APACHE_COMMONS_CODEC)
53 testCompile(GOOGLE_COMPILE_TESTING)
Chris Craik9fd8e612017-06-23 14:07:04 -070054 testCompile project(":paging:common")
Aurimas Liutikasf4ec12f2017-11-22 12:55:43 -080055 testCompile(JUNIT)
Aurimas Liutikas81b5bac2017-11-28 13:26:43 -080056 testCompile(INTELLIJ_ANNOTATIONS)
57 testCompile(JSR250)
Aurimas Liutikasf4ec12f2017-11-22 12:55:43 -080058 testCompile(MOCKITO_CORE)
Aurimas Liutikas3196ef12018-01-02 16:02:50 -080059 testCompile fileTree(dir: "${sdkHandler.sdkFolder}/platforms/android-$SupportConfig.CURRENT_SDK_VERSION/",
Yigit Boyarefaf86a2016-12-02 15:16:35 -080060 include : "android.jar")
Yigit Boyar2eb51992016-12-13 15:00:07 -080061 testCompile fileTree(dir: "${new File(project(":room:runtime").buildDir, "libJar")}",
62 include : "*.jar")
Yigit Boyar8fe76242017-09-18 09:36:51 -070063 testCompile fileTree(dir: "${new File(project(":persistence:db").buildDir, "libJar")}",
Yigit Boyar2eb51992016-12-13 15:00:07 -080064 include : "*.jar")
Yigit Boyarefaf86a2016-12-02 15:16:35 -080065 testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
Yigit Boyar19b41102016-11-20 10:46:32 -080066}
67
Yigit Boyar19b41102016-11-20 10:46:32 -080068def generateAntlrTask = task('generateAntlrGrammar', type: JavaExec) {
69 def outFolder = file(antlrOut)
70 outputs.dir(outFolder)
Yigit Boyar922b65c2017-12-18 09:29:26 -080071 inputs.file("$projectDir/SQLite.g4")
Yigit Boyar19b41102016-11-20 10:46:32 -080072 classpath configurations.runtime
73 main "org.antlr.v4.Tool"
Yigit Boyar64db0cc2017-04-17 13:18:56 -070074 args "SQLite.g4", "-visitor", "-o", new File(outFolder, "android/arch/persistence/room/parser").path,
75 "-package", "android.arch.persistence.room.parser"
Yigit Boyar19b41102016-11-20 10:46:32 -080076}
77
78tasks.findByName("compileKotlin").dependsOn(generateAntlrTask)
Yigit Boyar2eb51992016-12-13 15:00:07 -080079tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug")
Yigit Boyar8fe76242017-09-18 09:36:51 -070080tasks.findByName("compileKotlin").dependsOn(":persistence:db:jarDebug")
Yigit Boyar19b41102016-11-20 10:46:32 -080081
Yigit Boyard809f482017-09-13 16:02:16 -070082supportLibrary {
Aurimas Liutikasea5ee822017-11-06 12:52:28 -080083 name = "Android Room Compiler"
84 publish = true
Sergey Vasilinets9c246882017-12-11 18:31:29 -080085 generateDocs = false
Aurimas Liutikas78c1ab72017-11-08 13:33:51 -080086 mavenVersion = LibraryVersions.ROOM
Aurimas Liutikas7f40a7e2017-10-27 17:55:06 -070087 mavenGroup = LibraryGroups.ROOM
Aurimas Liutikasea5ee822017-11-06 12:52:28 -080088 inceptionYear = "2017"
89 description = "Android Room annotation processor"
90 url = SupportLibraryExtension.ARCHITECTURE_URL
Yigit Boyard809f482017-09-13 16:02:16 -070091}