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/02/20 11:35:51 UTC

[1/8] buildr git commit: Avoid generating sections if there is no content

Repository: buildr
Updated Branches:
  refs/heads/master 13dc0b68c -> 75e72a94f


Avoid generating sections if there is no content


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

Branch: refs/heads/master
Commit: 3da552b879854238086d3348e0e128258a13d611
Parents: 13dc0b6
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 10:48:24 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 12:22:25 2017 +1100

----------------------------------------------------------------------
 lib/buildr/java/custom_pom.rb | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/3da552b8/lib/buildr/java/custom_pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/custom_pom.rb b/lib/buildr/java/custom_pom.rb
index 739d95a..8e1921b 100644
--- a/lib/buildr/java/custom_pom.rb
+++ b/lib/buildr/java/custom_pom.rb
@@ -173,7 +173,7 @@ module Buildr
                 xml.distribution 'repo'
               end
             end
-          end
+          end unless project.pom.licenses.empty?
 
           if project.pom.scm_url || project.pom.scm_connection || project.pom.scm_developer_connection
             xml.scm do
@@ -205,23 +205,24 @@ module Buildr
                 end
               end
             end
-          end
+          end unless project.pom.developers.empty?
+
+          provided_deps = Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
+          runtime_deps = Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
+          optional_deps = Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
+          deps =
+            Buildr.artifacts(project.compile.dependencies).
+              select { |d| d.is_a?(ActsAsArtifact) }.
+              collect do |d|
+              f = d.to_s
+              scope = provided_deps.include?(f) ? 'provided' :
+                runtime_deps.include?(f) ? 'runtime' :
+                  'compile'
+              d.to_hash.merge(:scope => scope, :optional => optional_deps.include?(f))
+            end + Buildr.artifacts(project.test.compile.dependencies).
+              select { |d| d.is_a?(ActsAsArtifact) && !project.compile.dependencies.include?(d) }.collect { |d| d.to_hash.merge(:scope => 'test') }
 
           xml.dependencies do
-            provided_deps = Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
-            runtime_deps = Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
-            optional_deps = Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
-            deps =
-              Buildr.artifacts(project.compile.dependencies).
-                select { |d| d.is_a?(ActsAsArtifact) }.
-                collect do |d|
-                f = d.to_s
-                scope = provided_deps.include?(f) ? 'provided' :
-                  runtime_deps.include?(f) ? 'runtime' :
-                    'compile'
-                d.to_hash.merge(:scope => scope, :optional => optional_deps.include?(f))
-              end + Buildr.artifacts(project.test.compile.dependencies).
-                select { |d| d.is_a?(ActsAsArtifact) && !project.compile.dependencies.include?(d) }.collect { |d| d.to_hash.merge(:scope => 'test') }
             deps.each do |dependency|
               xml.dependency do
                 xml.groupId dependency[:group]
@@ -237,7 +238,7 @@ module Buildr
                 end
               end
             end
-          end
+          end unless deps.empty?
         end
       end
     end


[5/8] buildr git commit: Prefer single quotes

Posted by do...@apache.org.
Prefer single quotes


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

Branch: refs/heads/master
Commit: 380bb927b87f72ced4ff96e829e4f4e13a726057
Parents: 59eb77a
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 13:55:57 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 22:34:29 2017 +1100

----------------------------------------------------------------------
 addon/buildr/bnd.rb              |  6 +++---
 lib/buildr/java/packaging.rb     |  7 +++----
 lib/buildr/packaging/artifact.rb |  2 +-
 lib/buildr/scala/bdd.rb          | 32 ++++++++++++++++----------------
 lib/buildr/scala/compiler.rb     | 24 ++++++++++++------------
 5 files changed, 35 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/380bb927/addon/buildr/bnd.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/bnd.rb b/addon/buildr/bnd.rb
index f709c24..fa8c331 100644
--- a/addon/buildr/bnd.rb
+++ b/addon/buildr/bnd.rb
@@ -101,14 +101,14 @@ module Buildr
           bnd_filename = filename.sub /(\.jar)?$/, '.bnd'
 
           params = self.to_params
-          params["-output"] = filename
+          params['-output'] = filename
           File.open(bnd_filename, 'w') do |f|
             f.print params.collect { |k, v| "#{k}=#{v}" }.join("\n")
           end
 
           Buildr::Bnd.bnd_main( bnd_filename )
           begin
-            Buildr::Bnd.bnd_main( "print", "-verify", filename )
+            Buildr::Bnd.bnd_main('print', '-verify', filename )
           rescue => e
             rm filename
             raise e
@@ -127,7 +127,7 @@ module Buildr
 
       def package_as_bundle(filename)
         project.task('bnd:print' => [filename]) do |task|
-          Buildr::Bnd.bnd_main("print", filename)
+          Buildr::Bnd.bnd_main('print', filename)
         end
 
         dirname = File.dirname(filename)

http://git-wip-us.apache.org/repos/asf/buildr/blob/380bb927/lib/buildr/java/packaging.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/packaging.rb b/lib/buildr/java/packaging.rb
index 841c9fe..86a764c 100644
--- a/lib/buildr/java/packaging.rb
+++ b/lib/buildr/java/packaging.rb
@@ -223,11 +223,10 @@ module Buildr #:nodoc:
         #   package(:jar).with(:manifest=>'MANIFEST_MF')
         def with(*args)
           super args.pop if Hash === args.last
-          fail "package.with() should not contain nil values" if args.include? nil
+          fail 'package.with() should not contain nil values' if args.include? nil
           include :from=>args if args.size > 0
           self
         end
-
       end
 
 
@@ -521,8 +520,8 @@ module Buildr #:nodoc:
           buffer = ""
           xml = Builder::XmlMarkup.new(:target=>buffer, :indent => 2)
           xml.declare! :DOCTYPE, :application, :PUBLIC,
-          "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN",
-          "http://java.sun.com/j2ee/dtds/application_1_2.dtd"
+                       '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN',
+                       'http://java.sun.com/j2ee/dtds/application_1_2.dtd'
           xml.application do
             xml.tag! 'display-name', display_name
             desc = self.description || @project.comment

http://git-wip-us.apache.org/repos/asf/buildr/blob/380bb927/lib/buildr/packaging/artifact.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/packaging/artifact.rb b/lib/buildr/packaging/artifact.rb
index f71c5f0..e417273 100644
--- a/lib/buildr/packaging/artifact.rb
+++ b/lib/buildr/packaging/artifact.rb
@@ -35,7 +35,7 @@ module Buildr #:nodoc:
   module ActsAsArtifact
 
     ARTIFACT_ATTRIBUTES = [:group, :id, :type, :classifier, :version]
-    MAVEN_METADATA = "maven-metadata.xml"
+    MAVEN_METADATA = 'maven-metadata.xml'
 
     class << self
     private

http://git-wip-us.apache.org/repos/asf/buildr/blob/380bb927/lib/buildr/scala/bdd.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/bdd.rb b/lib/buildr/scala/bdd.rb
index edc1358..cacdf7e 100644
--- a/lib/buildr/scala/bdd.rb
+++ b/lib/buildr/scala/bdd.rb
@@ -20,11 +20,11 @@ module Buildr::Scala #:nodoc:
     @bdd_dir = :spec
 
     VERSION = case
-      when Buildr::Scala.version?("2.8.0"),  Buildr::Scala.version?("2.8.1"), Buildr::Scala.version?("2.8.2")
+      when Buildr::Scala.version?('2.8.0'),  Buildr::Scala.version?('2.8.1'), Buildr::Scala.version?('2.8.2')
         '1.5'
-      when Buildr::Scala.version?("2.9")
+      when Buildr::Scala.version?('2.9')
         '1.11'
-      when  Buildr::Scala.version?("2.10")
+      when  Buildr::Scala.version?('2.10')
         '1.12.3'
       else
         '3.7' # default for Scala 2.11 and beyond
@@ -46,7 +46,7 @@ module Buildr::Scala #:nodoc:
           when Buildr.settings.build['scala.specs2.artifact']
             Buildr.settings.build['scala.specs2.artifact']
           else
-            if Buildr::Scala.version < "2.11"
+            if Buildr::Scala.version < '2.11'
               "specs2_#{Buildr::Scala.version_without_build_number}"
             else
               "specs2_#{Buildr::Scala.version_major_minor}"
@@ -55,18 +55,18 @@ module Buildr::Scala #:nodoc:
       end
 
       def type
-        if Buildr::Scala.version < "2.11"
-          "jar"
+        if Buildr::Scala.version < '2.11'
+          'jar'
         else
-          "pom"
+          'pom'
         end
       end
 
       def scalaz_dependencies
-        if Buildr::Scala.version?("2.8")
+        if Buildr::Scala.version?('2.8')
           []
-        elsif Buildr::Scala.version < "2.11"
-          default_version = "6.0.1"
+        elsif Buildr::Scala.version < '2.11'
+          default_version = '6.0.1'
           custom_version = Buildr.settings.build['scala.specs2-scalaz']
           version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
 
@@ -74,9 +74,9 @@ module Buildr::Scala #:nodoc:
 
           custom_spec = Buildr.settings.build['scala.specs2-scalaz']
           spec = [ (custom_spec =~ /:/) ? custom_spec : "org.specs2:#{artifact}:jar:#{version}" ]
-          Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true)
+          Buildr.transitive(spec, :scopes => [nil, 'compile', 'runtime', 'provided', 'optional'], :optional => true)
         else
-          default_version = "7.2.2"
+          default_version = '7.2.2'
           custom_version = Buildr.settings.build['scala.specs2-scalaz']
           version = (custom_version =~ /:/) ? Buildr.artifact(custom_version).version : default_version
 
@@ -84,7 +84,7 @@ module Buildr::Scala #:nodoc:
 
           custom_spec = Buildr.settings.build['scala.specs2-scalaz']
           spec = [ (custom_spec =~ /:/) ? custom_spec : "org.scalaz:#{artifact}:jar:#{version}" ]
-          [Buildr.transitive(spec, :scopes => [nil, "compile", "runtime", "provided", "optional"], :optional => true), "org.scala-lang.modules:scala-xml_2.11:jar:1.0.1"]
+          [Buildr.transitive(spec, :scopes => [nil, 'compile', 'runtime', 'provided', 'optional'], :optional => true), 'org.scala-lang.modules:scala-xml_2.11:jar:1.0.1']
         end
       end
 
@@ -94,7 +94,7 @@ module Buildr::Scala #:nodoc:
 
           # Add utility classes and other dependencies
           options = {
-            :scopes => [nil, "compile", "runtime", "provided", "optional"],
+            :scopes => [nil, 'compile', 'runtime', 'provided', 'optional'],
             :optional => true
           }
           @dependencies |= [ File.join(File.dirname(__FILE__)) ] + Buildr.transitive(specs, options) +
@@ -113,7 +113,7 @@ module Buildr::Scala #:nodoc:
     private
 
       def find(file, pattern)
-        File.open(file, "r") do |infile|
+        File.open(file, 'r') do |infile|
           while (line = infile.gets)
             return true if line.match(pattern)
           end
@@ -137,7 +137,7 @@ module Buildr::Scala #:nodoc:
     end
 
     def run(specs, dependencies)  #:nodoc:
-      properties = { "specs2.outDir" => task.compile.target.to_s }
+      properties = {'specs2.outDir' => task.compile.target.to_s }
 
       cmd_options = { :properties => options[:properties].merge(properties),
                       :java_args => options[:java_args],

http://git-wip-us.apache.org/repos/asf/buildr/blob/380bb927/lib/buildr/scala/compiler.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb
index dcaa8e3..73ee7a5 100644
--- a/lib/buildr/scala/compiler.rb
+++ b/lib/buildr/scala/compiler.rb
@@ -20,7 +20,7 @@ module Buildr::Scala
   class << self
 
     def version_str
-      warn "Use of Scala.version_str is deprecated.  Use Scala.version instead"
+      warn 'Use of Scala.version_str is deprecated. Use Scala.version instead'
       version
     end
 
@@ -128,7 +128,7 @@ module Buildr::Scala
       end
 
       def use_fsc
-        use_installed? && ENV["USE_FSC"] =~ /^(yes|on|true)$/i
+        use_installed? && ENV['USE_FSC'] =~ /^(yes|on|true)$/i
       end
 
       def applies_to?(project, task) #:nodoc:
@@ -275,7 +275,7 @@ module Buildr::Scala
       cmd_args << '-Ssourcepath' << ("-S" + source_paths.join(File::PATH_SEPARATOR)) unless source_paths.empty?
       cmd_args << '-d' << File.expand_path(target)
       cmd_args += scalac_args
-      cmd_args << "-debug" if trace?(:scalac)
+      cmd_args << '-debug' if trace?(:scalac)
 
       cmd_args.map!(&:to_s)
 
@@ -341,7 +341,7 @@ module Buildr::Scala
 
     def count(file, pattern)
       count = 0
-      File.open(file, "r") do |infile|
+      File.open(file, 'r') do |infile|
         while (line = infile.gets)
           count += 1 if line.match(pattern)
         end
@@ -357,19 +357,19 @@ module Buildr::Scala
     # Returns Scalac command line arguments from the set of options.
     def scalac_args #:nodoc:
       args = []
-      args << "-nowarn" unless options[:warnings]
-      args << "-verbose" if trace?(:scalac)
-      if options[:debug] == true
-        args << (Scala.version?(2.7, 2.8) ? "-g" : "-g:vars")
+      args << '-nowarn' unless options[:warnings]
+      args << '-verbose' if trace?(:scalac)
+      if !!options[:debug]
+        args << (Scala.version?(2.7, 2.8) ? '-g' : '-g:vars')
       elsif options[:debug]
         args << "-g:#{options[:debug]}"
       end
-      args << "-deprecation" if options[:deprecation]
-      args << "-optimise" if options[:optimise]
-      args << "-target:jvm-" + options[:target].to_s if options[:target]
+      args << '-deprecation' if options[:deprecation]
+      args << '-optimise' if options[:optimise]
+      args << '-target:jvm-' + options[:target].to_s if options[:target]
       args += Array(options[:other])
       if zinc?
-        args.map { |arg| "-S" + arg } + Array(options[:zinc_options])
+        args.map { |arg| '-S' + arg } + Array(options[:zinc_options])
       else
         args
       end


[8/8] buildr git commit: Simplify the integration of custom_pom extension into the core

Posted by do...@apache.org.
Simplify the integration of custom_pom extension into the core


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

Branch: refs/heads/master
Commit: 75e72a94f2d340deaadab9720eb2bd70bd9c8b24
Parents: ab1554b
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 22:32:52 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 22:34:46 2017 +1100

----------------------------------------------------------------------
 addon/buildr/bnd.rb              |  2 ++
 lib/buildr/java/custom_pom.rb    | 25 -------------------------
 lib/buildr/java/packaging.rb     |  3 +++
 lib/buildr/packaging/artifact.rb | 24 +++++++++++++++---------
 lib/buildr/packaging/package.rb  |  3 ++-
 spec/packaging/packaging_spec.rb | 10 +++++++++-
 6 files changed, 31 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/75e72a94/addon/buildr/bnd.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/bnd.rb b/addon/buildr/bnd.rb
index fa8c331..03ec68a 100644
--- a/addon/buildr/bnd.rb
+++ b/addon/buildr/bnd.rb
@@ -96,6 +96,8 @@ module Buildr
         super
         @params = {}
         enhance do
+          pom.invoke rescue nil if pom && pom != self && classifier.nil?
+
           filename = self.name
           # Generate BND file with same name as target jar but different extension
           bnd_filename = filename.sub /(\.jar)?$/, '.bnd'

http://git-wip-us.apache.org/repos/asf/buildr/blob/75e72a94/lib/buildr/java/custom_pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/custom_pom.rb b/lib/buildr/java/custom_pom.rb
index 4a4ee9f..7f52ea8 100644
--- a/lib/buildr/java/custom_pom.rb
+++ b/lib/buildr/java/custom_pom.rb
@@ -256,31 +256,6 @@ module Buildr
         end
         @pom
       end
-
-      after_define do |project|
-        project.packages.select { |pkg| pkg.is_a?(ActsAsArtifact) }.each do |pkg|
-          if pkg.type.to_s == 'jar' && pkg.classifier.nil?
-            class << pkg
-              def pom_xml
-                self.pom.content
-              end
-
-              def pom
-                unless @pom
-                  pom_filename = Util.replace_extension(name, 'pom')
-                  spec = {:group => group, :id => id, :version => version, :type => :pom}
-                  @pom = Buildr.artifact(spec, pom_filename)
-                  buildr_project = Buildr.project(self.scope.join(':'))
-                  @pom.content Buildr::CustomPom.pom_xml(buildr_project, self)
-                end
-                @pom
-              end
-            end
-            pkg.instance_variable_set('@pom', nil)
-            pkg.enhance([pkg.pom.to_s])
-          end
-        end
-      end
     end
   end
 end

http://git-wip-us.apache.org/repos/asf/buildr/blob/75e72a94/lib/buildr/java/packaging.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/packaging.rb b/lib/buildr/java/packaging.rb
index 86a764c..46afa50 100644
--- a/lib/buildr/java/packaging.rb
+++ b/lib/buildr/java/packaging.rb
@@ -210,6 +210,9 @@ module Buildr #:nodoc:
 
         def initialize(*args) #:nodoc:
           super
+          enhance do
+            pom.invoke rescue nil if pom && pom != self && classifier.nil?
+          end
         end
 
         # :call-seq:

http://git-wip-us.apache.org/repos/asf/buildr/blob/75e72a94/lib/buildr/packaging/artifact.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/packaging/artifact.rb b/lib/buildr/packaging/artifact.rb
index e417273..010a8df 100644
--- a/lib/buildr/packaging/artifact.rb
+++ b/lib/buildr/packaging/artifact.rb
@@ -73,6 +73,8 @@ module Buildr #:nodoc:
     # Optional artifact classifier.
     attr_reader :classifier
 
+    attr_accessor :buildr_project
+
     def snapshot?
       version =~ /-SNAPSHOT$/
     end
@@ -145,15 +147,19 @@ module Buildr #:nodoc:
     #
     # Creates POM XML for this artifact.
     def pom_xml
-      Proc.new do
-        xml = Builder::XmlMarkup.new(:indent=>2)
-        xml.instruct!
-        xml.project do
-          xml.modelVersion  '4.0.0'
-          xml.groupId       group
-          xml.artifactId    id
-          xml.version       version
-          xml.classifier    classifier if classifier
+      if self.buildr_project
+        Buildr::CustomPom.pom_xml(self.buildr_project, self)
+      else
+        Proc.new do
+          xml = Builder::XmlMarkup.new(:indent => 2)
+          xml.instruct!
+          xml.project do
+            xml.modelVersion '4.0.0'
+            xml.groupId group
+            xml.artifactId id
+            xml.version version
+            xml.classifier classifier if classifier
+          end
         end
       end
     end

http://git-wip-us.apache.org/repos/asf/buildr/blob/75e72a94/lib/buildr/packaging/package.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/packaging/package.rb b/lib/buildr/packaging/package.rb
index 4f42933..07ecc9d 100644
--- a/lib/buildr/packaging/package.rb
+++ b/lib/buildr/packaging/package.rb
@@ -168,6 +168,7 @@ module Buildr #:nodoc:
         else
           # Make it an artifact using the specifications, and tell it how to create a POM.
           package.extend ActsAsArtifact
+          package.buildr_project = self
           package.send :apply_spec, spec.only(*Artifact::ARTIFACT_ATTRIBUTES)
 
           # Create pom associated with package
@@ -177,7 +178,7 @@ module Buildr #:nodoc:
                 pom_filename = Util.replace_extension(self.name, 'pom')
                 spec = {:group=>group, :id=>id, :version=>version, :type=>:pom}
                 @pom = Buildr.artifact(spec, pom_filename)
-                @pom.content @pom.pom_xml
+                @pom.content Buildr::CustomPom.pom_xml(self.buildr_project, self)
               end
               @pom
             end

http://git-wip-us.apache.org/repos/asf/buildr/blob/75e72a94/spec/packaging/packaging_spec.rb
----------------------------------------------------------------------
diff --git a/spec/packaging/packaging_spec.rb b/spec/packaging/packaging_spec.rb
index 29baf6b..2a68690 100644
--- a/spec/packaging/packaging_spec.rb
+++ b/spec/packaging/packaging_spec.rb
@@ -361,11 +361,19 @@ describe Project, '#package' do
     pom.invoke
     read(pom.to_s).should eql(<<-POM
 <?xml version="1.0" encoding="UTF-8"?>
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.sonatype.oss</groupId>
+    <artifactId>oss-parent</artifactId>
+    <version>7</version>
+  </parent>
   <groupId>bar</groupId>
   <artifactId>foo</artifactId>
   <version>1.0</version>
+  <packaging>jar</packaging>
+  <name>foo</name>
+  <description>foo</description>
 </project>
 POM
     )


[2/8] buildr git commit: Remove unnecessary classifier form test scenario

Posted by do...@apache.org.
Remove unnecessary classifier form test scenario


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

Branch: refs/heads/master
Commit: 782cfdf0879616d03bff4eb8d501153303737c49
Parents: 3da552b
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 12:22:48 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 12:22:48 2017 +1100

----------------------------------------------------------------------
 spec/packaging/packaging_spec.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/782cfdf0/spec/packaging/packaging_spec.rb
----------------------------------------------------------------------
diff --git a/spec/packaging/packaging_spec.rb b/spec/packaging/packaging_spec.rb
index 02b9e0d..29baf6b 100644
--- a/spec/packaging/packaging_spec.rb
+++ b/spec/packaging/packaging_spec.rb
@@ -356,7 +356,7 @@ describe Project, '#package' do
   end
 
   it 'should create POM artifact that creates its own POM' do
-    define('foo', :group=>'bar', :version=>'1.0') { package(:jar, :classifier=>'srcs') }
+    define('foo', :group=>'bar', :version=>'1.0') { package(:jar) }
     pom = project('foo').packages.first.pom
     pom.invoke
     read(pom.to_s).should eql(<<-POM


[3/8] buildr git commit: Derive the packaging type using the same mechanisms as the existing code

Posted by do...@apache.org.
Derive the packaging type using the same mechanisms as the existing code


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

Branch: refs/heads/master
Commit: 4c5fc109b78d137e37e1c74a764f7622cc1e128d
Parents: 782cfdf
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 12:23:29 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 12:23:29 2017 +1100

----------------------------------------------------------------------
 lib/buildr/java/custom_pom.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/4c5fc109/lib/buildr/java/custom_pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/custom_pom.rb b/lib/buildr/java/custom_pom.rb
index 8e1921b..4a4ee9f 100644
--- a/lib/buildr/java/custom_pom.rb
+++ b/lib/buildr/java/custom_pom.rb
@@ -158,7 +158,9 @@ module Buildr
           xml.groupId project.group
           xml.artifactId project.id
           xml.version project.version
-          xml.packaging package.type.to_s
+          candidates = project.packages.select{|p| p.classifier.nil? }.collect{|p|p.type.to_s}
+          packaging = !candidates.empty? ? candidates[0] : (project.compile.packaging || :zip).to_s
+          xml.packaging packaging
           xml.classifier package.classifier if package.classifier
 
           xml.name project.pom.name if project.pom.name


[7/8] buildr git commit: When custom_pom moved into core, it added a parent pom. Emit the parent pom in tests so transitive operation works as expected.

Posted by do...@apache.org.
When custom_pom moved into core, it added a parent pom. Emit the parent pom in tests so transitive operation works as expected.


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

Branch: refs/heads/master
Commit: ab1554b073fa641aa3d225692ab60f2db945a727
Parents: db9a976
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 21:57:12 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 22:34:46 2017 +1100

----------------------------------------------------------------------
 spec/packaging/artifact_spec.rb | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/ab1554b0/spec/packaging/artifact_spec.rb
----------------------------------------------------------------------
diff --git a/spec/packaging/artifact_spec.rb b/spec/packaging/artifact_spec.rb
index d715919..feddfb7 100644
--- a/spec/packaging/artifact_spec.rb
+++ b/spec/packaging/artifact_spec.rb
@@ -1214,6 +1214,14 @@ end
 describe Buildr, '#transitive' do
   before do
     repositories.remote = 'http://buildr.apache.org/repository/noexist'
+    write artifact('org.sonatype.oss:oss-parent:pom:7').pom.to_s, <<-XML
+<project>
+  <artifactId>oss-parent</artifactId>
+  <groupId>org.sonatype.oss</groupId>
+  <version>7</version>
+</project>
+XML
+
     @simple = %w(saxon:saxon:jar:8.4 saxon:saxon-dom:jar:8.4 saxon:saxon-xpath:jar:8.4)
     @simple.map { |spec| artifact(spec).pom }.each { |task| write task.name, task.pom_xml.call }
     @provided = @simple.first


[6/8] buildr git commit: Prefer %w syntax

Posted by do...@apache.org.
Prefer %w syntax


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

Branch: refs/heads/master
Commit: db9a976fa6251fc5ca19b28a69bdb9e03862f3e9
Parents: 380bb92
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 21:10:51 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 22:34:41 2017 +1100

----------------------------------------------------------------------
 lib/buildr/scala/bdd.rb         | 2 +-
 lib/buildr/scala/compiler.rb    | 8 ++++----
 spec/packaging/artifact_spec.rb | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/db9a976f/lib/buildr/scala/bdd.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/bdd.rb b/lib/buildr/scala/bdd.rb
index cacdf7e..c52e20f 100644
--- a/lib/buildr/scala/bdd.rb
+++ b/lib/buildr/scala/bdd.rb
@@ -133,7 +133,7 @@ module Buildr::Scala #:nodoc:
     end
 
     def tests(dependencies)
-      filter_classes(dependencies, :interfaces => ['org.specs2.Specification', 'org.specs2.mutable.Specification'])
+      filter_classes(dependencies, :interfaces => %w(org.specs2.Specification org.specs2.mutable.Specification))
     end
 
     def run(specs, dependencies)  #:nodoc:

http://git-wip-us.apache.org/repos/asf/buildr/blob/db9a976f/lib/buildr/scala/compiler.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb
index 73ee7a5..172492a 100644
--- a/lib/buildr/scala/compiler.rb
+++ b/lib/buildr/scala/compiler.rb
@@ -117,7 +117,7 @@ module Buildr::Scala
 
       def dependencies
         scala_dependencies = if use_installed?
-          ['scala-library', 'scala-compiler'].map { |s| File.expand_path("lib/#{s}.jar", scala_home) }
+          %w(scala-library scala-compiler).map { |s| File.expand_path("lib/#{s}.jar", scala_home) }
         else
           REQUIRES.artifacts.map(&:to_s)
         end
@@ -282,9 +282,9 @@ module Buildr::Scala
       cmd_args += files_from_sources(sources)
 
       unless Buildr.application.options.dryrun
-        trace((['io.tmio.scalamain.Main', 'com.typesafe.zinc.Main', 'main'] + cmd_args).join(' '))
+        trace((%w(io.tmio.scalamain.Main com.typesafe.zinc.Main main) + cmd_args).join(' '))
         begin
-          Java::Commands.java 'io.tmio.scalamain.Main', *(['com.typesafe.zinc.Main', 'main'] + cmd_args + [{ :classpath => Scalac.dependencies + [ File.join(File.dirname(__FILE__)) ]}])
+          Java::Commands.java 'io.tmio.scalamain.Main', *(%w(com.typesafe.zinc.Main main) + cmd_args + [{:classpath => Scalac.dependencies + [File.join(File.dirname(__FILE__)) ]}])
         rescue => e
           fail "Zinc compiler crashed:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
         end
@@ -306,7 +306,7 @@ module Buildr::Scala
 
         sources.each do |source|
           # try to extract package name from .java or .scala files
-          if ['.java', '.scala'].include? File.extname(source)
+          if %w(.java .scala).include? File.extname(source)
             name = File.basename(source).split(".")[0]
             package = findFirst(source, /^\s*package\s+([^\s;]+)\s*;?\s*/)
             packages = count(source, /^\s*package\s+([^\s;]+)\s*;?\s*/)

http://git-wip-us.apache.org/repos/asf/buildr/blob/db9a976f/spec/packaging/artifact_spec.rb
----------------------------------------------------------------------
diff --git a/spec/packaging/artifact_spec.rb b/spec/packaging/artifact_spec.rb
index 783eba0..d715919 100644
--- a/spec/packaging/artifact_spec.rb
+++ b/spec/packaging/artifact_spec.rb
@@ -1214,7 +1214,7 @@ end
 describe Buildr, '#transitive' do
   before do
     repositories.remote = 'http://buildr.apache.org/repository/noexist'
-    @simple = [ 'saxon:saxon:jar:8.4', 'saxon:saxon-dom:jar:8.4', 'saxon:saxon-xpath:jar:8.4' ]
+    @simple = %w(saxon:saxon:jar:8.4 saxon:saxon-dom:jar:8.4 saxon:saxon-xpath:jar:8.4)
     @simple.map { |spec| artifact(spec).pom }.each { |task| write task.name, task.pom_xml.call }
     @provided = @simple.first
     @complex = 'group:app:jar:1.0'


[4/8] buildr git commit: Use more ruby-esque naming convention for parameter

Posted by do...@apache.org.
Use more ruby-esque naming convention for parameter


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

Branch: refs/heads/master
Commit: 59eb77a44dfb12d27170d851c68a5bcacfd66d28
Parents: 4c5fc10
Author: Peter Donald <pe...@realityforge.org>
Authored: Mon Feb 20 21:17:29 2017 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Mon Feb 20 22:34:27 2017 +1100

----------------------------------------------------------------------
 addon/buildr/bnd.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/59eb77a4/addon/buildr/bnd.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/bnd.rb b/addon/buildr/bnd.rb
index d0f247d..f709c24 100644
--- a/addon/buildr/bnd.rb
+++ b/addon/buildr/bnd.rb
@@ -21,8 +21,8 @@ module Buildr
         @@version
       end
 
-      def version=(newVersion)
-        @@version = newVersion
+      def version=(version)
+        @@version = version
       end
 
       # The specs for requirements