build.gradle revision 9784c9aaedeb863018f5fcaa0a598e8e2f8ed2f3
1/*
2 * Copyright (C) 2014 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
17apply plugin: 'java'
18apply plugin: 'application'
19apply plugin: 'com.android.databinding.bintray'
20sourceCompatibility = dataBindingConfig.javaTargetCompatibility
21targetCompatibility = dataBindingConfig.javaSourceCompatibility
22
23sourceSets {
24    main {
25        java {
26            srcDir 'src/main/java'
27        }
28    }
29    test {
30        java {
31            srcDir 'src/test/java'
32        }
33    }
34}
35
36dependencies {
37    testCompile 'junit:junit:4.12'
38}
39
40def javadocTask = project.tasks.create(name: "javadocBaseLibrary", type: Javadoc) {
41    source sourceSets.main.allJava
42}
43
44def javadocJarTask = project.tasks.create(name: "javadocJarBaseLibrary", type: Jar) {
45    classifier = 'javadoc'
46    from 'build/docs/javadoc'
47}
48javadocJarTask.dependsOn javadocTask
49
50def sourcesJarTask = project.tasks.create(name: "sourceJarBaseLibrary", type: Jar) {
51    classifier = 'sources'
52    from sourceSets.main.java.srcDirs
53}
54
55artifacts.add('archives', javadocJarTask);
56artifacts.add('archives', sourcesJarTask);
57
58
59uploadArchives {
60    repositories {
61        mavenDeployer {
62            pom.artifactId = 'baseLibrary'
63            pom.project {
64                licenses {
65                    license {
66                        name dataBindingConfig.licenseName
67                        url dataBindingConfig.licenseUrl
68                        distribution dataBindingConfig.licenseDistribution
69                    }
70                }
71            }
72        }
73    }
74}
75
76task prebuildJar(type : Copy) {
77    dependsOn uploadArchives
78    from "$buildDir/libs/baseLibrary-${version}.jar"
79    into dataBindingConfig.prebuildFolder
80    rename { String fileName ->
81        "databinding-baseLibrary.jar"
82    }
83}