You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2007/07/31 00:23:08 UTC
svn commit: r561157 - in /ode/trunk: Rakefile tasks/derby.rake tasks/jbi.rake
Author: assaf
Date: Mon Jul 30 15:23:07 2007
New Revision: 561157
URL: http://svn.apache.org/viewvc?view=rev&rev=561157
Log:
Fix to jbi.rake to properly work with Buildr 1.2.x
Modified:
ode/trunk/Rakefile
ode/trunk/tasks/derby.rake
ode/trunk/tasks/jbi.rake
Modified: ode/trunk/Rakefile
URL: http://svn.apache.org/viewvc/ode/trunk/Rakefile?view=diff&rev=561157&r1=561156&r2=561157
==============================================================================
--- ode/trunk/Rakefile (original)
+++ ode/trunk/Rakefile Mon Jul 30 15:23:07 2007
@@ -17,7 +17,6 @@
gem "buildr", "~>1.2.2"
require "buildr"
-# require "buildr/lib/buildr"
require "buildr/xmlbeans.rb"
require "buildr/openjpa"
require "buildr/javacc"
@@ -323,19 +322,19 @@
dao_hibernate = project("dao-hibernate").compile.target
bpel_store = project("bpel-store").compile.target
- Buildr::Hibernate::REQUIRES[:xdoclet] = Buildr.group("xdoclet", "xdoclet-xdoclet-module", "xdoclet-hibernate-module",
- :under=>"xdoclet", :version=>"1.2.3") + ["xdoclet:xjavadoc:jar:1.1-j5"]
+ Buildr::Hibernate::REQUIRES[:xdoclet] = Buildr.group("xdoclet", "xdoclet-xdoclet-module", "xdoclet-hibernate-module",
+ :under=>"xdoclet", :version=>"1.2.3") + ["xdoclet:xjavadoc:jar:1.1-j5"]
export = lambda do |properties, source, target|
file(target=>[properties, source]) do |task|
mkpath File.dirname(target), :verbose=>false
- hibernate_schemaexport "" do |task, ant|
- ant.schemaexport(:properties=>properties.to_s, :quiet=>"yes", :text=>"yes", :delimiter=>";",
- :drop=>"no", :create=>"yes", :output=>target) do
- task.fileset :dir=>source.to_s, :includes=>"**/*.hbm.xml" do
- ant.fileset(:dir=>path_to(:java_src_dir)) { include :name=>"**/*.hbm.xml" }
- end
- end
- end
+ hibernate_schemaexport "" do |task, ant|
+ ant.schemaexport(:properties=>properties.to_s, :quiet=>"yes", :text=>"yes", :delimiter=>";",
+ :drop=>"no", :create=>"yes", :output=>target) do
+ task.fileset :dir=>source.to_s, :includes=>"**/*.hbm.xml" do
+ ant.fileset(:dir=>path_to(:java_src_dir)) { include :name=>"**/*.hbm.xml" }
+ end
+ end
+ end
end
end
Modified: ode/trunk/tasks/derby.rake
URL: http://svn.apache.org/viewvc/ode/trunk/tasks/derby.rake?view=diff&rev=561157&r1=561156&r2=561157
==============================================================================
--- ode/trunk/tasks/derby.rake (original)
+++ ode/trunk/tasks/derby.rake Mon Jul 30 15:23:07 2007
@@ -32,7 +32,7 @@
db, prereqs = Rake.application.resolve_args(args)
file(File.expand_path(db)=>prereqs) do |task|
rm_rf task.name if File.exist?(task.name)
- Ant.executable("derby") do |ant|
+ Buildr.ant("derby") do |ant|
sqls = task.prerequisites.map(&:to_s)
ant.sql :driver=>"org.apache.derby.jdbc.EmbeddedDriver", :url=>"jdbc:derby:#{task.to_s};create=true",
:userid=>"sa", :password=>"", :autocommit=>"on" do
Modified: ode/trunk/tasks/jbi.rake
URL: http://svn.apache.org/viewvc/ode/trunk/tasks/jbi.rake?view=diff&rev=561157&r1=561156&r2=561157
==============================================================================
--- ode/trunk/tasks/jbi.rake (original)
+++ ode/trunk/tasks/jbi.rake Mon Jul 30 15:23:07 2007
@@ -65,6 +65,26 @@
end
end
+ def initialize(*args)
+ super
+ prepare { path("lib").include((component.libs + bootstrap.libs).flatten.uniq) }
+
+ enhance do
+ case jbi_xml
+ when String
+ path("META-INF").include jbi_xml.path, :as=>"jbi.xml"
+ when nil, true
+ # Tempfiles gets deleted on garbage collection, so we're going to hold on to it
+ # through instance variable not closure variable.
+ Tempfile.open("MANIFEST.MF") { |@jbi_xml_tmp| @jbi_xml_tmp.write descriptor }
+ path("META-INF").include @jbi_xml_tmp.path, :as=>"jbi.xml"
+ when Proc, Method
+ Tempfile.open("MANIFEST.MF") { |@jbi_xml_tmp| @jbi_xml_tmp.write jbi_xml.call.to_s }
+ path("META-INF").include @jbi_xml_tmp.path, :as=>"jbi.xml"
+ end
+ end
+ end
+
def []=(key, value)
case key.to_sym
when :name, :description, :type
@@ -97,28 +117,6 @@
end
end
- def prerequisites()
- super + (component.libs + bootstrap.libs).flatten.uniq
- end
-
-protected
-
- def create(zip)
- zip.mkdir "META-INF"
- # Create the jbi.xml file from provided file/code or by creating a descriptor.
- jbi_xml_content = case jbi_xml
- when String
- File.read(jbi_xml)
- when nil, true
- descriptor
- when Proc, Method
- jbi_xml.call.to_s
- end
- zip.file.open("META-INF/jbi.xml", "w") { |file| file.write jbi_xml_content }
- path("lib").include((component.libs + bootstrap.libs).flatten.uniq)
- super zip
- end
-
# Create a JBI descriptor (jbi.xml) from the component/bootstrap specification.
def descriptor()
delegation = lambda { |key| "#{key || :parent}-first" }
@@ -150,14 +148,10 @@
def package_as_jbi(file_name, options)
# The file name extension is zip, not jbi. And we also need to reset
# the type on the artifact specification.
- file_name = file_name.ext("zip")
+ # The file type is ZIP, not JBI, so update the file name/spec accordingly.
options[:type] = :zip
- unless Rake::Task.task_defined?(file_name)
- JBITask.define_task(file_name).tap do |jbi|
- jbi.include options[:include] if options[:include]
- [:component, :bootstrap].each { |key| jbi[key] = options[key] if options[key] }
- end
- end
+ file_name = path_to(:target, Artifact.hash_to_file_name(options))
+ JBITask.define_task(file_name) unless Rake::Task.task_defined?(file_name)
file(file_name)
end