polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [16/35] zest-java git commit: build: extract dev/release version condition
Date Sat, 19 Nov 2016 22:50:17 GMT
build: extract dev/release version condition


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

Branch: refs/heads/develop
Commit: b3be18d07d181206a9ebd0046188a9bb8b41e3f1
Parents: 051290e
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Sat Nov 19 14:15:45 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Sat Nov 19 14:15:45 2016 +0100

----------------------------------------------------------------------
 .../org/apache/zest/gradle/AllProjectsPlugin.groovy       |  4 ++--
 .../org/apache/zest/gradle/RootProjectPlugin.groovy       |  8 +++++---
 .../groovy/org/apache/zest/gradle/ZestExtension.groovy    | 10 ++++++++++
 .../apache/zest/gradle/publish/PublishingPlugin.groovy    |  6 ++++--
 4 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/b3be18d0/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
index bed6352..42a6bb1 100644
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
@@ -46,7 +46,7 @@ class AllProjectsPlugin implements Plugin<Project>
                     'org.apache.zest' :
                     project.name.substring( 0, project.name.lastIndexOf( '.' ) )
 
-    applyVersionning( project )
+    applyDefaultVersion( project )
     applyZestExtension( project )
 
     configureJava( project )
@@ -62,7 +62,7 @@ class AllProjectsPlugin implements Plugin<Project>
     project.plugins.apply PublishingPlugin
   }
 
-  private static void applyVersionning( Project project )
+  private static void applyDefaultVersion( Project project )
   {
     if( project.version == 'unspecified' )
     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b3be18d0/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
index 80b9a2f..8b92186 100644
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
@@ -133,6 +133,7 @@ class RootProjectPlugin implements Plugin<Project>
 
   private static void configureJavadocs( Project project )
   {
+    def zest = project.extensions.getByType( ZestExtension )
     def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
     project.tasks.create( TaskNames.JAVADOCS, Javadoc ) { Javadoc task ->
       task.group = TaskGroups.DOCUMENTATION
@@ -186,7 +187,7 @@ class RootProjectPlugin implements Plugin<Project>
       task.description = 'Copy SDK public Javadoc to ../zest-web'
       task.dependsOn TaskNames.JAVADOCS
       task.from 'build/docs/javadoc/'
-      if( project.version == '0' || project.version.toString().contains( "SNAPSHOT" ) )
+      if( zest.developmentVersion )
       {
         task.into( "$project.projectDir/../zest-web/site/content/java/develop/javadocs/"
)
       }
@@ -244,13 +245,14 @@ class RootProjectPlugin implements Plugin<Project>
 
   private static void configureReleaseTask( Project project )
   {
+    def zest = project.extensions.getByType( ZestExtension )
     def release = project.tasks.create( 'release' )
     release.description = 'Builds, tests and uploads the release artifacts'
     release.group = TaskGroups.RELEASE
     release.doFirst {
-      if( System.properties[ 'version' ] == null || System.properties[ 'version' ].toString().contains(
'SNAPSHOT' ) )
+      if( zest.developmentVersion )
       {
-        throw new GradleException( "'version' must be given as a system property to perform
a release." )
+        throw new GradleException( "Cannot release development version $project.version,
use '-Dversion=X.Y.Z'" )
       }
     }
     release.dependsOn 'checkReleaseSpec',

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b3be18d0/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
index 07e4e6b..de1f0d4 100644
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
@@ -33,6 +33,16 @@ class ZestExtension
     this.core = new Core()
   }
 
+  boolean isDevelopmentVersion()
+  {
+    return project.version == '0' || project.version.toString().contains( 'SNAPSHOT' )
+  }
+
+  boolean isReleaseVersion()
+  {
+    return !isDevelopmentVersion()
+  }
+
   class Core
   {
     Dependency api = core( 'api' )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b3be18d0/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
b/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
index 34b1f95..563664d 100644
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
@@ -18,6 +18,7 @@
 package org.apache.zest.gradle.publish
 
 import groovy.transform.CompileStatic
+import org.apache.zest.gradle.ZestExtension
 import org.apache.zest.gradle.release.ReleaseSpecExtension
 import org.gradle.api.GradleException
 import org.gradle.api.Plugin
@@ -90,9 +91,10 @@ class PublishingPlugin implements Plugin<Project>
 
   private static Config configFor( Project project )
   {
+    def zest = project.extensions.getByType( ZestExtension )
     def config = new Config()
-    config.snapshots = project.version == '0' || project.version.toString().contains( 'SNAPSHOT'
)
-    config.releases = !config.snapshots
+    config.snapshots = zest.developmentVersion
+    config.releases = zest.releaseVersion
     config.signed = project.findProperty( 'uploadSigned' ) ?: config.releases
     config.releaseSpec = project.findProperty( 'uploadReleaseSpec' ) ?: config.releases
     config.wagon = project.findProperty( 'uploadWagon' ) ?: WAGON_HTTP


Mime
View raw message