build.gradle revision 9064a1dd60eb8c2f9d2ed705b36bb5f0b1629771
1import android.databinding.LicenseCollector 2 3/* 4 * Copyright (C) 2014 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19apply plugin: 'java' 20apply plugin: "kotlin" 21 22 23sourceCompatibility = config.javaTargetCompatibility 24targetCompatibility = config.javaSourceCompatibility 25 26buildscript { 27 repositories { 28 mavenCentral() 29 } 30 dependencies { 31 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${config.kotlinVersion}" 32 classpath 'org.apache.commons:commons-io:1.3.2' 33 } 34} 35 36sourceSets { 37 main { 38 java { 39 srcDir 'src/main/java' 40 srcDir 'src/main/grammar-gen' 41 srcDir 'src/main/xml-gen' 42 } 43 } 44} 45 46dependencies { 47 compile project(':baseLibrary') 48 compile 'org.apache.commons:commons-lang3:3.3.2' 49 compile 'commons-io:commons-io:2.4' 50 compile 'commons-codec:commons-codec:1.10' 51 compile 'com.google.guava:guava:17.0' 52 compile "org.jetbrains.kotlin:kotlin-stdlib:${config.kotlinVersion}" 53 54 compile 'com.tunnelvisionlabs:antlr4:4.5' 55 testCompile "com.android.databinding:libraryJar:$version@jar" 56 testCompile 'junit:junit:4.12' 57} 58 59uploadArchives { 60 repositories { 61 mavenDeployer { 62 pom.artifactId = 'compiler' 63 pom.project { 64 licenses { 65 license { 66 name config.licenseName 67 url config.licenseUrl 68 distribution config.licenseDistribution 69 } 70 } 71 } 72 } 73 } 74} 75 76project(':library').afterEvaluate { libProject -> 77 tasks['compileTestKotlin'].dependsOn libProject.tasks['uploadJarArchives'] 78} 79 80project.tasks.create(name : "generateXmlParser", type : JavaExec) { 81 classpath configurations.runtime 82 main "org.antlr.v4.Tool" 83 workingDir projectDir 84 args "XMLParser.g4", "-visitor", "-o", "src/main/java/android/databinding/parser", "-package", "android.databinding.parser", "-lib", "." 85} 86 87project.tasks.create(name : "generateGrammar", type : JavaExec) { 88 classpath configurations.runtime 89 main "org.antlr.v4.Tool" 90 args "BindingExpression.g4", "-visitor", "-o", "src/main/grammar-gen/android/databinding/parser", "-package", "android.databinding.parser" 91} 92 93task fatJar(type: Jar) { 94 baseName = project.name + '-all' 95 doFirst { 96 def LicenseCollector allLicenses = new LicenseCollector(); 97 configurations.compile.getResolvedConfiguration().getResolvedArtifacts().each { 98 allLicenses.add(it) 99 } 100 def notice = allLicenses.buildNotice() 101 def noticeFile = new File(project.buildDir,'NOTICE.txt') 102 noticeFile.delete() 103 println ("writing notice file to: ${noticeFile.getAbsolutePath()}") 104 noticeFile << notice 105 } 106 from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 107 from new File(project.buildDir,'NOTICE.txt') 108 archiveName "databinding-studio-bundle.jar" 109 destinationDir = new File(config.prebuildFolder) 110 with jar 111} 112 113task prebuild() { 114 dependsOn fatJar 115} 116 117