Home | History | Annotate | Download | only in espresso
      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: 'maven'
     18 
     19 def getReleaseRepositoryUrl() {
     20     if (hasProperty('androidSdkPath')) {
     21         return "file:/$project.androidCustomSdkPath/extras/$project.POM_ARTIFACT_ID/m2repository"
     22     } else {
     23         println "No Android SDK path set. Using default m2 location, " +
     24                 "defined Maven settings.xml. Set ANDROID_HOME or set SDK location " +
     25                 "via ANDROID_SDK in gradle.properties"
     26     }
     27 }
     28 
     29 task publishLocal(type: Upload) {
     30 //task publishLocal {
     31 //    configuration = configurations.archives
     32 //
     33 //    repositories {
     34 //        mavenCentral()
     35 //    }
     36 
     37     uploadArchives {
     38         repositories {
     39             mavenDeployer {
     40 
     41                 println "***** ${getReleaseRepositoryUrl()}"
     42                 repository(url: getReleaseRepositoryUrl())
     43 
     44                 println "***** versoin $VERSION"
     45                 pom.project {
     46                     pom.version = VERSION
     47                     pom.groupId = GROUP_ID
     48                     pom.artifactId = POM_ARTIFACT_ID
     49 
     50 //                    licenses {
     51 //                        license {
     52 //                            name POM_LICENCE_NAME
     53 //                            url POM_LICENCE_URL
     54 //                            distribution POM_LICENCE_DIST
     55 //                        }
     56 //                    }
     57 //
     58 //                    developers {
     59 //                        developer {
     60 //                            //id POM_DEVELOPER_ID
     61 //                            name POM_DEVELOPER_NAME
     62 //                        }
     63 //                    }
     64                 }
     65             }
     66         }
     67     }
     68 
     69 //    def isReleaseBuild() {
     70 //        return VERSION.contains("SNAPSHOT") == false
     71 //    }
     72 //    signing {
     73 //        required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
     74 //        sign configurations.archives
     75 //    }
     76 //
     77 //    task androidJavadocs(type: Javadoc) {
     78 //        source = android.sourceSets.main.allJava
     79 //        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
     80 //    }
     81 //
     82 //    task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
     83 //        classifier = 'javadoc'
     84 //        from androidJavadocs.destinationDir
     85 //    }
     86 //
     87 //    task androidSourcesJar(type: Jar) {
     88 //        classifier = 'sources'
     89 //        from android.sourceSets.main.allSource
     90 //    }
     91 //
     92 //    artifacts {
     93 //        archives androidSourcesJar
     94 //        archives androidJavadocsJar
     95 //    }
     96 }
     97