blob: a3cab5802c2160d2be1011bd5ac8eda91042521e [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
52uploadArchives {
53 repositories {
54 mavenDeployer {
55 repository(url: rootProject.ext.localMavenRepo)
Yigit Boyarfb3e49e2016-12-12 10:24:49 -080056 pom.artifactId = 'compiler'
Yigit Boyar19b41102016-11-20 10:46:32 -080057 }
58 }
59}
60
61def 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
71tasks.findByName("compileKotlin").dependsOn(generateAntlrTask)
Yigit Boyar2eb51992016-12-13 15:00:07 -080072tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug")
73tasks.findByName("compileKotlin").dependsOn(":room:db:jarDebug")
Yigit Boyar19b41102016-11-20 10:46:32 -080074
75createKotlinCheckstyle(project)
76