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 2010/12/21 17:17:19 UTC
svn commit: r1051541 - in /ode/branches/ode-1.3.5.x: Rakefile
jbi-karaf/src/main/resources/features.xml tasks/bnd.rake
Author: vanto
Date: Tue Dec 21 16:17:18 2010
New Revision: 1051541
URL: http://svn.apache.org/viewvc?rev=1051541&view=rev
Log:
fixing jbi-karaf and jbi-karaf with buildr.
Modified:
ode/branches/ode-1.3.5.x/Rakefile
ode/branches/ode-1.3.5.x/jbi-karaf/src/main/resources/features.xml
ode/branches/ode-1.3.5.x/tasks/bnd.rake
Modified: ode/branches/ode-1.3.5.x/Rakefile
URL: http://svn.apache.org/viewvc/ode/branches/ode-1.3.5.x/Rakefile?rev=1051541&r1=1051540&r2=1051541&view=diff
==============================================================================
--- ode/branches/ode-1.3.5.x/Rakefile (original)
+++ ode/branches/ode-1.3.5.x/Rakefile Tue Dec 21 16:17:18 2010
@@ -441,63 +441,74 @@ define "ode" do
end
end
-# desc "ODE Commmands for Karaf"
-# define "jbi-karaf-commands" do
-# compile.with projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, COMMONS.logging
-# libs = artifacts(projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, COMMONS.logging)
-# package(:bundle).tap do |bnd|
-# bnd.bnd_file = _("org.apache.ode.commands.bnd")
-# bnd.sourcepath = _("src/main/java")
-# bnd.classpath = _("target/classes") + File::PATH_SEPARATOR + libs.join(File::PATH_SEPARATOR)
-# bnd.properties.update(BUNDLE_VERSIONS)
-# end
-# end
-#
-# desc "ODE JBI Packaging for Karaf"
-# define "jbi-karaf" do
-# ode_libs = artifacts(projects("bpel-api", "bpel-api-jca", "bpel-compiler", "bpel-connector", "bpel-dao",
-# "bpel-epr", "jca-ra", "jca-server", "bpel-obj", "bpel-ql", "bpel-runtime",
-# "scheduler-simple", "bpel-schemas", "bpel-store", "dao-hibernate", "dao-jpa",
-# "jacob", "jacob-ap", "utils", "agents"))
-# libs = artifacts(ANT, AXIOM, BACKPORT, COMMONS.codec, COMMONS.collections, COMMONS.dbcp, COMMONS.lang, COMMONS.pool,
-# COMMONS.primitives, DERBY, GERONIMO.connector, GERONIMO.transaction, JAXEN, JAVAX.connector,
-# JAVAX.ejb, JAVAX.jms, JAVAX.persistence, JAVAX.stream, JAVAX.transaction, LOG4J, OPENJPA,
-# SAXON, TRANQL, XALAN, XERCES, XMLBEANS, WSDL4J)
-# package(:bundle).tap do |bnd|
-# bnd.bnd_file = _("bnd.bnd")
-# bnd.classpath = (ode_libs + artifacts(project("jbi").package(:jar)) + libs).join(File::PATH_SEPARATOR)
-# bnd.properties.update(BUNDLE_VERSIONS)
-#
-# # inline log4j helper classes
-# bnd.properties["log4j.jar"] = artifact(LOG4J).to_s
-#
-# # inline dao zip files
-# zips = artifacts(project("dao-hibernate-db").package(:zip), project("dao-jpa-ojpa-derby").package(:zip))
-# inlines = zips.map{|item| "@" + item.to_s}
-# bnd.properties["inlines"] = inlines.join(', ')
-#
-# # embed jars
-# bnd_libs = ode_libs + artifacts(AXIOM, BACKPORT, GERONIMO.connector, JAXEN,
-# JAVAX.connector, JAVAX.persistence, JAVAX.ejb,
-# OPENJPA, SAXON, TRANQL,
-# XALAN, XERCES, XMLBEANS, WSDL4J)
-# includes = bnd_libs.map{|item| File.basename(item.to_s)}
-# bnd.properties["includes"] = includes.join(', ')
-# end
-#
-# # Generate features.xml
-# def package_as_feature(file_name)
-# file file_name => [_("src/main/filtered-resources/features.xml")] do
-# filter(_("src/main/filtered-resources")).include("features.xml").into(_("target")).using(BUNDLE_VERSIONS).run
-# mv _("target/features.xml"), file_name
-# end
-# end
-# def package_as_feature_spec(spec)
-# spec.merge({ :type=>:xml, :classifier=>'features' })
-# end
-# package(:feature)
-#
-# end
+ desc "ODE Commmands for Karaf"
+ define "jbi-karaf-commands" do
+ compile.with projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, COMMONS.logging
+ libs = artifacts(projects("bpel-schemas", "jbi"), JBI, KARAF, XMLBEANS, COMMONS.logging)
+ package(:bundle).tap do |bnd|
+ bnd.classpath = [_("target/classes"), libs].flatten
+ BUNDLE_VERSIONS.each {|key, value| bnd[key] = value }
+ bnd['Bundle-Name'] = "Apache ODE Commands"
+ bnd['Bundle-Version'] = VERSION_NUMBER
+ bnd['Require-Bundle'] = "org.apache.ode.jbi"
+ bnd['Import-Package'] = "org.osgi.service.command,*"
+ bnd['Private-Package'] = "org.apache.ode.karaf.commands;version=#{VERSION_NUMBER}"
+ bnd['Include-Resource'] = _('src/main/resources')
+ bnd['-removeheaders'] = "Include-Resource"
+ end
+ end
+
+ desc "ODE JBI Packaging for Karaf"
+ define "jbi-karaf" do
+ resources.filter.using(BUNDLE_VERSIONS)
+ package :jar
+ end
+
+ desc "ODE JBI Bundle"
+ define "jbi-bundle" do
+ ode_libs = artifacts(projects("bpel-api", "bpel-api-jca", "bpel-compiler", "bpel-connector", "bpel-dao",
+ "bpel-epr", "jca-ra", "jca-server", "bpel-obj", "bpel-ql", "bpel-runtime",
+ "scheduler-simple", "bpel-schemas", "bpel-store", "dao-hibernate", "dao-jpa",
+ "jacob", "jacob-ap", "utils", "agents"))
+ libs = artifacts(ANT, AXIOM, BACKPORT, COMMONS.codec, COMMONS.collections, COMMONS.dbcp, COMMONS.lang, COMMONS.pool,
+ COMMONS.primitives, COMMONS.io, DERBY, GERONIMO.connector, GERONIMO.transaction, JAXEN, JAVAX.connector,
+ JAVAX.ejb, JAVAX.jms, JAVAX.persistence, JAVAX.stream, JAVAX.transaction, LOG4J, OPENJPA,
+ SAXON, TRANQL, XALAN, XERCES, XMLBEANS, WSDL4J, KARAF)
+ compile.with projects("bpel-schemas", "jbi"), JBI, libs
+ filter('src/main/filtered-resources').into('target').using(BUNDLE_VERSIONS)
+
+ package(:bundle).tap do |bnd|
+ # inline log4j helper classes
+ #bnd['log4j.jar'] = artifact(LOG4J).to_s
+
+ # inline dao zip files
+ zips = artifacts(project("dao-hibernate-db").package(:zip), project("dao-jpa-ojpa-derby").package(:zip))
+ inlines = zips.map{|item| "@" + item.to_s}
+
+ # embed jars
+ bnd_libs = ode_libs + artifacts(AXIOM, BACKPORT, GERONIMO.connector, JAXEN,
+ JAVAX.connector, JAVAX.persistence, JAVAX.ejb,
+ OPENJPA, SAXON, TRANQL,
+ XALAN, XERCES, XMLBEANS, WSDL4J)
+ includes = bnd_libs.map{|item| File.basename(item.to_s)}
+ bnd["includes"] = includes.join(', ')
+
+ # embedd *.xsd, *.xml, xmlbeans* from ode libs
+ embedres = ode_libs.map {|pkg| ['**.xsd', '**.xml', 'schemaorg_apache_xmlbeans/**'].map {|x| '@' + pkg.to_s + '!/' + x}}.join(', ')
+
+ bnd['Export-Package'] = "org.apache.ode*;version=#{VERSION_NUMBER};-split-package:=merge-first"
+ bnd['Import-Package'] = '!com.sun.mirror*, !org.apache.axis2.client*, javax.jbi*;version="1.0", javax.transaction*;version="1.1", org.tranql.connector.jdbc, org.apache.commons.httpclient*;version="3.0", org.apache.commons.logging*;version="1.1", org.apache.commons*, org.apache.geronimo.transaction.manager;version="2.0", org.osgi.service.command;version="[0.2,1)", org.springframework.beans.factory.xml;version="2.5", org.apache.geronimo.transaction.manager,org.tranql.connector.jdbc,org.w3c.dom, org.xml.sax, org.xml.sax.ext, org.xml.sax.helpers, org.jaxen.saxpath,net.sf.saxon.xpath,*;resolution:=optional'
+ bnd['Embed-Dependency'] = '*;inline=**.xsd|schemaorg_apache_xmlbeans/**|**.xml'
+ bnd['DynamicImport-Package'] = '*'
+ bnd['Include-Resource'] = [embedres, _('src/main/resources'), inlines].flatten.join(', ')
+ bnd['Bundle-Vendor'] = 'Apache Software Foundation'
+ bnd['Bundle-License'] = 'http://www.apache.org/licenses/LICENSE-2.0'
+ bnd['Bundle-DocURL'] = 'http://ode.apache.org'
+ bnd.classpath = [project.compile.target, ode_libs, artifacts(project("jbi").package(:jar)), libs].flatten
+
+ BUNDLE_VERSIONS.each {|key, value| bnd[key] = value }
+ end
+ end
desc "ODE JCA Resource Archive"
define "jca-ra" do
Modified: ode/branches/ode-1.3.5.x/jbi-karaf/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/ode/branches/ode-1.3.5.x/jbi-karaf/src/main/resources/features.xml?rev=1051541&r1=1051540&r2=1051541&view=diff
==============================================================================
--- ode/branches/ode-1.3.5.x/jbi-karaf/src/main/resources/features.xml (original)
+++ ode/branches/ode-1.3.5.x/jbi-karaf/src/main/resources/features.xml Tue Dec 21 16:17:18 2010
@@ -28,49 +28,49 @@
<feature name="ode-core" version="${ode.version}">
<bundle>mvn:org.apache.ode/ode-jbi-bundle/${ode.version}</bundle>
</feature>
- <feature name="ode-hib-deps" version="${project.version}">
+ <feature name="ode-hib-deps" version="${ode.version}">
<bundle>wrap:mvn:dom4j/dom4j/1.6.1</bundle>
<bundle>wrap:mvn:org.hibernate/hibernate/3.2.5.ga</bundle>
</feature>
- <feature name="ode-jpa-deps" version="${project.version}">
+ <feature name="ode-jpa-deps" version="${ode.version}">
<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.java-persistence-api-1.1.1/1.4.0</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/1.13.1_2</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.openjpa/1.2.1_2</bundle>
</feature>
- <feature name="ode-derby-deps" version="${project.version}">
+ <feature name="ode-derby-deps" version="${ode.version}">
<bundle>wrap:mvn:org.tranql/tranql-connector/1.4</bundle>
<bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
</feature>
- <feature name="ode-sqlserver-deps" version="${project.version}">
+ <feature name="ode-sqlserver-deps" version="${ode.version}">
<bundle>wrap:mvn:com.microsoft.sqlserver/sqljdbc/1.2</bundle>
<bundle>wrap:mvn:org.tranql/tranql-connector/1.4</bundle>
<bundle>wrap:mvn:org.tranql/tranql-connector-sqlserver2005-common/1.1</bundle>
</feature>
- <feature name="ode-oracle-deps" version="${project.version}">
+ <feature name="ode-oracle-deps" version="${ode.version}">
<bundle>wrap:mvn:oracle/ojdbc5/11.1.0.6.0</bundle>
<bundle>wrap:mvn:org.tranql/tranql-connector/1.4</bundle>
<bundle>wrap:mvn:org.tranql/tranql-connector-oracle-common/1.4</bundle>
</feature>
- <feature name="ode" version="${project.version}">
- <feature version="${project.version}">ode-derby-deps</feature>
- <feature version="${project.version}">ode-jpa-deps</feature>
- <feature version="${project.version}">ode-core-deps</feature>
- <feature version="${project.version}">ode-core</feature>
- </feature>
- <feature name="ode-hib-oracle" version="${project.version}">
- <feature version="${project.version}">ode-oracle-deps</feature>
- <feature version="${project.version}">ode-hib-deps</feature>
- <feature version="${project.version}">ode-core-deps</feature>
- <feature version="${project.version}">ode-core</feature>
- </feature>
- <feature name="ode-hib-sqlserver" version="${project.version}">
- <feature version="${project.version}">ode-sqlserver-deps</feature>
- <feature version="${project.version}">ode-hib-deps</feature>
- <feature version="${project.version}">ode-core-deps</feature>
- <feature version="${project.version}">ode-core</feature>
- </feature>
- <feature name="examples-ode-ping-pong" version="${project.version}">
- <feature version="${project.version}">ode</feature>
- <bundle>mvn:org.apache.ode.examples/ping-pong-bundle/${project.version}</bundle>
+ <feature name="ode" version="${ode.version}">
+ <feature version="${ode.version}">ode-derby-deps</feature>
+ <feature version="${ode.version}">ode-jpa-deps</feature>
+ <feature version="${ode.version}">ode-core-deps</feature>
+ <feature version="${ode.version}">ode-core</feature>
+ </feature>
+ <feature name="ode-hib-oracle" version="${ode.version}">
+ <feature version="${ode.version}">ode-oracle-deps</feature>
+ <feature version="${ode.version}">ode-hib-deps</feature>
+ <feature version="${ode.version}">ode-core-deps</feature>
+ <feature version="${ode.version}">ode-core</feature>
+ </feature>
+ <feature name="ode-hib-sqlserver" version="${ode.version}">
+ <feature version="${ode.version}">ode-sqlserver-deps</feature>
+ <feature version="${ode.version}">ode-hib-deps</feature>
+ <feature version="${ode.version}">ode-core-deps</feature>
+ <feature version="${ode.version}">ode-core</feature>
+ </feature>
+ <feature name="examples-ode-ping-pong" version="${ode.version}">
+ <feature version="${ode.version}">ode</feature>
+ <bundle>mvn:org.apache.ode.examples/ping-pong-bundle/${ode.version}</bundle>
</feature>
</features>
Modified: ode/branches/ode-1.3.5.x/tasks/bnd.rake
URL: http://svn.apache.org/viewvc/ode/branches/ode-1.3.5.x/tasks/bnd.rake?rev=1051541&r1=1051540&r2=1051541&view=diff
==============================================================================
--- ode/branches/ode-1.3.5.x/tasks/bnd.rake (original)
+++ ode/branches/ode-1.3.5.x/tasks/bnd.rake Tue Dec 21 16:17:18 2010
@@ -1,85 +1,147 @@
-#
-# 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.
-#
-
-# This task creates an OSGi bundle package using the bnd tool.
-#
-# The classpath and path to a bnd configuration file are required.
-# Additional properties can be specified using the bnd.properties
-# hash. Refer to the bnd documentation (http://www.aqute.biz/Code/Bnd)
-# for details on the supported properties.
-#
-# The easiest way to use this task is through the Project#package method.
-# For example:
-# package(:bundle).tap do |bnd|
-# bnd.bnd_file = 'conf/foo.bnd'
-# bnd.classpath = artifacts(...)
-# bnd.properties['foo'] = 'bar'
-# end
-class BndTask < Rake::FileTask
-
- BND = "biz.aQute:bnd:jar:0.0.379"
-
- # Classpath string for building the bundle
- attr_accessor :classpath
-
- # Sourcepath
- attr_accessor :sourcepath
-
- # Path to bnd file
- attr_accessor :bnd_file
-
- # Hash of properties passed to bnd
- attr_accessor :properties
-
- def initialize(*args)
- super
- @properties = {}
-
- # Make sure bnd tool is available
- Buildr.artifact(BND).invoke
-
- enhance do
- Buildr.ant('bnd') do |project|
-
- # pass properties to bnd as ant properties
- properties.each do |key, value|
- project.property(:name=>key, :value=>value)
- end
-
- project.taskdef :name=>'bnd', :classname=>'aQute.bnd.ant.BndTask', :classpath=>Buildr.artifact(BND)
- project.bnd(:classpath=>classpath, :sourcepath=>(sourcepath == nil) ? "" : File.expand_path(sourcepath),
- :files=>File.expand_path(bnd_file), :output=>name,
- :eclipse=>false, :failok=>false, :exceptions=>true)
- end
- end
- end
-
-
-end
-
-
-class Project
-
- def package_as_bundle(file_name) #:nodoc
- BndTask.define_task(file_name)
- end
-
- def package_as_bundle_spec(spec) #:nodoc
- spec.merge({ :type=>:jar, :classifier=>'bundle' })
- end
-
-end
+# 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 Bnd
+ class << self
+ # The specs for requirements
+ def dependencies
+ ["biz.aQute:bnd:jar:0.0.384"]
+ end
+
+ # Repositories containing the requirements
+ def remote_repository
+ "http://www.aQute.biz/repo"
+ end
+
+ def bnd_main(*args)
+ cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s)
+ Java::Commands.java 'aQute.bnd.main.bnd', *(args + [{ :classpath => cp }])
+ end
+ end
+
+ class BundleTask < Rake::FileTask
+ attr_reader :project
+ attr_accessor :classpath
+
+ def [](key)
+ @params[key]
+ end
+
+ def []=(key, value)
+ @params[key] = value
+ end
+
+ def classpath_element(dependencies)
+ artifacts = Buildr.artifacts([dependencies])
+ self.prerequisites << artifacts
+ artifacts.each do |dependency|
+ self.classpath << dependency.to_s
+ end
+ end
+
+ def to_params
+ params = self.project.manifest.merge(@params).reject { |k, v| v.nil? }
+ params["-classpath"] ||= self.classpath.collect(&:to_s).join(", ")
+ params['Bundle-SymbolicName'] ||= [self.project.group, self.project.name.gsub(':', '.')].join('.')
+ params['Bundle-Name'] ||= self.project.comment || self.project.name
+ params['Bundle-Description'] ||= self.project.comment
+ params['Bundle-Version'] ||= self.project.version
+ if params["Include-Resource"].nil? && !project.resources.target.nil?
+ params["Include-Resource"] = "#{project.resources.target}/"
+ end
+ params['-removeheaders'] ||= "Include-Resource,Bnd-LastModified,Created-By,Implementation-Title,Tool"
+
+ params
+ end
+
+ def project=(project)
+ @project = project
+ end
+
+ def classpath=(classpath)
+ @classpath = []
+ Buildr.artifacts([classpath.flatten.compact]).each do |dependency|
+ self.prerequisites << dependency
+ @classpath << dependency.to_s
+ end
+ @classpath
+ end
+
+ def classpath
+ @classpath ||= ([project.compile.target] + project.compile.dependencies).flatten.compact
+ end
+
+ protected
+
+ def initialize(*args) #:nodoc:
+ super
+ @params = {}
+ enhance do
+ filename = self.name
+ # Generate BND file with same name as target jar but different extension
+ bnd_filename = filename.sub /(\.jar)?$/, '.bnd'
+
+ params = self.to_params
+ 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( "build", "-noeclipse", bnd_filename )
+ begin
+ Buildr::Bnd.bnd_main( "print", "-verify", filename )
+ rescue => e
+ rm filename
+ raise e
+ end
+ end
+ end
+ end
+
+ module ProjectExtension
+ include Extension
+
+ first_time do
+ desc "Does `bnd print` on the packaged bundle and stdouts the output for inspection"
+ Project.local_task("bnd:print")
+ end
+
+ def package_as_bundle(filename)
+ project.task('bnd:print' => [filename]) do |task|
+ Buildr::Bnd.bnd_main("print", filename)
+ end
+
+ dirname = File.dirname(filename)
+ directory(dirname)
+
+ # Add Buildr.application.buildfile so it will rebuild if we change settings
+ task = BundleTask.define_task(filename => [Buildr.application.buildfile, dirname])
+ task.project = self
+ # the last task is the task considered the packaging task
+ task
+ end
+
+ # Change the bundle package to .jar extension
+ def package_as_bundle_spec(spec)
+ spec.merge(:type => :jar)
+ end
+ end
+ end
+end
+
+class Buildr::Project
+ include Buildr::Bnd::ProjectExtension
+end
\ No newline at end of file