Author: mriou
Date: Wed Jun 18 10:36:32 2008
New Revision: 669233
URL: http://svn.apache.org/viewvc?rev=669233&view=rev
Log:
Final switch to buildr 1.3
Added:
ode/trunk/tasks/xmlbeans.rb
Removed:
ode/trunk/Rakefile.buildr1.3
Modified:
ode/trunk/Rakefile
Modified: ode/trunk/Rakefile
URL:
http://svn.apache.org/viewvc/ode/trunk/Rakefile?rev=669233&r1=669232&r2=669233&view=diff
==============================================================================
--- ode/trunk/Rakefile (original)
+++ ode/trunk/Rakefile Wed Jun 18 10:36:32 2008
@@ -16,11 +16,12 @@
#
require "buildr"
-require "buildr/xmlbeans"
require "buildr/openjpa"
require "buildr/javacc"
require "buildr/jetty"
require "buildr/hibernate"
+require "tasks/xmlbeans"
+
# Keep this structure to allow the build system to update version numbers.
VERSION_NUMBER = "1.3-SNAPSHOT"
@@ -114,7 +115,8 @@
def tag_with_apache_ode(version)
tag_without_apache_ode("APACHE_ODE_#{version.upcase}")
end
- alias_method_chain :tag, :apache_ode
+ alias :tag_without_apache_ode :tag
+ alias :tag :tag_with_apache_ode
end
end
@@ -178,16 +180,16 @@
end
end
- test.with projects("tools"), libs, AXIS2_TEST, AXIOM, JAVAX.servlet,
Buildr::Jetty::REQUIRES
+ test.with projects("tools"), libs, AXIS2_TEST, AXIOM, JAVAX.servlet,
Buildr::Jetty::REQUIRES, file(_("target/test"))
test.setup task(:prepare_webapp) do |task|
- cp_r _("src/main/webapp"), _("target/test-classes")
- cp Dir[_("src/main/webapp/WEB-INF/classes/*")], _("target/test-classes")
- cp Dir[project("axis2").path_to("src/main/wsdl/*")],
_("target/test-classes/webapp/WEB-INF")
- cp project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd"),
_("target/test-classes/webapp/WEB-INF")
- mkdir_p _("target/test-classes/webapp/WEB-INF/processes")
- rm_rf Dir[_("target/test-classes/webapp") + "/**/.svn"]
+ cp_r _("src/main/webapp"), _("target/test")
+ cp Dir[_("src/main/webapp/WEB-INF/classes/*")], _("target/test")
+ cp Dir[project("axis2").path_to("src/main/wsdl/*")],
_("target/test/webapp/WEB-INF")
+ cp project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd"),
_("target/test/webapp/WEB-INF")
+ mkdir_p _("target/test/webapp/WEB-INF/processes")
+ rm_rf Dir[_("target/test/webapp") + "/**/.svn"]
end
- test.setup
unzip(_("target/test-classes/webapp/WEB-INF")=>project("dao-jpa-db").package(:zip))
+ test.setup
unzip(_("target/test/webapp/WEB-INF")=>project("dao-jpa-db").package(:zip))
end
desc "ODE APIs"
@@ -241,7 +243,6 @@
jjtree = jjtree(_("src/main/jjtree"), :in_package=>pkg_name)
compile.from javacc(jjtree, :in_package=>pkg_name), jjtree
compile.with projects("bpel-api", "bpel-compiler", "bpel-obj", "jacob",
"utils")
-
package :jar
end
@@ -404,7 +405,6 @@
desc "ODE Jacob APR Code Generation"
define "jacob-ap" do
- compile.with Java.tools_jar
package :jar
end
@@ -422,12 +422,12 @@
"scheduler-simple", "bpel-schemas", "bpel-store", "dao-hibernate",
"dao-jpa",
"jacob", "jacob-ap", "utils"),
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, XSTREAM, WSDL4J)
+ COMMONS.primitives, JAXEN, JAVAX.connector, JAVAX.ejb, JAVAX.jms,
+ JAVAX.persistence, JAVAX.stream, JAVAX.transaction, LOG4J, OPENJPA,
SAXON, TRANQL,
+ XALAN, XMLBEANS, XSTREAM, WSDL4J)
jbi.component :type=>:service_engine, :name=>"OdeBpelEngine",
:description=>self.comment
- jbi.component :class_name=>"org.apache.ode.jbi.OdeComponent", :libs=>libs
+ jbi.component :class_name=>"org.apache.ode.jbi.OdeComponent",
:delegation=>:self, :libs=>libs
jbi.bootstrap :class_name=>"org.apache.ode.jbi.OdeBootstrap", :libs=>libs
jbi.merge project("dao-hibernate-db").package(:zip)
jbi.merge project("dao-jpa-db").package(:zip)
Added: ode/trunk/tasks/xmlbeans.rb
URL:
http://svn.apache.org/viewvc/ode/trunk/tasks/xmlbeans.rb?rev=669233&view=auto
==============================================================================
--- ode/trunk/tasks/xmlbeans.rb (added)
+++ ode/trunk/tasks/xmlbeans.rb Wed Jun 18 10:36:32 2008
@@ -0,0 +1,91 @@
+# 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.
+
+require 'buildr/java'
+require 'buildr/java/ant'
+
+module Buildr
+
+ # Provides XMLBeans schema compiler. Require explicitly using <code>require
"buildr/xmlbeans"</code>.
+ #
+ # require 'buildr/xmlbeans'
+ # define 'some_proj' do
+ # compile_xml_beans _(:source, :main, :xsd) # the directory with *.xsd
+ # end
+ module XMLBeans
+
+ # You can use ArtifactNamespace to customize the versions of
+ # <code>:xmlbeans</code> or <code>:stax</code> used by this module:
+ #
+ # require 'buildr/xmlbeans'
+ # Buildr::XMLBeans::REQUIRES.xmlbeans = '2.2.0'
+ REQUIRES = ArtifactNamespace.for(self) do |ns|
+ ns.xmlbeans! 'org.apache.xmlbeans:xmlbeans:jar:2.3.0', '>2'
+ ns.stax_api! 'stax:stax-api:jar:>=1.0.1'
+ end
+
+ class << self
+
+ def compile(*args)
+ options = Hash === args.last ? args.pop : {}
+ options[:verbose] ||= Rake.application.options.trace || false
+ rake_check_options options, :verbose, :noop, :javasource, :jar,
:compile, :output, :xsb
+ puts "Running XMLBeans schema compiler" if verbose
+ Buildr.ant "xmlbeans" do |ant|
+ ant.taskdef :name=>"xmlbeans",
:classname=>"org.apache.xmlbeans.impl.tool.XMLBean",
+ :classpath=>requires.join(File::PATH_SEPARATOR)
+ ant.xmlbeans :srconly=>"true", :srcgendir=>options[:output].to_s,
:classgendir=>options[:output].to_s,
+ :javasource=>options[:javasource] do
+ args.flatten.each { |file| ant.fileset File.directory?(file) ? {
:dir=>file } : { :file=>file } }
+ end
+ end
+ # Touch paths to let other tasks know there's an update.
+ touch options[:output].to_s, :verbose=>false
+ end
+
+ def requires()
+ @requires ||= REQUIRES.artifacts.each(&:invoke).map(&:to_s)
+ end
+ end
+
+ def compile_xml_beans(*args)
+ # Run whenever XSD file changes, but typically we're given an directory
of XSD files, or even file patterns
+ # (the last FileList is there to deal with things like *.xsdconfig).
+ files = args.flatten.map { |file| File.directory?(file) ?
FileList["#{file}/*.xsd"] : FileList[file] }.flatten
+ # Generate sources and add them to the compile task.
+ generated = file(path_to(:target, :generated, :xmlbeans)=>files) do
|task|
+ XMLBeans.compile args.flatten, :output=>task.name,
+ :javasource=>compile.options.source, :xsb=>compile.target
+ end
+ compile.using(:javac).from(generated).with(*XMLBeans.requires)
+ # Once compiled, we need to copy the generated XSB/XSD and one
(magical?) class file
+ # into the target directory, or the rest is useless.
+ compile do |task|
+ verbose(false) do
+ base = generated.to_s
+ FileList["#{base}/**/*.{class,xsb,xsd}"].each do |file|
+ target = File.join(compile.target.to_s, Util.relative_path(file,
base))
+ mkpath File.dirname(target) ; cp file, target
+ end
+ end
+ end
+ end
+
+ end
+
+ class Project
+ include XMLBeans
+ end
+end