blob: 27492f4ceb0b2403ee126f66339b980b1306e0b5 [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 */
16
Yigit Boyar19b41102016-11-20 10:46:32 -080017apply plugin: 'kotlin'
18apply plugin: 'maven'
19
20def antlrOut = "$buildDir/generated/antlr/grammar-gen/"
21sourceSets {
22 main.java.srcDirs += 'src/main/grammar-gen'
23 test.java.srcDirs += 'src/tests/kotlin'
24 main.java.srcDirs += antlrOut
25}
Sergey Vasilinetse69e4702017-02-10 02:26:10 -080026project.ext.noDocs = true
Yigit Boyar19b41102016-11-20 10:46:32 -080027dependencies {
Yigit Boyar9c3bbb72017-01-13 11:04:36 -080028 // taken from ButterKnife
Yigit Boyar2259e4d2016-11-25 18:26:10 -080029 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 Boyar2eb51992016-12-13 15:00:07 -080032 compile project(":room:common")
Yigit Boyar450ed382017-03-02 09:48:25 -080033 compile libs.kotlin.stdlib
34 compile libs.auto_common
35 compile libs.javapoet
36 compile libs.antlr
37 compile libs.xerial
Yigit Boyarfa390592017-03-06 01:31:33 -080038 compile libs.apache.commons.codec
Yigit Boyar450ed382017-03-02 09:48:25 -080039 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 Boyarefaf86a2016-12-02 15:16:35 -080044 include : "android.jar")
Yigit Boyar2eb51992016-12-13 15:00:07 -080045 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 Boyarefaf86a2016-12-02 15:16:35 -080049 testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
Yigit Boyar19b41102016-11-20 10:46:32 -080050}
51
Yigit Boyar83ebc492017-03-08 20:43:45 -080052archivesBaseName = "compiler"
Yigit Boyar19b41102016-11-20 10:46:32 -080053
54def 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
64tasks.findByName("compileKotlin").dependsOn(generateAntlrTask)
Yigit Boyar2eb51992016-12-13 15:00:07 -080065tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug")
66tasks.findByName("compileKotlin").dependsOn(":room:db:jarDebug")
Yigit Boyar19b41102016-11-20 10:46:32 -080067
68createKotlinCheckstyle(project)
69