Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 1 | /* |
| 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 Liutikas | 7f40a7e | 2017-10-27 17:55:06 -0700 | [diff] [blame] | 16 | |
Aurimas Liutikas | 3196ef1 | 2018-01-02 16:02:50 -0800 | [diff] [blame] | 17 | |
| 18 | import android.support.SupportConfig |
| 19 | |
Aurimas Liutikas | f4ec12f | 2017-11-22 12:55:43 -0800 | [diff] [blame] | 20 | import static android.support.dependencies.DependenciesKt.* |
Aurimas Liutikas | 7f40a7e | 2017-10-27 17:55:06 -0700 | [diff] [blame] | 21 | import android.support.LibraryGroups |
Yigit Boyar | d809f48 | 2017-09-13 16:02:16 -0700 | [diff] [blame] | 22 | import android.support.LibraryVersions |
Yigit Boyar | 8fe7624 | 2017-09-18 09:36:51 -0700 | [diff] [blame] | 23 | import android.support.SupportLibraryExtension |
| 24 | |
Yigit Boyar | d809f48 | 2017-09-13 16:02:16 -0700 | [diff] [blame] | 25 | apply plugin: android.support.SupportKotlinLibraryPlugin |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 26 | |
| 27 | def antlrOut = "$buildDir/generated/antlr/grammar-gen/" |
| 28 | sourceSets { |
| 29 | main.java.srcDirs += 'src/main/grammar-gen' |
| 30 | test.java.srcDirs += 'src/tests/kotlin' |
| 31 | main.java.srcDirs += antlrOut |
| 32 | } |
Sergey Vasilinets | 0af2c3f | 2017-07-20 12:48:16 -0700 | [diff] [blame] | 33 | |
| 34 | // Temporary hack to stop AS to adding two guavas into test's classpath |
| 35 | configurations.all { |
| 36 | resolutionStrategy { |
Aurimas Liutikas | 81b5bac | 2017-11-28 13:26:43 -0800 | [diff] [blame] | 37 | force GUAVA |
Sergey Vasilinets | 0af2c3f | 2017-07-20 12:48:16 -0700 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 41 | dependencies { |
Yigit Boyar | 9c3bbb7 | 2017-01-13 11:04:36 -0800 | [diff] [blame] | 42 | // taken from ButterKnife |
Yigit Boyar | 2259e4d | 2016-11-25 18:26:10 -0800 | [diff] [blame] | 43 | def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger) |
| 44 | def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger) |
Aurimas Liutikas | f4ec12f | 2017-11-22 12:55:43 -0800 | [diff] [blame] | 45 | compile(project(":room:common")) |
| 46 | compile(project(":room:migration")) |
Aurimas Liutikas | 81b5bac | 2017-11-28 13:26:43 -0800 | [diff] [blame] | 47 | 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 Craik | 9fd8e61 | 2017-06-23 14:07:04 -0700 | [diff] [blame] | 54 | testCompile project(":paging:common") |
Aurimas Liutikas | f4ec12f | 2017-11-22 12:55:43 -0800 | [diff] [blame] | 55 | testCompile(JUNIT) |
Aurimas Liutikas | 81b5bac | 2017-11-28 13:26:43 -0800 | [diff] [blame] | 56 | testCompile(INTELLIJ_ANNOTATIONS) |
| 57 | testCompile(JSR250) |
Aurimas Liutikas | f4ec12f | 2017-11-22 12:55:43 -0800 | [diff] [blame] | 58 | testCompile(MOCKITO_CORE) |
Aurimas Liutikas | 3196ef1 | 2018-01-02 16:02:50 -0800 | [diff] [blame] | 59 | testCompile fileTree(dir: "${sdkHandler.sdkFolder}/platforms/android-$SupportConfig.CURRENT_SDK_VERSION/", |
Yigit Boyar | efaf86a | 2016-12-02 15:16:35 -0800 | [diff] [blame] | 60 | include : "android.jar") |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 61 | testCompile fileTree(dir: "${new File(project(":room:runtime").buildDir, "libJar")}", |
| 62 | include : "*.jar") |
Yigit Boyar | 8fe7624 | 2017-09-18 09:36:51 -0700 | [diff] [blame] | 63 | testCompile fileTree(dir: "${new File(project(":persistence:db").buildDir, "libJar")}", |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 64 | include : "*.jar") |
Yigit Boyar | efaf86a | 2016-12-02 15:16:35 -0800 | [diff] [blame] | 65 | testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar()) |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 66 | } |
| 67 | |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 68 | def generateAntlrTask = task('generateAntlrGrammar', type: JavaExec) { |
| 69 | def outFolder = file(antlrOut) |
| 70 | outputs.dir(outFolder) |
Yigit Boyar | 922b65c | 2017-12-18 09:29:26 -0800 | [diff] [blame] | 71 | inputs.file("$projectDir/SQLite.g4") |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 72 | classpath configurations.runtime |
| 73 | main "org.antlr.v4.Tool" |
Yigit Boyar | 64db0cc | 2017-04-17 13:18:56 -0700 | [diff] [blame] | 74 | args "SQLite.g4", "-visitor", "-o", new File(outFolder, "android/arch/persistence/room/parser").path, |
| 75 | "-package", "android.arch.persistence.room.parser" |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | tasks.findByName("compileKotlin").dependsOn(generateAntlrTask) |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 79 | tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug") |
Yigit Boyar | 8fe7624 | 2017-09-18 09:36:51 -0700 | [diff] [blame] | 80 | tasks.findByName("compileKotlin").dependsOn(":persistence:db:jarDebug") |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 81 | |
Yigit Boyar | d809f48 | 2017-09-13 16:02:16 -0700 | [diff] [blame] | 82 | supportLibrary { |
Aurimas Liutikas | ea5ee82 | 2017-11-06 12:52:28 -0800 | [diff] [blame] | 83 | name = "Android Room Compiler" |
| 84 | publish = true |
Sergey Vasilinets | 9c24688 | 2017-12-11 18:31:29 -0800 | [diff] [blame] | 85 | generateDocs = false |
Aurimas Liutikas | 78c1ab7 | 2017-11-08 13:33:51 -0800 | [diff] [blame] | 86 | mavenVersion = LibraryVersions.ROOM |
Aurimas Liutikas | 7f40a7e | 2017-10-27 17:55:06 -0700 | [diff] [blame] | 87 | mavenGroup = LibraryGroups.ROOM |
Aurimas Liutikas | ea5ee82 | 2017-11-06 12:52:28 -0800 | [diff] [blame] | 88 | inceptionYear = "2017" |
| 89 | description = "Android Room annotation processor" |
| 90 | url = SupportLibraryExtension.ARCHITECTURE_URL |
Yigit Boyar | d809f48 | 2017-09-13 16:02:16 -0700 | [diff] [blame] | 91 | } |