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/13 11:09:19 UTC

[buildr] branch SupportExternalAnnotationArtifacts created (now f3ad71f)

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

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


      at f3ad71f  Detect external annotations in the local project and add them to the generated IntelliJ IDEA module

This branch includes the following new commits:

     new d5733aa  Prefer %w syntax
     new 6bfe190  Bump the version of zapwhite
     new 9f0470f  Whitespace
     new fbe7875  Add support for downloading external annotations and attaching them to IntelliJ IDEA module dependencies
     new f3ad71f  Detect external annotations in the local project and add them to the generated IntelliJ IDEA module

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildr] 04/05: Add support for downloading external annotations and attaching them to IntelliJ IDEA module dependencies

Posted by do...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fbe7875ab5a40b1897c714f6a07117d4a07b753f
Author: Peter Donald <pe...@realityforge.org>
AuthorDate: Sat Jul 13 17:22:40 2019 +1000

    Add support for downloading external annotations and attaching them to IntelliJ IDEA module dependencies
---
 CHANGELOG                        |  1 +
 lib/buildr/ide/idea.rb           | 33 ++++++++++++++++++++++++---------
 lib/buildr/packaging/artifact.rb | 20 ++++++++++++++++++--
 3 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index c09b7ac..4323deb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
 * Fixed:  Replace references to long removed `http://www.ibiblio.org/maven2/` repository with
           `https://repo1.maven.org/maven2`.
 * Fixed:  Ensure pom files used in tests use https when referring to maven repositories.
+* Added:  Add support for downloading external annotations and attaching them to IntelliJ IDEA module dependencies.
 
 1.5.7 (2019-02-16)
 * Fixed:  The fix that allowed special characters in usernames and passwords was only partially applied
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index dfd050d..3ead679 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -478,12 +478,18 @@ module Buildr #:nodoc:
           dependency_path = d.to_s
           export = true
           source_path = nil
+          annotations_path = nil
           if d.respond_to?(:to_spec_hash)
             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
-          [dependency_path, export, source_path]
+          if d.respond_to?(:to_spec_hash)
+            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)
+          end
+          [dependency_path, export, source_path, annotations_path]
         end
       end
 
@@ -494,12 +500,18 @@ module Buildr #:nodoc:
           dependency_path = d.to_s
           export = main_dependencies_paths.include?(dependency_path)
           source_path = nil
+          annotations_path = nil
           if d.respond_to?(:to_spec_hash)
             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
-          [dependency_path, export, source_path]
+          if d.respond_to?(:to_spec_hash)
+            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)
+          end
+          [dependency_path, export, source_path, annotations_path]
         end
       end
 
@@ -545,22 +557,22 @@ module Buildr #:nodoc:
           end
 
           main_project_dependencies = project_dependencies.dup
-          self.test_dependency_details.each do |dependency_path, export, source_path|
+          self.test_dependency_details.each do |dependency_path, export, source_path, annotations_path|
             next if export
-            generate_lib(xml, dependency_path, export, source_path, project_dependencies)
+            generate_lib(xml, dependency_path, export, source_path, annotations_path, project_dependencies)
           end
 
           test_project_dependencies = project_dependencies - main_project_dependencies
-          self.main_dependency_details.each do |dependency_path, export, source_path|
+          self.main_dependency_details.each do |dependency_path, export, source_path, annotations_path|
             next unless export
-            generate_lib(xml, dependency_path, export, source_path, test_project_dependencies)
+            generate_lib(xml, dependency_path, export, source_path, annotations_path, test_project_dependencies)
           end
 
           xml.orderEntryProperties
         end
       end
 
-      def generate_lib(xml, dependency_path, export, source_path, project_dependencies)
+      def generate_lib(xml, dependency_path, export, source_path, annotations_path, project_dependencies)
         project_for_dependency = Buildr.projects.detect do |project|
           [project.packages, project.compile.target, project.resources.target, project.test.compile.target, project.test.resources.target].flatten.
             detect { |artifact| artifact.to_s == dependency_path }
@@ -573,7 +585,7 @@ module Buildr #:nodoc:
           end
           project_dependencies << project_for_dependency
         else
-          generate_module_lib(xml, url_for_path(dependency_path), export, (source_path ? url_for_path(source_path) : nil), !export)
+          generate_module_lib(xml, url_for_path(dependency_path), export, (source_path ? url_for_path(source_path) : nil), (annotations_path ? url_for_path(annotations_path) : nil), !export)
         end
       end
 
@@ -649,12 +661,15 @@ module Buildr #:nodoc:
         xml.orderEntry attribs
       end
 
-      def generate_module_lib(xml, path, export, source_path, test = false)
+      def generate_module_lib(xml, path, export, source_path, annotations_path, test = false)
         attribs = {:type => 'module-library'}
         attribs[:exported] = '' if export
         attribs[:scope] = 'TEST' if test
         xml.orderEntry attribs do
           xml.library do
+            xml.ANNOTATIONS do
+              xml.root :url => annotations_path
+            end if annotations_path
             xml.CLASSES do
               xml.root :url => path
             end
diff --git a/lib/buildr/packaging/artifact.rb b/lib/buildr/packaging/artifact.rb
index 2af68c7..27f87be 100644
--- a/lib/buildr/packaging/artifact.rb
+++ b/lib/buildr/packaging/artifact.rb
@@ -21,6 +21,9 @@ module Buildr #:nodoc:
   desc "Download all artifacts' sources"
   task 'artifacts:sources'
 
+  desc "Download all artifacts' external annotations"
+  task 'artifacts:annotations'
+
   desc "Download all artifacts' javadoc"
   task 'artifacts:javadoc'
 
@@ -127,7 +130,7 @@ module Buildr #:nodoc:
     def sources_artifact
       sources_spec = to_spec_hash.merge(:classifier=>'sources')
       sources_task = OptionalArtifact.define_task(Buildr.repositories.locate(sources_spec))
-      sources_task.send :apply_spec, sources_spec
+      sources_task.send :apply_spec, sources_spec if sources_task.respond_to?(:apply_spec)
       sources_task
     end
 
@@ -138,11 +141,23 @@ module Buildr #:nodoc:
     def javadoc_artifact
       javadoc_spec = to_spec_hash.merge(:classifier=>'javadoc')
       javadoc_task = OptionalArtifact.define_task(Buildr.repositories.locate(javadoc_spec))
-      javadoc_task.send :apply_spec, javadoc_spec
+      javadoc_task.send :apply_spec, javadoc_spec if javadoc_task.respond_to?(:apply_spec)
       javadoc_task
     end
 
     # :call-seq:
+    #   annotations_artifact => Artifact
+    #
+    # Convenience method that returns an annotations artifact. The annotations artifact is used by
+    # Intellij IDEA as a source of external annotations.
+    def annotations_artifact
+      annotations_spec = to_spec_hash.merge(:classifier=>'annotations')
+      annotations_task = OptionalArtifact.define_task(Buildr.repositories.locate(annotations_spec))
+      annotations_task.send :apply_spec, annotations_spec if annotations_task.respond_to?(:apply_spec)
+      annotations_task
+    end
+
+    # :call-seq:
     #   pom_xml => string
     #
     # Creates POM XML for this artifact.
@@ -948,6 +963,7 @@ module Buildr #:nodoc:
       unless spec[:type] == :pom
         Rake::Task['artifacts:sources'].enhance [task.sources_artifact]
         Rake::Task['artifacts:javadoc'].enhance [task.javadoc_artifact]
+        Rake::Task['artifacts:annotations'].enhance [task.annotations_artifact]
       end
     end
     task.enhance &block


[buildr] 01/05: Prefer %w syntax

Posted by do...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d5733aadbade0697a5be4c7ee8d6ebd0f8119baf
Author: Peter Donald <pe...@realityforge.org>
AuthorDate: Fri Jul 12 08:42:11 2019 +1000

    Prefer %w syntax
---
 lib/buildr/ide/idea.rb | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index 02b505d..dfd050d 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -342,10 +342,7 @@ module Buildr #:nodoc:
         buildr_project.assets.paths.each {|p| default_webroots[p] = '/' }
         webroots = options[:webroots] || default_webroots
         default_deployment_descriptors = []
-        ['web.xml', 'sun-web.xml', 'glassfish-web.xml', 'jetty-web.xml', 'geronimo-web.xml',
-         'context.xml', 'weblogic.xml',
-         'jboss-deployment-structure.xml', 'jboss-web.xml',
-         'ibm-web-bnd.xml', 'ibm-web-ext.xml', 'ibm-web-ext-pme.xml'].
+        %w(web.xml sun-web.xml glassfish-web.xml jetty-web.xml geronimo-web.xml context.xml weblogic.xml jboss-deployment-structure.xml jboss-web.xml ibm-web-bnd.xml ibm-web-ext.xml ibm-web-ext-pme.xml).
           each do |descriptor|
           webroots.each_pair do |path, relative_url|
             next unless relative_url == '/'
@@ -446,9 +443,7 @@ module Buildr #:nodoc:
         ejb_roots = options[:ejb_roots] || default_ejb_roots
 
         default_deployment_descriptors = []
-        ['ejb-jar.xml', 'glassfish-ejb-jar.xml', 'ibm-ejb-jar-bnd.xml', 'ibm-ejb-jar-ext-pme.xml', 'ibm-ejb-jar-ext.xml',
-         'jboss.xml', 'jbosscmp-jdbc.xml', 'openejb-jar.xml', 'sun-cmp-mapping.xml', 'sun-ejb-jar.xml',
-         'weblogic-cmp-rdbms-jar.xml', 'weblogic-ejb-jar.xml'].
+        %w(ejb-jar.xml glassfish-ejb-jar.xml ibm-ejb-jar-bnd.xml ibm-ejb-jar-ext-pme.xml ibm-ejb-jar-ext.xml jboss.xml jbosscmp-jdbc.xml openejb-jar.xml sun-cmp-mapping.xml sun-ejb-jar.xml weblogic-cmp-rdbms-jar.xml weblogic-ejb-jar.xml).
           each do |descriptor|
           ejb_roots.each do |path|
             d = "#{path}/WEB-INF/#{descriptor}"


[buildr] 02/05: Bump the version of zapwhite

Posted by do...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6bfe19034eb8bf8739b63c60896acfa04404d9b3
Author: Peter Donald <pe...@realityforge.org>
AuthorDate: Sat Jul 13 14:55:11 2019 +1000

    Bump the version of zapwhite
---
 buildr.gemspec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildr.gemspec b/buildr.gemspec
index 1b346e8..2866390 100644
--- a/buildr.gemspec
+++ b/buildr.gemspec
@@ -97,5 +97,5 @@ for those one-off tasks, with a language that's a joy to use.
   spec.add_development_dependency 'saikuro_treemap', '0.2.0'
   spec.add_development_dependency 'atoulme-Saikuro', '1.2.1'
   # Used to manage whitespace of files within repository
-  spec.add_development_dependency 'zapwhite', '2.10.0'
+  spec.add_development_dependency 'zapwhite', '2.14.0'
 end


[buildr] 05/05: Detect external annotations in the local project and add them to the generated IntelliJ IDEA module

Posted by do...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f3ad71f15846179237a32a0146eaa2c8ec53b3a7
Author: Peter Donald <pe...@realityforge.org>
AuthorDate: Sat Jul 13 21:09:06 2019 +1000

    Detect external annotations in the local project and add them to the generated IntelliJ IDEA module
---
 CHANGELOG              |  3 +++
 lib/buildr/ide/idea.rb | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 4323deb..f5a8f3e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,9 @@
           `https://repo1.maven.org/maven2`.
 * Fixed:  Ensure pom files used in tests use https when referring to maven repositories.
 * Added:  Add support for downloading external annotations and attaching them to IntelliJ IDEA module dependencies.
+* Added:  Detect external annotations in the local project and add them to the generated IntelliJ IDEA
+          module when generating. The default location is `src/main/annotations` but other locations
+          can be specified by modifying the `project.iml.annotation_paths` property.
 
 1.5.7 (2019-02-16)
 * Fixed:  The fix that allowed special characters in usernames and passwords was only partially applied
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index 3ead679..e1038ba 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -212,6 +212,10 @@ module Buildr #:nodoc:
         'iml'
       end
 
+      def annotation_paths
+        @annotation_paths ||= [buildr_project._(:source, :main, :annotations)].select {|p| File.exist?(p)}
+      end
+
       def main_source_directories
         @main_source_directories ||= [buildr_project.compile.sources].flatten.compact
       end
@@ -609,6 +613,14 @@ module Buildr #:nodoc:
         xml.output(:url => file_path(self.main_output_dir.to_s))
         xml.tag!('output-test', :url => file_path(self.test_output_dir.to_s))
         xml.tag!('exclude-output')
+        paths = self.annotation_paths
+        unless paths.empty?
+          xml.tag!('annotation-paths') do |xml|
+            paths.each do |path|
+              xml.root(:url=> file_path(path))
+            end
+          end
+        end
       end
 
       def generate_content(xml)


[buildr] 03/05: Whitespace

Posted by do...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9f0470ffaa315960165fd1401585f6c9886b346c
Author: Peter Donald <pe...@realityforge.org>
AuthorDate: Sat Jul 13 17:21:49 2019 +1000

    Whitespace
---
 CHANGELOG | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 31c0e6a..c09b7ac 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,7 +3,7 @@
 * Change: Use the `zapwhite` gem to manage file whitespace within repository.
 * Fixed:  Replace references to long removed `http://www.ibiblio.org/maven2/` repository with
           `https://repo1.maven.org/maven2`.
-* Fixed: Ensure pom files used in tests use https when referring to maven repositories.
+* Fixed:  Ensure pom files used in tests use https when referring to maven repositories.
 
 1.5.7 (2019-02-16)
 * Fixed:  The fix that allowed special characters in usernames and passwords was only partially applied