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 | |
| 52 | uploadArchives { |
| 53 | repositories { |
| 54 | mavenDeployer { |
| 55 | repository(url: rootProject.ext.localMavenRepo) |
Yigit Boyar | fb3e49e | 2016-12-12 10:24:49 -0800 | [diff] [blame] | 56 | pom.artifactId = 'compiler' |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | def generateAntlrTask = task('generateAntlrGrammar', type: JavaExec) { |
| 62 | def outFolder = file(antlrOut) |
| 63 | outputs.dir(outFolder) |
| 64 | inputs.dir("$projectDir/SQLite.g4") |
| 65 | classpath configurations.runtime |
| 66 | main "org.antlr.v4.Tool" |
| 67 | args "SQLite.g4", "-visitor", "-o", new File(outFolder, "com/android/support/room/parser").path, |
| 68 | "-package", "com.android.support.room.parser" |
| 69 | } |
| 70 | |
| 71 | tasks.findByName("compileKotlin").dependsOn(generateAntlrTask) |
Yigit Boyar | 2eb5199 | 2016-12-13 15:00:07 -0800 | [diff] [blame] | 72 | tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug") |
| 73 | tasks.findByName("compileKotlin").dependsOn(":room:db:jarDebug") |
Yigit Boyar | 19b4110 | 2016-11-20 10:46:32 -0800 | [diff] [blame] | 74 | |
| 75 | createKotlinCheckstyle(project) |
| 76 | |