blob: ee8bdf66ba513e3dc634dc157d0164f1255f4e4b [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
17buildscript {
18 addRepos(repositories)
19 dependencies {
20 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
21 }
22}
23
24apply plugin: 'kotlin'
25apply plugin: 'maven'
26
27def antlrOut = "$buildDir/generated/antlr/grammar-gen/"
28sourceSets {
29 main.java.srcDirs += 'src/main/grammar-gen'
30 test.java.srcDirs += 'src/tests/kotlin'
31 main.java.srcDirs += antlrOut
32}
33
34dependencies {
Yigit Boyar2259e4d2016-11-25 18:26:10 -080035 // take from ButterKnife
36 def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
37 def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
38
Yigit Boyar2eb51992016-12-13 15:00:07 -080039 compile project(":room:common")
Yigit Boyar19b41102016-11-20 10:46:32 -080040 compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
41 compile "com.google.auto:auto-common:$auto_common_version"
42 compile "com.squareup:javapoet:$javapoet_version"
43 compile 'org.antlr:antlr4:4.5.3'
44 testCompile "com.google.testing.compile:compile-testing:$compile_testing_version"
Yigit Boyar19b41102016-11-20 10:46:32 -080045 testCompile "junit:junit:$junit_version"
46 testCompile "com.intellij:annotations:$intellij_annotation"
Yigit Boyar1600cc12016-11-24 14:26:56 -080047 testCompile "org.mockito:mockito-core:$mockito_version"
Yigit Boyarefaf86a2016-12-02 15:16:35 -080048 testCompile fileTree(dir: "${sdkHandler.sdkFolder}/platforms/android-$target_sdk_version/",
49 include : "android.jar")
Yigit Boyar2eb51992016-12-13 15:00:07 -080050 testCompile fileTree(dir: "${new File(project(":room:runtime").buildDir, "libJar")}",
51 include : "*.jar")
52 testCompile fileTree(dir: "${new File(project(":room:db").buildDir, "libJar")}",
53 include : "*.jar")
Yigit Boyarefaf86a2016-12-02 15:16:35 -080054 testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
Yigit Boyar19b41102016-11-20 10:46:32 -080055}
56
57uploadArchives {
58 repositories {
59 mavenDeployer {
60 repository(url: rootProject.ext.localMavenRepo)
Yigit Boyarfb3e49e2016-12-12 10:24:49 -080061 pom.artifactId = 'compiler'
Yigit Boyar19b41102016-11-20 10:46:32 -080062 }
63 }
64}
65
66def generateAntlrTask = task('generateAntlrGrammar', type: JavaExec) {
67 def outFolder = file(antlrOut)
68 outputs.dir(outFolder)
69 inputs.dir("$projectDir/SQLite.g4")
70 classpath configurations.runtime
71 main "org.antlr.v4.Tool"
72 args "SQLite.g4", "-visitor", "-o", new File(outFolder, "com/android/support/room/parser").path,
73 "-package", "com.android.support.room.parser"
74}
75
76tasks.findByName("compileKotlin").dependsOn(generateAntlrTask)
Yigit Boyar2eb51992016-12-13 15:00:07 -080077tasks.findByName("compileKotlin").dependsOn(":room:runtime:jarDebug")
78tasks.findByName("compileKotlin").dependsOn(":room:db:jarDebug")
Yigit Boyar19b41102016-11-20 10:46:32 -080079
80createKotlinCheckstyle(project)
81