buildr-gemjar 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. data/.braids +8 -0
  2. data/.gitignore +5 -0
  3. data/.rvmrc +1 -0
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +98 -0
  8. data/Rakefile +8 -0
  9. data/buildr-gemjar.gemspec +42 -0
  10. data/lib/buildr-gemjar.rb +162 -0
  11. data/lib/buildr-gemjar/version.rb +3 -0
  12. data/meta.rakefile +30 -0
  13. data/spec/buildr-gemjar/version_spec.rb +11 -0
  14. data/spec/buildr-gemjar_spec.rb +179 -0
  15. data/spec/repo_builder.rb +59 -0
  16. data/spec/spec_helper.rb +44 -0
  17. data/vendor/buildr/.gitignore +17 -0
  18. data/vendor/buildr/CHANGELOG +1283 -0
  19. data/vendor/buildr/Gemfile +4 -0
  20. data/vendor/buildr/LICENSE +176 -0
  21. data/vendor/buildr/NOTICE +26 -0
  22. data/vendor/buildr/README.rdoc +134 -0
  23. data/vendor/buildr/Rakefile +44 -0
  24. data/vendor/buildr/_buildr +35 -0
  25. data/vendor/buildr/_jbuildr +35 -0
  26. data/vendor/buildr/addon/buildr/antlr.rb +65 -0
  27. data/vendor/buildr/addon/buildr/bnd.rb +147 -0
  28. data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
  29. data/vendor/buildr/addon/buildr/drb.rb +281 -0
  30. data/vendor/buildr/addon/buildr/emma.rb +22 -0
  31. data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
  32. data/vendor/buildr/addon/buildr/javacc.rb +85 -0
  33. data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
  34. data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
  35. data/vendor/buildr/addon/buildr/jetty.rb +248 -0
  36. data/vendor/buildr/addon/buildr/jibx.rb +86 -0
  37. data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
  38. data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
  39. data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  40. data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  41. data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  42. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  43. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  44. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  45. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  46. data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
  47. data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
  48. data/vendor/buildr/all-in-one/_buildr +19 -0
  49. data/vendor/buildr/all-in-one/buildr +368 -0
  50. data/vendor/buildr/all-in-one/buildr.cmd +1 -0
  51. data/vendor/buildr/bin/buildr +19 -0
  52. data/vendor/buildr/buildr.buildfile +58 -0
  53. data/vendor/buildr/buildr.gemspec +74 -0
  54. data/vendor/buildr/doc/_config.yml +1 -0
  55. data/vendor/buildr/doc/_layouts/default.html +90 -0
  56. data/vendor/buildr/doc/_layouts/preface.html +22 -0
  57. data/vendor/buildr/doc/artifacts.textile +217 -0
  58. data/vendor/buildr/doc/building.textile +276 -0
  59. data/vendor/buildr/doc/contributing.textile +268 -0
  60. data/vendor/buildr/doc/css/default.css +236 -0
  61. data/vendor/buildr/doc/css/print.css +101 -0
  62. data/vendor/buildr/doc/css/syntax.css +23 -0
  63. data/vendor/buildr/doc/download.textile +138 -0
  64. data/vendor/buildr/doc/extending.textile +212 -0
  65. data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
  66. data/vendor/buildr/doc/images/asf-logo.gif +0 -0
  67. data/vendor/buildr/doc/images/asf-logo.png +0 -0
  68. data/vendor/buildr/doc/images/buildr-hires.png +0 -0
  69. data/vendor/buildr/doc/images/buildr.png +0 -0
  70. data/vendor/buildr/doc/images/favicon.png +0 -0
  71. data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
  72. data/vendor/buildr/doc/images/note.png +0 -0
  73. data/vendor/buildr/doc/images/project-structure.png +0 -0
  74. data/vendor/buildr/doc/images/tip.png +0 -0
  75. data/vendor/buildr/doc/images/zbuildr.png +0 -0
  76. data/vendor/buildr/doc/images/zbuildr.tif +0 -0
  77. data/vendor/buildr/doc/index.textile +69 -0
  78. data/vendor/buildr/doc/installing.textile +284 -0
  79. data/vendor/buildr/doc/languages.textile +599 -0
  80. data/vendor/buildr/doc/mailing_lists.textile +29 -0
  81. data/vendor/buildr/doc/more_stuff.textile +845 -0
  82. data/vendor/buildr/doc/packaging.textile +618 -0
  83. data/vendor/buildr/doc/preface.textile +54 -0
  84. data/vendor/buildr/doc/projects.textile +276 -0
  85. data/vendor/buildr/doc/quick_start.textile +210 -0
  86. data/vendor/buildr/doc/releasing.textile +117 -0
  87. data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
  88. data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
  89. data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
  90. data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
  91. data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
  92. data/vendor/buildr/doc/settings_profiles.textile +287 -0
  93. data/vendor/buildr/doc/testing.textile +247 -0
  94. data/vendor/buildr/etc/KEYS +189 -0
  95. data/vendor/buildr/lib/buildr.rb +44 -0
  96. data/vendor/buildr/lib/buildr/clojure.rb +34 -0
  97. data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
  98. data/vendor/buildr/lib/buildr/core.rb +34 -0
  99. data/vendor/buildr/lib/buildr/core/application.rb +700 -0
  100. data/vendor/buildr/lib/buildr/core/build.rb +516 -0
  101. data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
  102. data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
  103. data/vendor/buildr/lib/buildr/core/common.rb +151 -0
  104. data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
  105. data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
  106. data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
  107. data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
  108. data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
  109. data/vendor/buildr/lib/buildr/core/help.rb +119 -0
  110. data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
  111. data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
  112. data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
  113. data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
  114. data/vendor/buildr/lib/buildr/core/project.rb +975 -0
  115. data/vendor/buildr/lib/buildr/core/run.rb +43 -0
  116. data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
  117. data/vendor/buildr/lib/buildr/core/test.rb +843 -0
  118. data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
  119. data/vendor/buildr/lib/buildr/core/util.rb +537 -0
  120. data/vendor/buildr/lib/buildr/groovy.rb +20 -0
  121. data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
  122. data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
  123. data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
  124. data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
  125. data/vendor/buildr/lib/buildr/ide.rb +19 -0
  126. data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
  127. data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
  128. data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
  129. data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
  130. data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
  131. data/vendor/buildr/lib/buildr/java.rb +25 -0
  132. data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
  133. data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
  134. data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
  135. data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
  136. data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
  137. data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
  138. data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
  139. data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
  140. data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
  141. data/vendor/buildr/lib/buildr/java/external.rb +73 -0
  142. data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
  143. data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
  144. data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  145. data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  146. data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
  147. data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
  148. data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
  149. data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
  150. data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
  151. data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
  152. data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
  153. data/vendor/buildr/lib/buildr/packaging.rb +25 -0
  154. data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
  155. data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
  156. data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
  157. data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
  158. data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
  159. data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
  160. data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
  161. data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
  162. data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
  163. data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
  164. data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
  165. data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
  166. data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
  167. data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
  168. data/vendor/buildr/lib/buildr/run.rb +195 -0
  169. data/vendor/buildr/lib/buildr/scala.rb +26 -0
  170. data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
  171. data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
  172. data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
  173. data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  174. data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  175. data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
  176. data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
  177. data/vendor/buildr/lib/buildr/shell.rb +185 -0
  178. data/vendor/buildr/lib/buildr/version.rb +18 -0
  179. data/vendor/buildr/rakelib/all-in-one.rake +113 -0
  180. data/vendor/buildr/rakelib/checks.rake +57 -0
  181. data/vendor/buildr/rakelib/doc.rake +137 -0
  182. data/vendor/buildr/rakelib/metrics.rake +39 -0
  183. data/vendor/buildr/rakelib/package.rake +73 -0
  184. data/vendor/buildr/rakelib/release.rake +161 -0
  185. data/vendor/buildr/rakelib/rspec.rake +101 -0
  186. data/vendor/buildr/rakelib/setup.rake +66 -0
  187. data/vendor/buildr/rakelib/stage.rake +220 -0
  188. data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
  189. data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
  190. data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
  191. data/vendor/buildr/spec/core/application_spec.rb +631 -0
  192. data/vendor/buildr/spec/core/build_spec.rb +837 -0
  193. data/vendor/buildr/spec/core/cc_spec.rb +224 -0
  194. data/vendor/buildr/spec/core/checks_spec.rb +519 -0
  195. data/vendor/buildr/spec/core/common_spec.rb +725 -0
  196. data/vendor/buildr/spec/core/compile_spec.rb +658 -0
  197. data/vendor/buildr/spec/core/doc_spec.rb +195 -0
  198. data/vendor/buildr/spec/core/extension_spec.rb +201 -0
  199. data/vendor/buildr/spec/core/generate_spec.rb +33 -0
  200. data/vendor/buildr/spec/core/project_spec.rb +772 -0
  201. data/vendor/buildr/spec/core/run_spec.rb +93 -0
  202. data/vendor/buildr/spec/core/shell_spec.rb +146 -0
  203. data/vendor/buildr/spec/core/test_spec.rb +1320 -0
  204. data/vendor/buildr/spec/core/transport_spec.rb +544 -0
  205. data/vendor/buildr/spec/core/util_spec.rb +141 -0
  206. data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
  207. data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
  208. data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
  209. data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
  210. data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
  211. data/vendor/buildr/spec/java/ant_spec.rb +37 -0
  212. data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
  213. data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
  214. data/vendor/buildr/spec/java/commands_spec.rb +93 -0
  215. data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
  216. data/vendor/buildr/spec/java/doc_spec.rb +56 -0
  217. data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
  218. data/vendor/buildr/spec/java/emma_spec.rb +121 -0
  219. data/vendor/buildr/spec/java/external_spec.rb +56 -0
  220. data/vendor/buildr/spec/java/java_spec.rb +132 -0
  221. data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
  222. data/vendor/buildr/spec/java/run_spec.rb +78 -0
  223. data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
  224. data/vendor/buildr/spec/java/tests_spec.rb +497 -0
  225. data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
  226. data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
  227. data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
  228. data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
  229. data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
  230. data/vendor/buildr/spec/sandbox.rb +165 -0
  231. data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
  232. data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
  233. data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
  234. data/vendor/buildr/spec/scala/scala.rb +38 -0
  235. data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
  236. data/vendor/buildr/spec/spec_helpers.rb +369 -0
  237. data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
  238. data/vendor/buildr/spec/xpath_matchers.rb +121 -0
  239. data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
  240. data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
  241. data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
  242. data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
  243. data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
  244. data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
  245. data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
  246. data/vendor/buildr/tests/integration_testing.rb +56 -0
  247. data/vendor/buildr/tests/junit3/Buildfile +9 -0
  248. data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
  249. data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
  250. data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
  251. data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
  252. metadata +524 -0
@@ -0,0 +1,22 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ if Buildr::VERSION < '1.5'
18
+ Buildr.application.deprecated "'buildr/emma', use 'buildr/java/emma' instead"
19
+ require 'buildr/java/emma'
20
+ else
21
+ raise "#{__FILE__} should be removed since its use is deprecated since version 1.3.4"
22
+ end
@@ -0,0 +1,149 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require 'buildr/java'
18
+
19
+
20
+ module Buildr
21
+
22
+ # Provides Hibernate Doclet and schema export tasks. Require explicitly using <code>require "buildr/hibernate"</code>.
23
+ module Hibernate
24
+
25
+ REQUIRES = Buildr.struct(
26
+ :collections => "commons-collections:commons-collections:jar:3.1",
27
+ :logging => "commons-logging:commons-logging:jar:1.0.3",
28
+ :dom4j => "dom4j:dom4j:jar:1.6.1",
29
+ :hibernate => "org.hibernate:hibernate:jar:3.1.2",
30
+ :xdoclet => Buildr.group("xdoclet", "xdoclet-xdoclet-module", "xdoclet-hibernate-module",
31
+ # :under=>"xdoclet", :version=>"1.2.3") + ["xdoclet:xjavadoc:jar:1.1-j5"]
32
+ :under=>"xdoclet", :version=>"1.2.3") + ["xdoclet:xjavadoc:jar:1.1"]
33
+ )
34
+
35
+ class << self
36
+ include Buildr::Ant
37
+
38
+ # :call-seq:
39
+ # doclet(options) => AntProject
40
+ #
41
+ # Uses XDoclet to generate HBM files form annotated source files.
42
+ # Options include:
43
+ # * :sources -- Directory (or directories) containing source files.
44
+ # * :target -- The target directory.
45
+ # * :excludetags -- Tags to exclude (see HibernateDocletTask)
46
+ #
47
+ # For example:
48
+ # doclet :sources=>compile.sources, :target=>compile.target, :excludedtags=>"@version,@author,@todo"
49
+ def doclet(options)
50
+ options[:sources].each { |src| file(src).invoke }
51
+ ant "hibernatedoclet" do |ant|
52
+ ant.taskdef :name=>"hibernatedoclet", :classname=>"xdoclet.modules.hibernate.HibernateDocletTask", :classpath=>options[:classpath]
53
+ ant.hibernatedoclet :destdir=>options[:target].to_s, :excludedtags=>options[:excludedtags], :force=>"true" do
54
+ ant.hibernate :version=>"3.0"
55
+ options[:sources].map(&:to_s).each do |source|
56
+ ant.fileset :dir=>source.to_s, :includes=>"**/*.java"
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ # :call-seq:
63
+ # schemaexport(properties) { ... } => AntProject
64
+ #
65
+ # Runs the Hibernate SchemaExportTask with the specified properties. For example:
66
+ # Buildr::Hibernate.schemaexport(:properties=>properties.to_s, :quiet=>"yes", :text=>"yes", :delimiter=>";",
67
+ # :drop=>"no", :create=>"yes", :output=>target) do
68
+ # fileset :dir=>source.to_s, :includes=>"**/*.hbm.xml"
69
+ # end
70
+ def schemaexport(classpath, options = nil)
71
+ ant "schemaexport" do |ant|
72
+ ant.taskdef :name=>"schemaexport", :classname=>"org.hibernate.tool.hbm2ddl.SchemaExportTask", :classpath=>classpath
73
+ ant.schemaexport(options) { yield ant if block_given? } if options
74
+ end
75
+ end
76
+
77
+ end
78
+
79
+ def hibernate_requires()
80
+ @requires ||= REQUIRES.dup
81
+ end
82
+
83
+ # :call-seq:
84
+ # hibernate_doclet(options?) => task
85
+ #
86
+ # Runs the hibernate doclet on the source files and creates HBM files in the target directory.
87
+ # By default runs on all source files, but you can limit it to a given package using the :package
88
+ # options. You can also pass other options to the doclet task.
89
+ #
90
+ # For example:
91
+ # resources hibernate_doclet(:package=>"org.apache.ode.store.hib", :excludedtags=>"@version,@author,@todo")
92
+ def hibernate_doclet(options = {})
93
+ if options[:package]
94
+ depends = compile.sources.map { |src| FileList[File.join(src.to_s, options[:package].gsub(".", "/"), "*.java")] }.flatten
95
+ else
96
+ depends = compile.sources.map { |src| FileList[File.join(src.to_s, "**/*.java")] }.flatten
97
+ end
98
+ file("target/hbm.timestamp"=>depends) do |task|
99
+ Hibernate.doclet({ :sources=>compile.sources, :target=>compile.target, :classpath => hib_resolve_classpath }.merge(options))
100
+ write task.name
101
+ end
102
+ end
103
+
104
+ # :call-seq:
105
+ # hibernate_schemaexport(path) => task
106
+ # hibernate_schemaexport(path) { |task, ant| .. } => task
107
+ #
108
+ # Returns an new file task with an accessor (ant) to an AntProject that defines the schemaexport task.
109
+ # If called with a block, the task will yield to the block passing both itself and the Ant project.
110
+ #
111
+ # See #schemaexport.
112
+ #
113
+ # For example:
114
+ # hibernate_schemaexport "derby.sql" do |task, ant|
115
+ # ant.schemaexport :properties=>"derby.properties", :output=>task.name,
116
+ # :delimiter=>";", :drop=>"no", :create=>"yes" do
117
+ # fileset(:dir=>compile.sources.first) { include :name=>"**/*.hbm.xml" } }
118
+ # end
119
+ # end
120
+ def hibernate_schemaexport(args, &block)
121
+ path, arg_names, deps = Rake.application.resolve_args([args])
122
+ file(path).enhance { |task|
123
+ unless task.respond_to? :ant #this is a hack. A better way to do the job is to create a real task for all this.
124
+ class << task ; attr_accessor :ant ; end
125
+ task.ant = Hibernate.schemaexport(hib_resolve_classpath)
126
+ end
127
+ }
128
+
129
+ if block
130
+ file(path).enhance(deps) { |task| block.call task, task.ant }
131
+ else
132
+ file(path).enhance deps
133
+ end
134
+ end
135
+
136
+ protected
137
+
138
+ # This will download all the required artifacts before returning a classpath, and we want to do this only once.
139
+ def hib_resolve_classpath
140
+ Buildr.artifacts(hibernate_requires.to_a).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR)
141
+ end
142
+
143
+ end
144
+
145
+ class Project
146
+ include Hibernate
147
+ end
148
+
149
+ end
@@ -0,0 +1,85 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require 'buildr/java'
18
+
19
+
20
+ module Buildr
21
+ # Provides JavaCC compile tasks. Require explicitly using <code>require "buildr/javacc"</code>.
22
+ module JavaCC
23
+
24
+ REQUIRES = [ "net.java.dev.javacc:javacc:jar:4.0", "net.java.dev.javacc:javacc:jar:4.0" ]
25
+
26
+ Java.classpath << REQUIRES
27
+
28
+ class << self
29
+
30
+ def javacc(*args)
31
+ options = Hash === args.last ? args.pop : {}
32
+ rake_check_options options, :output
33
+
34
+ args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.jj"] : f }.flatten
35
+ args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
36
+ Java.load
37
+ Java.org.javacc.parser.Main.mainProgram(args.to_java(Java.java.lang.String)) == 0 or
38
+ fail "Failed to run JavaCC, see errors above."
39
+ end
40
+
41
+ def jjtree(*args)
42
+ options = Hash === args.last ? args.pop : {}
43
+ rake_check_options options, :output, :build_node_files
44
+
45
+ args = args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "**/*.jjt"] : f }.flatten
46
+ args.unshift "-OUTPUT_DIRECTORY=#{options[:output]}" if options[:output]
47
+ args.unshift "-BUILD_NODE_FILES=#{options[:build_node_files] || false}"
48
+ Java.load
49
+ Java.org.javacc.jjtree.JJTree.new.main(args.to_java(Java.java.lang.String)) == 0 or
50
+ fail "Failed to run JJTree, see errors above."
51
+ end
52
+
53
+ end
54
+
55
+ def javacc(*args)
56
+ if Hash === args.last
57
+ options = args.pop
58
+ in_package = options[:in_package].split(".")
59
+ else
60
+ in_package = []
61
+ end
62
+ file(path_to(:target, :generated, :javacc)=>args.flatten) do |task|
63
+ JavaCC.javacc task.prerequisites, :output=>File.join(task.name, in_package)
64
+ end
65
+ end
66
+
67
+ def jjtree(*args)
68
+ if Hash === args.last
69
+ options = args.pop
70
+ in_package = options[:in_package].split(".")
71
+ build_node_files = options[:build_node_files]
72
+ else
73
+ in_package = []
74
+ end
75
+ file(path_to(:target, :generated, :jjtree)=>args.flatten) do |task|
76
+ JavaCC.jjtree task.prerequisites, :output=>File.join(task.name, in_package), :build_node_files=>build_node_files
77
+ end
78
+ end
79
+
80
+ end
81
+
82
+ class Project
83
+ include JavaCC
84
+ end
85
+ end
@@ -0,0 +1,72 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module Buildr
17
+ module JaxbXjc
18
+ class << self
19
+
20
+ def jaxb_version
21
+ "2.2.1"
22
+ end
23
+
24
+ # The specs for requirements
25
+ def dependencies
26
+ [
27
+ "javax.xml.bind:jaxb-api:jar:#{jaxb_version}",
28
+ "com.sun.xml.bind:jaxb-impl:jar:#{jaxb_version}",
29
+ "com.sun.xml.bind:jaxb-xjc:jar:#{jaxb_version}"
30
+ ]
31
+ end
32
+
33
+ # Repositories containing the requirements
34
+ def remote_repository
35
+ "http://download.java.net/maven/2"
36
+ end
37
+
38
+ def xjc(*args)
39
+ cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s)
40
+ Java::Commands.java 'com.sun.tools.xjc.XJCFacade', *(args + [{ :classpath => cp }])
41
+ end
42
+ end
43
+
44
+ def compile_jaxb(files, *args)
45
+ options = Hash === args.last ? args.pop.dup : {}
46
+ rake_check_options options, :directory, :keep_content, :package, :id
47
+ args = args.dup
48
+ files = Array === files ? files.flatten : [files]
49
+
50
+ target_dir = options[:directory] || path_to(:target, :generated, :jaxb)
51
+ timestamp_file = File.expand_path("#{target_dir}/jaxb-#{options[:id] || 1}.cache")
52
+
53
+ file(target_dir => timestamp_file)
54
+
55
+ file(timestamp_file => files.flatten) do |task|
56
+ rm_rf target_dir unless options[:keep_content]
57
+ mkdir_p target_dir
58
+ args << "-d" << target_dir
59
+ args << "-p" << options[:package] if options[:package]
60
+ args += files.collect{|f| f.to_s}
61
+ JaxbXjc.xjc args
62
+ touch timestamp_file
63
+ end
64
+
65
+ target_dir
66
+ end
67
+ end
68
+ end
69
+
70
+ class Buildr::Project
71
+ include Buildr::JaxbXjc
72
+ end
@@ -0,0 +1,60 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require 'buildr/java'
18
+
19
+
20
+ module Buildr
21
+
22
+ # Addes the <code>jdepend:swing</code>, <code>jdepend:text</code> and <code>jdepend:xml</code> tasks.
23
+ # Require explicitly using <code>require "buildr/jdepend"</code>.
24
+ module Jdepend
25
+
26
+ REQUIRES = ["jdepend:jdepend:jar:2.9.1"]
27
+
28
+ class << self
29
+
30
+ def requires()
31
+ @requires ||= Buildr.artifacts(REQUIRES).each(&:invoke).map(&:to_s)
32
+ end
33
+
34
+ def paths()
35
+ Project.projects.map(&:compile).each(&:invoke).map(&:target).
36
+ map(&:to_s).select { |path| File.exist?(path) }.map { |path| File.expand_path(path) }
37
+ end
38
+
39
+ end
40
+
41
+ namespace "jdepend" do
42
+
43
+ desc "Runs JDepend on all your projects (Swing UI)"
44
+ task "swing" do
45
+ Java::Commands.java "jdepend.swingui.JDepend", paths, :classpath=>requires, :name=>"JDepend"
46
+ end
47
+
48
+ desc "Runs JDepend on all your projects (Text UI)"
49
+ task "text" do
50
+ Java::Commands.java "jdepend.textui.JDepend", paths, :classpath=>requires, :name=>"JDepend"
51
+ end
52
+
53
+ desc "Runs JDepend on all your projects (XML output to jdepend.xml)"
54
+ task "xml" do
55
+ Java::Commands.java "jdepend.xmlui.JDepend", "-file", "jdepend.xml", paths, :classpath=>requires, :name=>"JDepend"
56
+ puts "Created jdepend.xml"
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,248 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require 'uri'
18
+ require 'net/http'
19
+ require 'buildr/core/project'
20
+ require 'buildr/java'
21
+ require 'buildr/packaging'
22
+ require 'thread'
23
+
24
+
25
+ module Buildr
26
+
27
+ # Provides a collection of tasks and methods for using Jetty, specifically as a server
28
+ # for testing your application.
29
+ #
30
+ # Build files should always start Jetty by invoking the #use task, typically as
31
+ # a prerequisite. This task will start Jetty once during the build, and shut it down
32
+ # when the build completes.
33
+ #
34
+ # If you want to keep Jetty running across builds, and look at error messages, you can
35
+ # start Jetty in a separate console with:
36
+ # buildr jetty:start
37
+ # To stop this instance of Jetty, simply kill the process (Ctrl-C) or run:
38
+ # buildr jetty:stop
39
+ #
40
+ # If you start Jetty separately from the build, the #use task will connect to that
41
+ # existing server. Since you are using Jetty across several builds, you will want to
42
+ # cleanup any mess created by each build. You can use the #setup and #teardown tasks,
43
+ # which are called when Jetty is first used in the build, and when the build ends.
44
+ class Jetty
45
+
46
+ # Which version of Jetty we're using by default (change with options.jetty.version).
47
+ VERSION = "6.1.3"
48
+ SLF4J_VERSION = "1.4.3"
49
+
50
+ # Libraries used by Jetty.
51
+ REQUIRES = [ "org.mortbay.jetty:jetty:jar:#{VERSION}", "org.mortbay.jetty:jetty-util:jar:#{VERSION}",
52
+ "org.mortbay.jetty:servlet-api-2.5:jar:#{VERSION}", "org.slf4j:slf4j-api:jar:#{SLF4J_VERSION}",
53
+ "org.slf4j:slf4j-simple:jar:#{SLF4J_VERSION}", "org.slf4j:jcl104-over-slf4j:jar:#{SLF4J_VERSION}" ]
54
+
55
+ Java.classpath << REQUIRES
56
+ Java.classpath << File.dirname(__FILE__)
57
+
58
+ # Default URL for Jetty (change with options.jetty.url).
59
+ URL = "http://localhost:8080"
60
+
61
+ class << self
62
+
63
+ # :call-seq:
64
+ # instance() => Jetty
65
+ #
66
+ # Returns an instance of Jetty.
67
+ def instance()
68
+ @instance ||= Jetty.new("jetty", URL)
69
+ end
70
+
71
+ end
72
+
73
+ def initialize(name, url) #:nodoc:
74
+ @url = url
75
+ namespace name do
76
+ @setup = task("setup")
77
+ @teardown = task("teardown")
78
+ @use = task("use") { fire }
79
+ end
80
+ end
81
+
82
+ # The URL for the Jetty server. Leave as is if you want to use the default server
83
+ # (http://localhost:8080).
84
+ attr_accessor :url
85
+
86
+ # :call-seq:
87
+ # start(pipe?)
88
+ #
89
+ # Starts Jetty. This method does not return, it keeps the thread running until
90
+ # Jetty is stopped. If you want to run Jetty parallel with other tasks in the build,
91
+ # invoke the #use task instead.
92
+ def start(sync = nil)
93
+ begin
94
+ puts "classpath #{Java.classpath.inspect}"
95
+ port = URI.parse(url).port
96
+ puts "Starting Jetty at http://localhost:#{port}" if verbose
97
+ Java.load
98
+ jetty = Java.org.apache.buildr.JettyWrapper.new(port)
99
+ sync << "Started" if sync
100
+ sleep # Forever
101
+ rescue Interrupt # Stopped from console
102
+ rescue Exception=>error
103
+ puts "#{error.class}: #{error.message}"
104
+ end
105
+ exit! # No at_exit
106
+ end
107
+
108
+ # :call-seq:
109
+ # stop()
110
+ #
111
+ # Stops Jetty. Stops a server running in a separate process.
112
+ def stop()
113
+ uri = URI.parse(url)
114
+ begin
115
+ Net::HTTP.start(uri.host, uri.port) do |http|
116
+ http.request_post "/buildr/stop", ""
117
+ end
118
+ rescue Errno::ECONNREFUSED
119
+ # Expected if Jetty server not running.
120
+ rescue EOFError
121
+ # We get EOFError because Jetty is brutally killed.
122
+ end
123
+ puts "Jetty server stopped"
124
+ end
125
+
126
+ # :call-seq:
127
+ # running?() => boolean
128
+ #
129
+ # Returns true if it finds a running Jetty server that supports the Buildr
130
+ # requests for deploying, stopping, etc.
131
+ def running?()
132
+ uri = URI.parse(url)
133
+ begin
134
+ Net::HTTP.start(uri.host, uri.port) do |http|
135
+ response = http.request_get("/buildr/")
136
+ response.is_a?(Net::HTTPSuccess) && response.body =~ /Alive/
137
+ end
138
+ rescue Errno::ECONNREFUSED, Errno::EBADF
139
+ false
140
+ end
141
+ end
142
+
143
+ # :call-seq:
144
+ # deploy(url, webapp) => path
145
+ #
146
+ # Deploy a WAR in the specified URL.
147
+ def deploy(url, webapp)
148
+ use.invoke
149
+ uri = URI.parse(url)
150
+ Net::HTTP.start(uri.host, uri.port) do |http|
151
+ response = http.request_post("/buildr/deploy", "webapp=#{webapp}&path=#{uri.path}")
152
+ if Net::HTTPOK === response && response.body =~ /Deployed/
153
+ path = response.body.split[1]
154
+ puts "Deployed #{webapp}, context path #{uri.path}" if trace?
155
+ path
156
+ else
157
+ fail "Deployment failed: #{response}"
158
+ end
159
+ end
160
+ end
161
+
162
+ # :call-seq:
163
+ # undeploy(url) => boolean
164
+ #
165
+ # Undeploys a WAR from the specified URL.
166
+ def undeploy(url)
167
+ use.invoke
168
+ uri = URI.parse(url)
169
+ Net::HTTP.start(uri.host, uri.port) do |http|
170
+ response = http.request_post("/buildr/undeploy", "path=#{uri.path}")
171
+ if Net::HTTPOK === response && response.body =~ /Undeployed/
172
+ true
173
+ else
174
+ fail "Deployment failed: #{response}"
175
+ end
176
+ end
177
+ end
178
+
179
+ # :call-seq:
180
+ # setup(*prereqs) => task
181
+ # setup(*prereqs) { |task| .. } => task
182
+ #
183
+ # This task executes when Jetty is first used in the build. You can use it to
184
+ # deploy artifacts into Jetty.
185
+ def setup(*prereqs, &block)
186
+ @setup.enhance prereqs, &block
187
+ end
188
+
189
+ # :call-seq:
190
+ # teardown(*prereqs) => task
191
+ # teardown(*prereqs) { |task| .. } => task
192
+ #
193
+ # This task executes when the build is done. You can use it to undeploy artifacts
194
+ # previously deployed into Jetty.
195
+ def teardown(*prereqs, &block)
196
+ @teardown.enhance prereqs, &block
197
+ end
198
+
199
+ # :call-seq:
200
+ # use(*prereqs) => task
201
+ # use(*prereqs) { |task| .. } => task
202
+ #
203
+ # If you intend to use Jetty, invoke this task. It will start a new instance of
204
+ # Jetty and close it when the build is done. However, if you already have a server
205
+ # running in the background (e.g. jetty:start), it will use that server and will
206
+ # not close it down.
207
+ def use(*prereqs, &block)
208
+ @use.enhance prereqs, &block
209
+ end
210
+
211
+ protected
212
+
213
+ # If you want to start Jetty inside the build, call this method instead of #start.
214
+ # It will spawn a separate process that will run Jetty, and will stop Jetty when
215
+ # the build ends. However, if you already started Jetty from the console (with
216
+ # take jetty:start), it will use the existing instance without shutting it down.
217
+ def fire()
218
+ unless running?
219
+ sync = Queue.new
220
+ Thread.new { start sync }
221
+ # Wait for Jetty to fire up before doing anything else.
222
+ sync.pop == "Started" or fail "Jetty not started"
223
+ puts "Jetty started" if verbose
224
+ at_exit { stop }
225
+ end
226
+ @setup.invoke
227
+ at_exit { @teardown.invoke }
228
+ end
229
+
230
+ end
231
+
232
+ namespace "jetty" do
233
+ desc "Start an instance of Jetty running in the background"
234
+ task("start") { Jetty.instance.start }
235
+ desc "Stop an instance of Jetty running in the background"
236
+ task("stop") { Jetty.instance.stop }
237
+ end
238
+
239
+ # :call-seq:
240
+ # jetty() => Jetty
241
+ #
242
+ # Returns a Jetty object. You can use this to discover the Jetty#use task,
243
+ # configure the Jetty#setup and Jetty#teardown tasks, deploy and undeploy to Jetty.
244
+ def jetty()
245
+ @jetty ||= Jetty.instance
246
+ end
247
+
248
+ end