hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1559970 - in /httpcomponents/httpclient-android/branches/test-branch: build.gradle gradle.properties
Date Tue, 21 Jan 2014 10:50:31 GMT
Author: olegk
Date: Tue Jan 21 10:50:31 2014
New Revision: 1559970

URL: http://svn.apache.org/r1559970
Log:
Support for snapshot publishing

Modified:
    httpcomponents/httpclient-android/branches/test-branch/build.gradle
    httpcomponents/httpclient-android/branches/test-branch/gradle.properties

Modified: httpcomponents/httpclient-android/branches/test-branch/build.gradle
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/build.gradle?rev=1559970&r1=1559969&r2=1559970&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/build.gradle (original)
+++ httpcomponents/httpclient-android/branches/test-branch/build.gradle Tue Jan 21 10:50:31
2014
@@ -8,6 +8,8 @@ buildscript {
 }
 
 apply plugin: 'android-library'
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
 
 repositories {
     mavenCentral()
@@ -32,6 +34,58 @@ android {
     }
 }
 
+ext.sharedManifest = manifest {
+    attributes (
+            'Specification-Title': "HttpComponents HttpClient for Android",
+            'Specification-Version': "$version",
+            'Specification-Vendor': "The Apache Software Foundation",
+            'Implementation-Title': "HttpComponents HttpClient for Android",
+            'Implementation-Version': "$version",
+            'Implementation-Vendor': "The Apache Software Foundation",
+            'Implementation-Vendor-Id': "org.apache",
+            'url': 'http://hc.apache.org/httpcomponents-client'
+    )
+}
+
+def pomDetails = {
+
+    name 'HttpComponents Client for Android'
+    url 'http://hc.apache.org/httpcomponents-client/'
+    organization {
+        name 'The Apache Software Foundation'
+        url 'http://www.apache.org/'
+    }
+    licenses {
+        license {
+            name 'Apache License, Version 2.0'
+            url 'LICENSE.txt'
+            distribution 'repo'
+        }
+    }
+    issueManagement {
+        system 'Jira'
+        url 'http://issues.apache.org/jira/browse/HTTPCLIENT'
+    }
+
+}
+
+publishing {
+    publications {
+        asf (MavenPublication) {
+            pom.withXml {
+                asNode().children().last() + pomDetails
+            }
+        }
+        repositories {
+            maven {
+                name 'ASF snapshots'
+                url ASF_SNAPSHOT_REPO
+            }
+        }
+    }
+}
+
+
 android.libraryVariants.all { variant ->
     def name = variant.buildType.name
     if (name == 'release') {
@@ -44,20 +98,73 @@ android.libraryVariants.all { variant ->
             rename '(NOTICE|LICENSE).txt', '$1'
 
             manifest {
-                attributes (
-                        'Specification-Title': "HttpComponents HttpClient for Android",
-                        'Specification-Version': "$version",
-                        'Specification-Vendor': "The Apache Software Foundation",
-                        'Implementation-Title': "HttpComponents HttpClient for Android",
-                        'Implementation-Version': "$version",
-                        'Implementation-Vendor': "The Apache Software Foundation",
-                        'Implementation-Vendor-Id': "org.apache",
-                        'url': 'http://hc.apache.org/httpcomponents-client'
-                )
+                from sharedManifest
+            }
+        }
+
+        task createAndroidSrcJar(type: Jar) {
+            dependsOn variant.javaCompile
+            from android.sourceSets.main.allSource // need this to include resources
+            from 'NOTICE.txt'
+            from 'LICENSE.txt'
+            rename '(NOTICE|LICENSE).txt', '$1'
+            classifier = 'source'
+
+            manifest {
+                from sharedManifest
+            }
+        }
+
+        task createAndroidJavadoc(type: Javadoc) {
+            dependsOn variant.javaCompile
+            source = variant.javaCompile.source
+            classpath = files(android.plugin.runtimeJarList, variant.javaCompile.classpath.files)
+        }
+
+        task createAndroidJavadocJar(type: Jar) {
+            dependsOn createAndroidJavadoc
+            from createAndroidJavadoc.destinationDir
+            from 'NOTICE.txt'
+            from 'LICENSE.txt'
+            rename '(NOTICE|LICENSE).txt', '$1'
+            classifier = 'javadoc'
+
+            manifest {
+                from sharedManifest
             }
+        }
 
+        artifacts {
+            archives createAndroidJar
+            archives createAndroidSrcJar
+            archives createAndroidJavadocJar
         }
 
-        artifacts.add('archives', createAndroidJar)
+        publishing.publications.asf.artifacts = [createAndroidJar, createAndroidSrcJar, createAndroidJavadocJar]
     }
 }
+
+gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
+    taskGraph.allTasks.findAll { Task task ->
+        task instanceof PublishToMavenRepository }.each { Task task ->
+            task.doFirst {
+                MavenArtifactRepository repo = task.repository
+                if (repo.url.scheme && repo.url.scheme != 'file') {
+                    Console console = System.console()
+                    if (console) {
+                        console.println("Publishing to repository \'${repo.name}\': ${repo.url}")
+                        PasswordCredentials creds = repo.credentials
+                        if (!creds.username) {
+                            console.println("> Please enter user name:")
+                            creds.username = console.readLine()
+                        }
+                        if (!creds.password) {
+                            console.println("> Please enter password:")
+                            creds.password = console.readPassword()
+                        }
+                    }
+                }
+            }
+    }
+}
+

Modified: httpcomponents/httpclient-android/branches/test-branch/gradle.properties
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient-android/branches/test-branch/gradle.properties?rev=1559970&r1=1559969&r2=1559970&view=diff
==============================================================================
--- httpcomponents/httpclient-android/branches/test-branch/gradle.properties (original)
+++ httpcomponents/httpclient-android/branches/test-branch/gradle.properties Tue Jan 21 10:50:31
2014
@@ -1 +1,2 @@
-HC_VER=4.3.1-SNAPSHOT
\ No newline at end of file
+HC_VER=4.3.1-SNAPSHOT
+ASF_SNAPSHOT_REPO=https://repository.apache.org/content/repositories/snapshots
\ No newline at end of file



Mime
View raw message