Debian Codegraph @

compilerCommon/build.gradle

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 /*
2 * Copyright (C) 2015 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
17 apply plugin: 'java'
18
19 sourceSets {
20 main {
21 java {
22 srcDir 'src/main/java'
23 srcDir 'src/main/xml-gen'
24 srcDir 'src/main/grammar-gen'
25 srcDir "${rootDir}/debian/antlr4"
26 }
27 }
28 test {
29 java {
30 srcDir 'src/test/java'
31 }
32 }
33
34 }
35
36 dependencies {
37 testCompile 'junit:junit:4.12'
38 compile project(':dataBinding:baseLibrary')
39 compile 'org.antlr:antlr4:4.5.3'
40 compile 'commons-io:commons-io:2.4'
41 compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
42 compile 'com.google.guava:guava:17.0'
43 compile 'com.android.tools:annotations:24.5.0'
44 }
45
46 project.tasks.create(name : "generateXmlLexer", type : JavaExec) {
47 classpath configurations.runtime
48 main "org.antlr.v4.Tool"
49 workingDir projectDir
50 args "XMLLexer.g4", "-visitor", "-lib", projectDir.absolutePath, "-o", "src/main/xml-gen/android/databinding/parser", "-package", "android.databinding.parser"
51 }
52
53 project.tasks.create(name : "generateXmlParser", type : JavaExec) {
54 classpath configurations.runtime
55 main "org.antlr.v4.Tool"
56 workingDir projectDir
57 args "XMLParser.g4", "-visitor", "-lib", projectDir.absolutePath, "-o", "src/main/xml-gen/android/databinding/parser", "-package", "android.databinding.parser"
58 dependsOn "generateXmlLexer"
59 }
60
61 project.tasks.create(name : "generateGrammar", type : JavaExec) {
62 classpath configurations.runtime
63 main "org.antlr.v4.Tool"
64 args "BindingExpression.g4", "-visitor", "-o", "src/main/grammar-gen/android/databinding/parser", "-package", "android.databinding.parser"
65 }
66
67 tasks.create(name : 'exportBuildVersions') << {
68 def props = new HashMap();
69 def buildVersionFile = new File(sourceSets.main.output.resourcesDir,"data_binding_version_info.properties")
70 // Using Java Properties appends date to the output which is bad for incremental compilation.
71 // Instead, we build it manually.
72 props.put("compilerCommon", project.version)
73 props.put("compiler", project.version)
74 props.put("baseLibrary", rootProject.findProject("dataBinding:baseLibrary").version)
75 props.put("extensions", dataBindingConfig.extensionsVersion)
76 buildVersionFile.getParentFile().mkdirs()
77 println("writing build versions file to $buildVersionFile")
78 def propText = new StringBuilder();
79 props.each {
80 propText.append(it.key).append("=").append(it.value).append(System.getProperty("line.separator"))
81 }
82 file(buildVersionFile).write(propText.toString())
83 }
84
85 tasks['jar'].dependsOn('exportBuildVersions')
86 tasks['exportBuildVersions'].dependsOn('processResources')
87
88 project.ext.pomName = 'Data Binding Compiler Common'
89 project.ext.pomDesc = 'Common library that can be shared between different build tools'