buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject [2/2] git commit: Work around bug/feature of jruby 1.7.13 that caches Gem::Version objects based on constructor parameters that causes issues with Buildr as we mutate the version objects through monkey patching.
Date Sat, 23 Aug 2014 03:45:37 GMT
Work around bug/feature of jruby 1.7.13 that caches Gem::Version
objects based on constructor parameters that causes issues with
Buildr as we mutate the version objects through monkey patching.


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

Branch: refs/heads/master
Commit: 2a4892a5cf098d864f213a7ee4257f43728012f4
Parents: e2423a1
Author: Peter Donald <peter@realityforge.org>
Authored: Sat Aug 23 13:45:12 2014 +1000
Committer: Peter Donald <peter@realityforge.org>
Committed: Sat Aug 23 13:45:12 2014 +1000

----------------------------------------------------------------------
 CHANGELOG                                   |  3 +++
 lib/buildr/java/version_requirement.rb      |  6 ++++--
 lib/buildr/packaging/version_requirement.rb | 11 ++++++-----
 3 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/2a4892a5/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index c4746ac..e1b99c1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
 1.4.20 (Pending)
+* Fixed : Work around bug/feature of jruby 1.7.13 that caches Gem::Version
+          objects based on constructor parameters that causes issues with
+          Buildr as we mutate the version objects through monkey patching.
 * Change: Upgrade rjb dependency to 1.4.9.
 * Change: BUILDR-701 - Update to JUnit 4.11. Submitted by Jean-Philippe Caruana.
 * Added:  Support the 'report_level' property on findbugs addon.

http://git-wip-us.apache.org/repos/asf/buildr/blob/2a4892a5/lib/buildr/java/version_requirement.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/version_requirement.rb b/lib/buildr/java/version_requirement.rb
index 8b796cd..fd7f6cd 100644
--- a/lib/buildr/java/version_requirement.rb
+++ b/lib/buildr/java/version_requirement.rb
@@ -53,7 +53,8 @@ module Buildr #:nodoc:
           raise "Invalid requirement string: #{req}"
         end
         comparator, version = $1, $2
-        version = Gem::Version.new(0).tap { |v| v.version = version }
+        # dup required due to jruby 1.7.13 bug/feature that caches versions?
+        version = Gem::Version.new(0).dup.tap { |v| v.version = version }
         VersionRequirement.new(nil, [$1, version])
       end
 
@@ -122,7 +123,8 @@ module Buildr #:nodoc:
       return false unless version
       unless version.kind_of?(Gem::Version)
         raise "Invalid version: #{version.inspect}" unless self.class.version?(version)
-        version = Gem::Version.new(0).tap { |v| v.version = version.strip }
+        # dup required due to jruby 1.7.13 bug/feature that caches versions?
+        version = Gem::Version.new(0).dup.tap { |v| v.version = version.strip }
       end
       message = op == :| ? :any? : :all?
       result = requirements.send message do |req|

http://git-wip-us.apache.org/repos/asf/buildr/blob/2a4892a5/lib/buildr/packaging/version_requirement.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/packaging/version_requirement.rb b/lib/buildr/packaging/version_requirement.rb
index c5a6d95..450a825 100644
--- a/lib/buildr/packaging/version_requirement.rb
+++ b/lib/buildr/packaging/version_requirement.rb
@@ -17,11 +17,10 @@
 # Rubygems 1.3.6 removed the 'version' accessor so monkey-patch it back to
 # circumvent version validation.  This is needed because Gem::Version doesn't
 # accept version specs with dashes.
-unless Gem::Version.new(0).respond_to?(:version=)
+unless Gem::Version.new("0").respond_to?(:version=)
   class Gem::Version
     def version=(version)
-      @version = version.to_s
-      @version.strip!
+      @version = version.to_s.strip
 
       # re-prime @segments
       @segments = nil
@@ -73,7 +72,8 @@ module Buildr #:nodoc:
           raise "Invalid requirement string: #{req}"
         end
         comparator, version = $1, $2
-        version = Gem::Version.new(0).tap { |v| v.version = version }
+        # dup required due to jruby 1.7.13 bug/feature that caches versions?
+        version = Gem::Version.new(0).dup.tap { |v| v.version = version }
         VersionRequirement.new(nil, [$1, version])
       end
 
@@ -142,7 +142,8 @@ module Buildr #:nodoc:
       return false unless version
       unless version.kind_of?(Gem::Version)
         raise "Invalid version: #{version.inspect}" unless self.class.version?(version)
-        version = Gem::Version.new(0).tap { |v| v.version = version.strip }
+        # dup required due to jruby 1.7.13 bug/feature that caches versions?
+        version = Gem::Version.new(0).dup.tap { |v| v.version = version.strip }
       end
       message = op == :| ? :any? : :all?
       result = requirements.send message do |req|


Mime
View raw message