You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2017/04/02 23:09:29 UTC

[2/3] buildr git commit: BUILDR-731 - Enhance Sonar addon to support configuration of the project version.

BUILDR-731 - Enhance Sonar addon to support configuration of the project version.

Submitted by Ross Mahony.


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

Branch: refs/heads/master
Commit: f21284314b658253a195ac64e93e3952f1f7202a
Parents: e6e54e3
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Apr 3 09:08:44 2017 +1000
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Apr 3 09:08:44 2017 +1000

----------------------------------------------------------------------
 CHANGELOG             |  1 +
 addon/buildr/sonar.rb | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/f2128431/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 4ff9069..395cf89 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
 1.5.2 (Pending)
+* Change: BUILDR-731 - Enhance Sonar addon to support configuration of the project version. Submitted by Ross Mahony.
 * Fixed:  Fix pom generation to eliminate invalid `classifier` element from being added to POM.
 
 1.5.1 (2017-03-11)

http://git-wip-us.apache.org/repos/asf/buildr/blob/f2128431/addon/buildr/sonar.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/sonar.rb b/addon/buildr/sonar.rb
index acd199e..f04b703 100644
--- a/addon/buildr/sonar.rb
+++ b/addon/buildr/sonar.rb
@@ -25,8 +25,7 @@ module Buildr
         ]
       end
 
-      def sonar(jdbc_url, jdbc_driver_class_name, jdbc_username, jdbc_password, host_url, project_name, key, sources, binaries, libraries)
-
+      def sonar(jdbc_url, jdbc_driver_class_name, jdbc_username, jdbc_password, host_url, project_name, key, project_version, sources, binaries, libraries)
         # Build the artifacts for FindBugs to analyse
         Buildr.artifacts(binaries).each(&:invoke)
 
@@ -38,7 +37,7 @@ module Buildr
           ant.property :name => 'sonar.projectName', :value => project_name
 
           ant.property :name => 'sonar.projectKey', :value => key
-          ant.property :name => 'sonar.projectVersion', :value => '1.0'
+          ant.property :name => 'sonar.projectVersion', :value => project_version
 
           ant.property :name => 'sonar.jdbc.url', :value => jdbc_url
           ant.property :name => 'sonar.jdbc.driverClassName', :value => jdbc_driver_class_name
@@ -68,6 +67,7 @@ module Buildr
       attr_accessor :host_url
       attr_accessor :key
       attr_accessor :project_name
+      attr_accessor :project_version
 
       attr_writer :sources
       def sources
@@ -88,6 +88,10 @@ module Buildr
         !!@enabled
       end
 
+      def project_version
+        @project_version || '1.0'
+      end
+
       protected
 
       def initialize(project)
@@ -123,6 +127,7 @@ module Buildr
               project.sonar.host_url,
               project.sonar.project_name,
               project.sonar.key,
+              project.sonar.project_version,
               sources,
               binaries,
               libraries