polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [03/33] polygene-java git commit: build: fix maven artifacts upload
Date Tue, 23 May 2017 02:13:46 GMT
build: fix maven artifacts upload


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/3de1c9c2
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/3de1c9c2
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/3de1c9c2

Branch: refs/heads/yeoman-work
Commit: 3de1c9c2304ce4b8d8710b08a9ffa85149d8df0c
Parents: 3f76f6e
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Tue May 16 14:12:01 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Tue May 16 14:12:01 2017 +0200

----------------------------------------------------------------------
 .../gradle/code/PublishingPlugin.groovy         | 27 +++++++++++++-------
 1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3de1c9c2/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
index 177d865..fbbb42e 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/code/PublishingPlugin.groovy
@@ -18,6 +18,7 @@
 package org.apache.polygene.gradle.code
 
 import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode
 import org.apache.polygene.gradle.structure.release.ReleaseSpecExtension
 import org.gradle.api.GradleException
 import org.gradle.api.Plugin
@@ -26,7 +27,7 @@ import org.gradle.api.artifacts.maven.MavenDeployer
 import org.gradle.api.artifacts.maven.MavenDeployment
 import org.gradle.api.internal.plugins.DslObject
 import org.gradle.api.plugins.MavenRepositoryHandlerConvention
-import org.gradle.api.publication.maven.internal.deployer.BaseMavenDeployer
+import org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer
 import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
 import org.gradle.api.tasks.Upload
 import org.gradle.plugins.signing.Sign
@@ -124,6 +125,7 @@ class PublishingPlugin implements Plugin<Project>
     signArchives.onlyIf { !project.findProperty( 'skipSigning' ) }
   }
 
+  @CompileStatic( TypeCheckingMode.SKIP )
   private static void configureUploadArchives( Project project, Config config )
   {
     project.plugins.apply 'maven'
@@ -149,13 +151,20 @@ class PublishingPlugin implements Plugin<Project>
       }
     }
     mavenDeployer.configuration = project.configurations.getByName( 'deployersJars' )
-    def repository = config.releases ? mavenDeployer.repository : mavenDeployer.snapshotRepository
-    repository.id = config.repositoryName
-    repository.url = config.repositoryUrl
+    def repoCoordinates = [ id: config.repositoryName, url: config.repositoryUrl ] as Map
+    def repoCredentials = [ userName: config.username, password: config.password ] as Map
+    def repo = mavenDeployer.createRepository(repoCoordinates)
     if( config.username )
     {
-      repository.authentication.userName = config.username
-      repository.authentication.password = config.password
+      ( repo as MavenRemoteRepository ).authentication( repoCredentials )
+    }
+    if( config.releases )
+    {
+      mavenDeployer.repository = repo
+    }
+    else
+    {
+      mavenDeployer.snapshotRepository = repo
     }
   }
 
@@ -192,14 +201,14 @@ class PublishingPlugin implements Plugin<Project>
     project.plugins.apply 'maven-publish-auth'
   }
 
-  private static BaseMavenDeployer getMavenDeployer( Upload uploadTask )
+  private static DefaultGroovyMavenDeployer getMavenDeployer( Upload uploadTask )
   {
     // TODO Remove use of Gradle internals
     // DslObject to get the Upload task convention
-    // MavenRepositoryHandlerConvention & BaseMavenDeployer to configure Wagon, Authentication
and Signing
+    // MavenRepositoryHandlerConvention & DefaultGroovyMavenDeployer to configure Wagon,
Authentication and Signing
     def repositoriesConvention = new DslObject( uploadTask.repositories )
       .getConvention()
       .getPlugin( MavenRepositoryHandlerConvention )
-    return repositoriesConvention.mavenDeployer() as BaseMavenDeployer
+    return repositoriesConvention.mavenDeployer() as DefaultGroovyMavenDeployer
   }
 }


Mime
View raw message