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 | */ |
| 16 | |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 17 | apply plugin: 'kotlin' |
| 18 | apply plugin: 'maven' |
| 19 | |
| 20 | def antlrOut = "$buildDir/generated/antlr/grammar-gen/" |
| 21 | sourceSets { |
| 22 | main.java.srcDirs += 'src/main/grammar-gen' |
| 23 | test.java.srcDirs += 'src/tests/kotlin' |
| 24 | main.java.srcDirs += antlrOut |
| 25 | } |
Sergey Vasilinets | e69e470 | 2017-02-10 02:26:10 -0800 | [diff] [blame] | 26 | project.ext.noDocs = true |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 27 | dependencies { |
Yigit Boyar | 9c3bbb7 | 2017-01-13 11:04:36 -0800 | [diff] [blame] | 28 | // taken from ButterKnife |
Yigit Boyar | 2259e4d | 2016-11-25 18:26:10 -0800 | [diff] [blame] | 29 | def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger) |
| 30 | def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger) |
| 31 | |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 32 | compile project(":room:common") |
Yigit Boyar | 450ed38 | 2017-03-02 09:48:25 -0800 | [diff] [blame] | 33 | compile libs.kotlin.stdlib |
| 34 | compile libs.auto_common |
| 35 | compile libs.javapoet |
| 36 | compile libs.antlr |
| 37 | compile libs.xerial |
Yigit Boyar | fa39059 | 2017-03-06 01:31:33 -0800 | [diff] [blame] | 38 | compile libs.apache.commons.codec |
Yigit Boyar | 450ed38 | 2017-03-02 09:48:25 -0800 | [diff] [blame] | 39 | testCompile libs.google_compile_testing |
| 40 | testCompile libs.junit |
| 41 | testCompile libs.ij_annotations |
| 42 | testCompile libs.mockito_core |
| 43 | testCompile fileTree(dir: "${sdkHandler.sdkFolder}/platforms/android-$tools.current_sdk/", |
Yigit Boyar | efaf86a | 2016-12-02 15:16:35 -0800 | [diff] [blame] | 44 | include : "android.jar") |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 45 | testCompile fileTree(dir: "${new File(project(":room:runtime").buildDir, "libJar")}", |
| 46 | include : "*.jar") |
| 47 | testCompile fileTree(dir: "${new File(project(":room:db").buildDir, "libJar")}", |
| 48 | include : "*.jar") |
Yigit Boyar | efaf86a | 2016-12-02 15:16:35 -0800 | [diff] [blame] | 49 | testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar()) |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 50 | } |
| 51 | |
Yigit Boyar | 83ebc49 | 2017-03-08 20:43:45 -0800 | [diff] [blame^] | 52 | archivesBaseName = "compiler" |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 53 | |
| 54 | def generateAntlrTask = task('generateAntlrGrammar', type: JavaExec) { |
| 55 | def outFolder = file(antlrOut) |
| 56 | outputs.dir(outFolder) |
| 57 | inputs.dir("$projectDir/SQLite.g4") |
| 58 | classpath configurations.runtime |
| 59 | main "org.antlr.v4.Tool" |
| 60 | args "SQLite.g4", "-visitor", "-o", new File(outFolder, "com/android/support/room/parser").path, |
| 61 | "-package", "com.android.support.room.parser" |
| 62 | } |
| 63 | |
| 64 | tasks.findByName("compileKotlin").dependsOn(generateAntlrTask) |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 65 | tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug") |
| 66 | tasks.findByName("compileKotlin").dependsOn(":room:db:jarDebug") |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 67 | |
| 68 | createKotlinCheckstyle(project) |
| 69 | |