| /* | |
| * Copyright (C) 2016 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| apply plugin: 'java-library' | |
| apply plugin: 'kotlin' | |
| apply plugin: 'application' | |
| mainClassName = "android.databinding.AndroidDataBinding" | |
| sourceCompatibility = 1.8 | |
| buildscript { | |
| dependencies { | |
| classpath libs.kotlin_gradle_plugin | |
| } | |
| } | |
| dependencies { | |
| testImplementation libs.junit | |
| implementation libs.jcommander | |
| implementation libs.kotlin_stdlib | |
| implementation project(':dataBinding:compiler') | |
| implementation project(':dataBinding:compilerCommon') | |
| implementation libs.apache_commons_io | |
| } | |
| compileJava { | |
| options.compilerArgs += ["-proc:none"] | |
| } | |
| run { | |
| if ( project.hasProperty("appArgs") ) { | |
| args Eval.me(appArgs) | |
| } | |
| } | |
| def jarName = "android-data-binding" | |
| def workingDir = "${project.buildDir}/intermediates/fullJar" | |
| def fatJar = "${workingDir}/${jarName}-fat.jar" | |
| def jarJar = project.jar.archivePath | |
| configurations { | |
| jarJarArchives | |
| } | |
| def sourcesJarTask = project.tasks.create(name: "sourceJar", type: Jar) { | |
| classifier = 'sources' | |
| from sourceSets.main.java.srcDirs | |
| } | |
| artifacts.add('archives', sourcesJarTask); | |
| tasks.create(name: 'fatJar', type: Jar) { | |
| baseName = jarName + '-fat' | |
| doFirst { | |
| file(workingDir).mkdirs() | |
| } | |
| manifest { | |
| attributes 'Main-Class': mainClassName | |
| } | |
| def deps = new HashSet<ResolvedDependency>() | |
| project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.each { | |
| deps.addAll(it.allModuleArtifacts) | |
| } | |
| from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } } { | |
| exclude "META-INF/maven/**" | |
| exclude "META-INF/MANIFEST.MF" | |
| exclude "META-INF/LICENSE.txt" | |
| exclude "META-INF/NOTICE.txt" | |
| exclude "**/*.stg" | |
| } | |
| archiveName "${baseName}.jar" | |
| destinationDir = new File(workingDir) | |
| with project.jar | |
| doLast { | |
| println "created fat jar into ${destinationDir}" | |
| } | |
| } |