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 2019/07/16 04:26:59 UTC

[buildr] 02/02: Fix crash bug when generating IDEA modules

This is an automated email from the ASF dual-hosted git repository.

donaldp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/buildr.git

commit 7cd6cef9035834097a1c15774c67ebb5adf7f009
Author: Peter Donald <pe...@realityforge.org>
AuthorDate: Tue Jul 16 14:26:42 2019 +1000

    Fix crash bug when generating IDEA modules
    
    This was a long existing bug but was exacerbated by 1.5.8 release
---
 CHANGELOG              | 5 +++++
 lib/buildr/ide/idea.rb | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ee0b9da..2fe7054 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,9 @@
 1.5.9 (Pending)
+* Fixed:  Prior to `1.5.8`, generating IntelliJ IDEA modules could generate a failure if the project included
+          a dependency defined by a `JarTask` that specified a non-nil classifier. This failure scenario is now
+          much more frequent given the changes to support external annotations that are packaged as jars. This
+          crash is now avoided by changing guard from `artifact.respond_to?(:to_spec_hash)` to
+          `artifact.is_a?(Buildr::Artifact)`.
 
 1.5.8 (2019-07-14)
 * Fixed:  Changed references to `https://repo1.maven.org/maven2` to use https where possible.
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index e1038ba..6aac75f 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -483,12 +483,12 @@ module Buildr #:nodoc:
           export = true
           source_path = nil
           annotations_path = nil
-          if d.respond_to?(:to_spec_hash)
+          if d.is_a?(Buildr::Artifact)
             source_spec = d.to_spec_hash.merge(:classifier => 'sources')
             source_path = Buildr.artifact(source_spec).to_s
             source_path = nil unless File.exist?(source_path)
           end
-          if d.respond_to?(:to_spec_hash)
+          if d.is_a?(Buildr::Artifact)
             annotations_spec = d.to_spec_hash.merge(:classifier => 'annotations')
             annotations_path = Buildr.artifact(annotations_spec).to_s
             annotations_path = nil unless File.exist?(annotations_path)
@@ -505,12 +505,12 @@ module Buildr #:nodoc:
           export = main_dependencies_paths.include?(dependency_path)
           source_path = nil
           annotations_path = nil
-          if d.respond_to?(:to_spec_hash)
+          if d.is_a?(Buildr::Artifact)
             source_spec = d.to_spec_hash.merge(:classifier => 'sources')
             source_path = Buildr.artifact(source_spec).to_s
             source_path = nil unless File.exist?(source_path)
           end
-          if d.respond_to?(:to_spec_hash)
+          if d.is_a?(Buildr::Artifact)
             annotations_spec = d.to_spec_hash.merge(:classifier => 'annotations')
             annotations_path = Buildr.artifact(annotations_spec).to_s
             annotations_path = nil unless File.exist?(annotations_path)