You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by va...@apache.org on 2013/10/01 18:51:21 UTC

[1/3] git commit: buildr extension to add dependencies to poms.

Updated Branches:
  refs/heads/ode-1.3.6.x 0a2e6f97c -> 24013c829


buildr extension to add dependencies to poms.


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

Branch: refs/heads/ode-1.3.6.x
Commit: 49dbc3b96d81ac94de0d46cb403be018f61a620e
Parents: 0a2e6f9
Author: Tammo van Lessen <tv...@gmail.com>
Authored: Tue Oct 1 18:40:33 2013 +0200
Committer: Tammo van Lessen <tv...@gmail.com>
Committed: Tue Oct 1 18:40:33 2013 +0200

----------------------------------------------------------------------
 tasks/pomwithdependencies.rake | 81 +++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/49dbc3b9/tasks/pomwithdependencies.rake
----------------------------------------------------------------------
diff --git a/tasks/pomwithdependencies.rake b/tasks/pomwithdependencies.rake
new file mode 100644
index 0000000..167a58b
--- /dev/null
+++ b/tasks/pomwithdependencies.rake
@@ -0,0 +1,81 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+module Buildr
+
+    #
+    # Module to add project dependencies to our artifact's pom files. 
+    # Inspired by BUILDR-486 and https://github.com/jvshahid/buildr-dependency-extensions.
+    #
+    module PomWithDependencies
+        include Extension
+
+    # We have to add the dependencies to the monkey patched POM before the dependencies are
+    # changed in the compile, test and run after_define
+    after_define(:compile) do |project|
+        project.package.pom.dependencies =
+        [project.compile.dependencies.select {|dep| dep.respond_to?(:to_spec) && dep.respond_to?(:to_hash)}.map { |a| a.to_hash.merge(:scope => 'compile') },
+            project.test.dependencies.select {|dep| dep.respond_to?(:to_spec) && dep.respond_to?(:to_hash) && !project.compile.dependencies.include?(dep)}.map { |a| a.to_hash.merge(:scope => 'test') },
+            project.run.classpath.select {|dep| dep.respond_to?(:to_spec) && dep.respond_to?(:to_hash) && !project.compile.dependencies.include?(dep)}.map { |a| a.to_hash.merge(:scope => 'runtime') }
+            ].flatten
+        end
+    end
+
+    module ActsAsArtifact
+        # monkey patch Buildr's the pom xml generation
+        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
+                    unless @dependencies.nil? || @dependencies.empty?
+                        xml.dependencies do
+                            @dependencies.uniq.each do |art|
+                                xml.dependency do
+                                    xml.groupId       art[:group]
+                                    xml.artifactId    art[:id]
+                                    xml.version       art[:version]
+                                    xml.classifier    art[:classifier] if art.has_key? :classifier
+                                    xml.scope         art[:scope] if art.has_key? :scope
+                                end
+                            end
+                        end
+                    end
+                end
+            end
+        end
+
+        # make ActAsArtifac dependency aware
+        def dependencies=(dependencies)
+            @dependencies = dependencies
+        end
+
+        def dependencies
+            @dependencies ||= POM.load(self).dependencies.map { |spec| artifact(spec) } if self.is_a? Artifact
+            @dependencies ||= []
+        end
+
+    end
+end
+
+# use this module for all projects.
+class Buildr::Project
+    include Buildr::PomWithDependencies
+end


[2/3] git commit: remove our GPG signing code in favor of the one that is now shipped with Buildr.

Posted by va...@apache.org.
remove our GPG signing code in favor of the one that is now shipped with Buildr.


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

Branch: refs/heads/ode-1.3.6.x
Commit: 6535d0024f6c01272b240c30d3620ec133d6755c
Parents: 49dbc3b
Author: Tammo van Lessen <tv...@gmail.com>
Authored: Tue Oct 1 18:50:21 2013 +0200
Committer: Tammo van Lessen <tv...@gmail.com>
Committed: Tue Oct 1 18:50:21 2013 +0200

----------------------------------------------------------------------
 Rakefile       |  8 +-------
 tasks/gpg.rake | 59 -----------------------------------------------------
 2 files changed, 1 insertion(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/6535d002/Rakefile
----------------------------------------------------------------------
diff --git a/Rakefile b/Rakefile
index d777aa5..a7fb21c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -21,6 +21,7 @@ require "buildr/openjpa"
 require "buildr/javacc"
 require "buildr/jetty"
 require "buildr/hibernate"
+require "buildr/gpg"
 
 require File.join(File.dirname(__FILE__), 'repositories.rb')
 require File.join(File.dirname(__FILE__), 'dependencies.rb')
@@ -632,16 +633,11 @@ define "ode" do
   package_with_sources :except => ["jbi-karaf-examples:helloworld2-osgi", "jbi-karaf-examples:ping-pong-osgi"]
   package_with_javadoc :except => ["jbi-karaf-examples:helloworld2-osgi", "jbi-karaf-examples:ping-pong-osgi"] unless ENV["JAVADOC"] =~ /^(no|off|false|skip)$/i
 
-  # sign artifacts
-  gpg_sign_before_upload
-
-
 
   task :aligndeps do
     pp transitive(['org.apache.axis2:axis2-webapp:jar:1.5.6', 'org.apache.rampart:rampart-project:jar:1.5.2']).group_by {|s| "#{s.group}:#{s.id}:#{s.classifier}:#{s.type}" }.map {|i,v| v.sort_by(&:version).first.to_spec}.sort
   end
 
-
 end
 
 define "apache-ode" do
@@ -733,6 +729,4 @@ define "apache-ode" do
   package(:zip, :id=>"#{id}-docs").include(doc.from(project("ode").projects).
     using(:javadoc, :windowtitle=>"Apache ODE #{project.version}").target, :as=>"#{id}-docs-#{version}") unless ENV["JAVADOC"] =~ /^(no|off|false|skip)$/i
 
-  # sign packages
-  gpg_sign_before_upload
 end

http://git-wip-us.apache.org/repos/asf/ode/blob/6535d002/tasks/gpg.rake
----------------------------------------------------------------------
diff --git a/tasks/gpg.rake b/tasks/gpg.rake
deleted file mode 100644
index 0b31222..0000000
--- a/tasks/gpg.rake
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-
-module Buildr
-  module GPG
-    extend self
-
-    def sign_task(pkg)
-      file(pkg.to_s + '.asc') do
-        puts "GPG signing #{pkg.to_spec}"
-        cmd = 'gpg',
-               '--local-user', ENV['GPG_USER'],
-               '--armor',
-               '--output', pkg.to_s + '.asc'
-        cmd += ['--passphrase', ENV['GPG_PASS']] if ENV['GPG_PASS']
-        cmd += ['--detach-sig', pkg]
-        #cmd << { :verbose => true }
-        #sh *cmd
-        system *cmd
-      end
-    end
-
-    def sign_and_upload(pkg)
-      task(:upload).enhance do
-        artifact = Buildr.artifact(pkg.to_spec_hash.merge(:type => "#{pkg.type}.asc"))
-        artifact.from sign_task(pkg)
-        artifact.invoke
-        artifact.upload
-      end
-    end
-
-    def gpg_sign_before_upload
-      self.enhance do 
-        [self, self.projects].flatten.each { |prj|
-          prj.packages.each { |pkg| sign_and_upload(pkg) }
-          prj.packages.map {|pkg| pkg.pom }.uniq.each { |pom| sign_and_upload(pom) }
-        }
-      end
-    end
-  end
-end
-
-class Buildr::Project
-  include Buildr::GPG
-end


[3/3] git commit: JaCoCo test coverage for tests added.

Posted by va...@apache.org.
JaCoCo test coverage for tests added.


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

Branch: refs/heads/ode-1.3.6.x
Commit: 24013c8295280a66b2f427a6ffaa3f00c3bbc0ed
Parents: 6535d00
Author: Tammo van Lessen <tv...@gmail.com>
Authored: Tue Oct 1 18:50:58 2013 +0200
Committer: Tammo van Lessen <tv...@gmail.com>
Committed: Tue Oct 1 18:50:58 2013 +0200

----------------------------------------------------------------------
 tasks/jacoco.rake | 228 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 228 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/24013c82/tasks/jacoco.rake
----------------------------------------------------------------------
diff --git a/tasks/jacoco.rake b/tasks/jacoco.rake
new file mode 100644
index 0000000..08b5493
--- /dev/null
+++ b/tasks/jacoco.rake
@@ -0,0 +1,228 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+module Buildr
+  # Initial support for JaCoCo coverage reports.
+  # WARNING: Experimental and may change radically.
+  module JaCoCo
+    class << self
+      VERSION = '0.5.10.201208310627'
+
+      def version
+        @version || Buildr.settings.build['jacoco'] || VERSION
+      end
+
+      def version=(value)
+        @version = value
+      end
+
+      def agent_spec
+        ["org.jacoco:org.jacoco.agent:jar:runtime:#{version}"]
+      end
+
+      def ant_spec
+        [
+          "org.jacoco:org.jacoco.report:jar:#{version}",
+          "org.jacoco:org.jacoco.core:jar:#{version}",
+          "org.jacoco:org.jacoco.ant:jar:#{version}",
+          'asm:asm:jar:3.3.1',
+          'asm:asm-commons:jar:3.3.1',
+          'asm:asm-tree:jar:3.3.1'
+        ]
+      end
+    end
+
+    class Config
+
+      attr_writer :enabled
+
+      def enabled?
+        @enabled.nil? ? true : @enabled
+      end
+
+      attr_writer :destfile
+
+      def destfile
+        @destfile || "#{self.report_dir}/jacoco.cov"
+      end
+
+      attr_writer :output
+
+      def output
+        @output || 'file'
+      end
+
+      attr_accessor :sessionid
+      attr_accessor :address
+      attr_accessor :port
+      attr_accessor :classdumpdir
+      attr_accessor :dumponexit
+      attr_accessor :append
+      attr_accessor :exclclassloader
+
+      def includes
+        @includes ||= []
+      end
+
+      def excludes
+        @excludes ||= []
+      end
+
+      attr_writer :report_dir
+
+      def report_dir
+        @report_dir || project._(:reports, :jacoco)
+      end
+
+      attr_writer :generate_xml
+
+      def generate_xml?
+        @generate_xml.nil? ? false : @generate_xml
+      end
+
+      attr_writer :xml_output_file
+
+      def xml_output_file
+        @xml_output_file || "#{self.report_dir}/jacoco.xml"
+      end
+
+      attr_writer :generate_html
+
+      def generate_html?
+        @generate_html.nil? ? false : @generate_html
+      end
+
+      attr_writer :html_output_directory
+
+      def html_output_directory
+        @html_output_directory || "#{self.report_dir}/jacoco"
+      end
+
+      protected
+
+      def initialize(project)
+        @project = project
+      end
+
+      attr_reader :project
+
+    end
+
+    module ProjectExtension
+      include Extension
+
+      def jacoco
+        @jacoco ||= Buildr::JaCoCo::Config.new(project)
+      end
+
+      after_define do |project|
+        unless project.test.compile.target.nil? || !project.jacoco.enabled?
+          project.test.setup do
+            agent_jar = Buildr.artifacts(Buildr::JaCoCo.agent_spec).each(&:invoke).map(&:to_s).join('')
+            options = []
+            ["destfile",
+             "append",
+             "exclclassloader",
+             "sessionid",
+             "dumponexit",
+             "output",
+             "address",
+             "port",
+             "classdumpdir"].each do |option|
+              value = project.jacoco.send(option.to_sym)
+              options << "#{option}=#{value}" unless value.nil?
+            end
+            options << "includes=#{project.jacoco.includes.join(':')}" unless project.jacoco.includes.empty?
+            options << "excludes=#{project.jacoco.excludes.join(':')}" unless project.jacoco.excludes.empty?
+
+            agent_config = "-javaagent:#{agent_jar}=#{options.join(',')}"
+            project.test.options[:java_args] = (project.test.options[:java_args] || []) + [agent_config]
+          end
+          namespace 'jacoco' do
+            if project.jacoco.generate_xml?
+              desc "Generate JaCoCo reports."
+              task 'reports' do
+                Buildr.ant "jacoco" do |ant|
+                  ant.taskdef(:resource => "org/jacoco/ant/antlib.xml") do |ant|
+                    ant.classpath :path => Buildr.artifacts(Buildr::JaCoCo.ant_spec).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
+                  end
+                  ant.report do |ant|
+                    ant.executiondata do |ant|
+                      ant.file :file => project.jacoco.destfile
+                    end
+
+                    ant.structure(:name => project.name) do |ant|
+                      if project.compile.target
+                        ant.classfiles do |ant|
+                          ant.fileset :dir => project.compile.target
+                        end
+                      end
+                      ant.sourcefiles(:encoding => "UTF-8") do |ant|
+                        project.compile.sources.each do |path|
+                          ant.fileset :dir => path.to_s
+                        end
+                      end
+                    end
+
+                    ant.xml :destfile => project.jacoco.xml_output_file if project.jacoco.generate_xml?
+                    ant.html :destdir => project.jacoco.html_output_directory if project.jacoco.generate_html?
+                  end
+                end
+              end
+            end
+          end
+        end
+      end
+      namespace 'jacoco' do
+        desc "Generate JaCoCo reports."
+        task 'report' do
+          Buildr.ant "jacoco" do |ant|
+            ant.taskdef(:resource => "org/jacoco/ant/antlib.xml") do |ant|
+              ant.classpath :path => Buildr.artifacts(Buildr::JaCoCo.ant_spec).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
+            end
+            ant.report do |ant|
+              ant.executiondata do |ant|
+                Buildr.projects.each do |project|
+                  ant.fileset :file=>project.jacoco.destfile if File.exist?(project.jacoco.destfile)
+                end
+              end
+
+              ant.structure(:name => "Jacoco Report") do |ant|
+                ant.classfiles do |ant|
+                  Buildr.projects.map(&:compile).map(&:target).flatten.map(&:to_s).each do |src|
+                    ant.fileset :dir=>src.to_s if File.exist?(src)
+                  end
+                end
+                ant.sourcefiles(:encoding => "UTF-8") do |ant|
+                  Buildr.projects.map(&:compile).map(&:sources).flatten.map(&:to_s).each do |src|
+                    ant.fileset :dir=>src.to_s if File.exist?(src)
+                  end
+                end
+              end
+
+              ant.html :destdir => "reports/jacoco"
+              ant.xml :destfile => "reports/jacoco/jacoco.xml"
+              ant.csv :destfile => "reports/jacoco/jacoco.csv"
+            end
+          end
+        end
+      end
+    end
+  end
+end
+
+class Buildr::Project
+  include Buildr::JaCoCo::ProjectExtension
+end
\ No newline at end of file