Home | History | Annotate | Download | only in baseLibrary
      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 
     17 apply plugin: 'java'
     18 apply plugin: 'application'
     19 
     20 sourceCompatibility = config.javaTargetCompatibility
     21 targetCompatibility = config.javaSourceCompatibility
     22 
     23 sourceSets {
     24     main {
     25         java {
     26             srcDir 'src/main/java'
     27         }
     28     }
     29     test {
     30         java {
     31             srcDir 'src/test/java'
     32         }
     33     }
     34 }
     35 
     36 dependencies {
     37     testCompile 'junit:junit:4.12'
     38 }
     39 
     40 def javadocTask = project.tasks.create(name: "javadocBaseLibrary", type: Javadoc) {
     41     source sourceSets.main.allJava
     42 }
     43 
     44 def javadocJarTask = project.tasks.create(name: "javadocJarBaseLibrary", type: Jar) {
     45     classifier = 'javadoc'
     46     from 'build/docs/javadoc'
     47 }
     48 javadocJarTask.dependsOn javadocTask
     49 
     50 def sourcesJarTask = project.tasks.create(name: "sourceJarBaseLibrary", type: Jar) {
     51     classifier = 'sources'
     52     from sourceSets.main.java.srcDirs
     53 }
     54 
     55 artifacts.add('archives', javadocJarTask);
     56 artifacts.add('archives', sourcesJarTask);
     57 
     58 
     59 uploadArchives {
     60     repositories {
     61         mavenDeployer {
     62             pom.artifactId = 'baseLibrary'
     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 
     76 task prebuildJar(type : Copy) {
     77     dependsOn uploadArchives
     78     from "$buildDir/libs/baseLibrary-${version}.jar"
     79     into config.prebuildFolder
     80     rename { String fileName ->
     81         "databinding-baseLibrary.jar"
     82     }
     83 }