mguymon-buildr 1.4.5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. data/CHANGELOG +1291 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +44 -0
  6. data/_buildr +35 -0
  7. data/_jbuildr +35 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/bnd.rb +147 -0
  10. data/addon/buildr/cobertura.rb +22 -0
  11. data/addon/buildr/drb.rb +281 -0
  12. data/addon/buildr/emma.rb +22 -0
  13. data/addon/buildr/hibernate.rb +149 -0
  14. data/addon/buildr/javacc.rb +85 -0
  15. data/addon/buildr/jaxb_xjc.rb +72 -0
  16. data/addon/buildr/jdepend.rb +60 -0
  17. data/addon/buildr/jetty.rb +248 -0
  18. data/addon/buildr/jibx.rb +86 -0
  19. data/addon/buildr/nailgun.rb +221 -0
  20. data/addon/buildr/openjpa.rb +88 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  23. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  27. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  28. data/addon/buildr/protobuf.rb +88 -0
  29. data/addon/buildr/xmlbeans.rb +93 -0
  30. data/bin/buildr +19 -0
  31. data/buildr.buildfile +58 -0
  32. data/buildr.gemspec +78 -0
  33. data/doc/_config.yml +1 -0
  34. data/doc/_layouts/default.html +90 -0
  35. data/doc/_layouts/preface.html +22 -0
  36. data/doc/artifacts.textile +217 -0
  37. data/doc/building.textile +276 -0
  38. data/doc/contributing.textile +268 -0
  39. data/doc/css/default.css +236 -0
  40. data/doc/css/print.css +101 -0
  41. data/doc/css/syntax.css +23 -0
  42. data/doc/download.textile +151 -0
  43. data/doc/extending.textile +212 -0
  44. data/doc/images/1442160941-frontcover.jpg +0 -0
  45. data/doc/images/asf-logo.gif +0 -0
  46. data/doc/images/asf-logo.png +0 -0
  47. data/doc/images/buildr-hires.png +0 -0
  48. data/doc/images/buildr.png +0 -0
  49. data/doc/images/favicon.png +0 -0
  50. data/doc/images/growl-icon.tiff +0 -0
  51. data/doc/images/note.png +0 -0
  52. data/doc/images/project-structure.png +0 -0
  53. data/doc/images/tip.png +0 -0
  54. data/doc/images/zbuildr.png +0 -0
  55. data/doc/images/zbuildr.tif +0 -0
  56. data/doc/index.textile +109 -0
  57. data/doc/installing.textile +284 -0
  58. data/doc/languages.textile +599 -0
  59. data/doc/mailing_lists.textile +29 -0
  60. data/doc/more_stuff.textile +845 -0
  61. data/doc/packaging.textile +618 -0
  62. data/doc/preface.textile +54 -0
  63. data/doc/projects.textile +276 -0
  64. data/doc/quick_start.textile +210 -0
  65. data/doc/releasing.textile +117 -0
  66. data/doc/scripts/buildr-git.rb +512 -0
  67. data/doc/scripts/gitflow.rb +296 -0
  68. data/doc/scripts/install-jruby.sh +44 -0
  69. data/doc/scripts/install-linux.sh +73 -0
  70. data/doc/scripts/install-osx.sh +52 -0
  71. data/doc/settings_profiles.textile +287 -0
  72. data/doc/testing.textile +247 -0
  73. data/etc/KEYS +189 -0
  74. data/lib/buildr.rb +44 -0
  75. data/lib/buildr/clojure.rb +34 -0
  76. data/lib/buildr/clojure/shell.rb +52 -0
  77. data/lib/buildr/core.rb +34 -0
  78. data/lib/buildr/core/application.rb +700 -0
  79. data/lib/buildr/core/build.rb +516 -0
  80. data/lib/buildr/core/cc.rb +166 -0
  81. data/lib/buildr/core/checks.rb +253 -0
  82. data/lib/buildr/core/common.rb +151 -0
  83. data/lib/buildr/core/compile.rb +622 -0
  84. data/lib/buildr/core/doc.rb +276 -0
  85. data/lib/buildr/core/environment.rb +129 -0
  86. data/lib/buildr/core/filter.rb +404 -0
  87. data/lib/buildr/core/generate.rb +197 -0
  88. data/lib/buildr/core/help.rb +119 -0
  89. data/lib/buildr/core/jrebel.rb +42 -0
  90. data/lib/buildr/core/linux.rb +30 -0
  91. data/lib/buildr/core/osx.rb +46 -0
  92. data/lib/buildr/core/progressbar.rb +161 -0
  93. data/lib/buildr/core/project.rb +975 -0
  94. data/lib/buildr/core/run.rb +43 -0
  95. data/lib/buildr/core/shell.rb +137 -0
  96. data/lib/buildr/core/test.rb +843 -0
  97. data/lib/buildr/core/transports.rb +575 -0
  98. data/lib/buildr/core/util.rb +537 -0
  99. data/lib/buildr/groovy.rb +20 -0
  100. data/lib/buildr/groovy/bdd.rb +106 -0
  101. data/lib/buildr/groovy/compiler.rb +153 -0
  102. data/lib/buildr/groovy/doc.rb +76 -0
  103. data/lib/buildr/groovy/shell.rb +57 -0
  104. data/lib/buildr/ide.rb +19 -0
  105. data/lib/buildr/ide/eclipse.rb +427 -0
  106. data/lib/buildr/ide/eclipse/java.rb +53 -0
  107. data/lib/buildr/ide/eclipse/plugin.rb +71 -0
  108. data/lib/buildr/ide/eclipse/scala.rb +68 -0
  109. data/lib/buildr/ide/idea.rb +576 -0
  110. data/lib/buildr/java.rb +25 -0
  111. data/lib/buildr/java/ant.rb +94 -0
  112. data/lib/buildr/java/bdd.rb +460 -0
  113. data/lib/buildr/java/cobertura.rb +297 -0
  114. data/lib/buildr/java/commands.rb +223 -0
  115. data/lib/buildr/java/compiler.rb +135 -0
  116. data/lib/buildr/java/deprecated.rb +141 -0
  117. data/lib/buildr/java/doc.rb +86 -0
  118. data/lib/buildr/java/ecj.rb +69 -0
  119. data/lib/buildr/java/emma.rb +244 -0
  120. data/lib/buildr/java/external.rb +73 -0
  121. data/lib/buildr/java/jruby.rb +122 -0
  122. data/lib/buildr/java/jtestr_result.rb +295 -0
  123. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  124. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  125. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
  126. data/lib/buildr/java/packaging.rb +734 -0
  127. data/lib/buildr/java/pom.rb +178 -0
  128. data/lib/buildr/java/rjb.rb +154 -0
  129. data/lib/buildr/java/test_result.rb +101 -0
  130. data/lib/buildr/java/tests.rb +362 -0
  131. data/lib/buildr/java/version_requirement.rb +172 -0
  132. data/lib/buildr/packaging.rb +25 -0
  133. data/lib/buildr/packaging/archive.rb +535 -0
  134. data/lib/buildr/packaging/artifact.rb +904 -0
  135. data/lib/buildr/packaging/artifact_namespace.rb +984 -0
  136. data/lib/buildr/packaging/artifact_search.rb +140 -0
  137. data/lib/buildr/packaging/gems.rb +105 -0
  138. data/lib/buildr/packaging/package.rb +249 -0
  139. data/lib/buildr/packaging/repository_array.rb +108 -0
  140. data/lib/buildr/packaging/tar.rb +189 -0
  141. data/lib/buildr/packaging/version_requirement.rb +192 -0
  142. data/lib/buildr/packaging/zip.rb +178 -0
  143. data/lib/buildr/packaging/ziptask.rb +356 -0
  144. data/lib/buildr/resources/buildr.icns +0 -0
  145. data/lib/buildr/resources/completed.png +0 -0
  146. data/lib/buildr/resources/failed.png +0 -0
  147. data/lib/buildr/resources/icons-license.txt +17 -0
  148. data/lib/buildr/run.rb +195 -0
  149. data/lib/buildr/scala.rb +26 -0
  150. data/lib/buildr/scala/bdd.rb +118 -0
  151. data/lib/buildr/scala/compiler.rb +242 -0
  152. data/lib/buildr/scala/doc.rb +142 -0
  153. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  154. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  155. data/lib/buildr/scala/shell.rb +52 -0
  156. data/lib/buildr/scala/tests.rb +171 -0
  157. data/lib/buildr/shell.rb +185 -0
  158. data/lib/buildr/version.rb +18 -0
  159. data/rakelib/all-in-one.rake +113 -0
  160. data/rakelib/checks.rake +57 -0
  161. data/rakelib/doc.rake +137 -0
  162. data/rakelib/metrics.rake +39 -0
  163. data/rakelib/package.rake +73 -0
  164. data/rakelib/release.rake +160 -0
  165. data/rakelib/rspec.rake +91 -0
  166. data/rakelib/setup.rake +66 -0
  167. data/rakelib/stage.rake +220 -0
  168. data/spec/addon/bnd_spec.rb +330 -0
  169. data/spec/addon/drb_spec.rb +328 -0
  170. data/spec/addon/jaxb_xjc_spec.rb +125 -0
  171. data/spec/core/application_spec.rb +631 -0
  172. data/spec/core/build_spec.rb +837 -0
  173. data/spec/core/cc_spec.rb +224 -0
  174. data/spec/core/checks_spec.rb +519 -0
  175. data/spec/core/common_spec.rb +725 -0
  176. data/spec/core/compile_spec.rb +658 -0
  177. data/spec/core/doc_spec.rb +195 -0
  178. data/spec/core/extension_spec.rb +201 -0
  179. data/spec/core/generate_spec.rb +33 -0
  180. data/spec/core/project_spec.rb +772 -0
  181. data/spec/core/run_spec.rb +93 -0
  182. data/spec/core/shell_spec.rb +146 -0
  183. data/spec/core/test_spec.rb +1320 -0
  184. data/spec/core/transport_spec.rb +544 -0
  185. data/spec/core/util_spec.rb +141 -0
  186. data/spec/groovy/bdd_spec.rb +80 -0
  187. data/spec/groovy/compiler_spec.rb +251 -0
  188. data/spec/groovy/doc_spec.rb +65 -0
  189. data/spec/ide/eclipse_spec.rb +739 -0
  190. data/spec/ide/idea_spec.rb +1145 -0
  191. data/spec/java/ant_spec.rb +37 -0
  192. data/spec/java/bdd_spec.rb +374 -0
  193. data/spec/java/cobertura_spec.rb +112 -0
  194. data/spec/java/commands_spec.rb +93 -0
  195. data/spec/java/compiler_spec.rb +252 -0
  196. data/spec/java/doc_spec.rb +56 -0
  197. data/spec/java/ecj_spec.rb +115 -0
  198. data/spec/java/emma_spec.rb +121 -0
  199. data/spec/java/external_spec.rb +56 -0
  200. data/spec/java/java_spec.rb +132 -0
  201. data/spec/java/packaging_spec.rb +1266 -0
  202. data/spec/java/run_spec.rb +78 -0
  203. data/spec/java/test_coverage_helper.rb +257 -0
  204. data/spec/java/tests_spec.rb +497 -0
  205. data/spec/packaging/archive_spec.rb +775 -0
  206. data/spec/packaging/artifact_namespace_spec.rb +743 -0
  207. data/spec/packaging/artifact_spec.rb +1074 -0
  208. data/spec/packaging/packaging_helper.rb +63 -0
  209. data/spec/packaging/packaging_spec.rb +719 -0
  210. data/spec/packaging/repository_array_spec.rb +109 -0
  211. data/spec/sandbox.rb +165 -0
  212. data/spec/scala/bdd_spec.rb +124 -0
  213. data/spec/scala/compiler_spec.rb +289 -0
  214. data/spec/scala/doc_spec.rb +88 -0
  215. data/spec/scala/scala.rb +38 -0
  216. data/spec/scala/tests_spec.rb +283 -0
  217. data/spec/spec_helpers.rb +369 -0
  218. data/spec/version_requirement_spec.rb +143 -0
  219. data/spec/xpath_matchers.rb +121 -0
  220. metadata +600 -0
@@ -0,0 +1,144 @@
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
14
+ * under the License.
15
+ */
16
+
17
+
18
+ package org.apache.buildr;
19
+
20
+ import org.mortbay.jetty.Server;
21
+ import org.mortbay.jetty.Request;
22
+ import org.mortbay.jetty.Handler;
23
+ import org.mortbay.jetty.handler.AbstractHandler;
24
+ import org.mortbay.jetty.handler.ContextHandler;
25
+ import org.mortbay.jetty.handler.ContextHandlerCollection;
26
+ import org.mortbay.jetty.webapp.WebAppContext;
27
+ import org.mortbay.jetty.webapp.WebAppClassLoader;
28
+
29
+ import javax.servlet.http.HttpServletRequest;
30
+ import javax.servlet.http.HttpServletResponse;
31
+ import javax.servlet.ServletException;
32
+ import java.io.IOException;
33
+ import java.util.HashMap;
34
+
35
+ /**
36
+ * @author Matthieu Riou <mriou at apache dot org>
37
+ */
38
+ public class JettyWrapper {
39
+
40
+ private Server _server;
41
+ private ContextHandlerCollection _handlerColl;
42
+
43
+ public JettyWrapper(int port) throws Exception {
44
+ _server = new Server(port);
45
+ // Adding the buildr handler to control our server lifecycle
46
+ ContextHandler context = new ContextHandler();
47
+ context.setContextPath("/buildr");
48
+ Handler handler = new BuildrHandler();
49
+ context.setHandler(handler);
50
+
51
+ _handlerColl = new ContextHandlerCollection();
52
+ _handlerColl.setHandlers(new Handler[] {context});
53
+
54
+ _server.addHandler(_handlerColl);
55
+ _server.start();
56
+ }
57
+
58
+ /*
59
+ public void join() {
60
+ try {
61
+ _server.join();
62
+ } catch (Exception e) {
63
+ e.printStackTrace();
64
+ }
65
+ }
66
+ */
67
+
68
+ private class BuildrHandler extends AbstractHandler {
69
+
70
+ private HashMap _apps = new HashMap();
71
+
72
+ public void handle(String string, HttpServletRequest request,
73
+ HttpServletResponse response, int i) throws IOException, ServletException {
74
+ response.setContentType("text/html");
75
+ if (request.getPathInfo().equals("/")) {
76
+ response.getWriter().println("Alive");
77
+ ((Request)request).setHandled(true);
78
+ return;
79
+ } else if (request.getPathInfo().equals("/deploy")) {
80
+ try {
81
+ String webapp = request.getParameter("webapp");
82
+ String path = request.getParameter("path");
83
+ System.out.println("Deploying " + webapp + " in " + path);
84
+ WebAppContext context;
85
+
86
+ context = (WebAppContext) _apps.get(path);
87
+ if (context != null) {
88
+ context.stop();
89
+ _handlerColl.removeHandler(context);
90
+ _apps.remove(path);
91
+ }
92
+
93
+ context = new WebAppContext(webapp, path);
94
+ context.setConfigurationClasses(new String[] {
95
+ "org.mortbay.jetty.webapp.WebInfConfiguration",
96
+ "org.mortbay.jetty.webapp.WebXmlConfiguration"});
97
+ context.setClassLoader(new WebAppClassLoader(context));
98
+
99
+ _handlerColl.addHandler(context);
100
+ context.start();
101
+ _apps.put(path, context);
102
+ response.getWriter().println("Deployed");
103
+ response.getWriter().println(context.getTempDirectory());
104
+ ((Request)request).setHandled(true);
105
+ } catch (Throwable e) {
106
+ e.printStackTrace();
107
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
108
+ ((Request)request).setHandled(true);
109
+ return;
110
+ }
111
+ } else if (request.getPathInfo().equals("/undeploy")) {
112
+ try {
113
+ String path = request.getParameter("path");
114
+ WebAppContext context = (WebAppContext) _apps.get(path);
115
+ if (context != null) {
116
+ System.out.println("Undeploying app at " + path);
117
+ context.stop();
118
+ _handlerColl.removeHandler(context);
119
+ _apps.remove(path);
120
+ }
121
+ response.getWriter().println("Undeployed");
122
+ ((Request)request).setHandled(true);
123
+ } catch (Throwable e) {
124
+ e.printStackTrace();
125
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
126
+ ((Request)request).setHandled(true);
127
+ return;
128
+ }
129
+ } else if (request.getPathInfo().equals("/stop")) {
130
+ try {
131
+ _server.stop();
132
+ _server.destroy();
133
+ // Brute force
134
+ System.exit(0);
135
+ } catch (Exception e) {
136
+ e.printStackTrace();
137
+ }
138
+ }
139
+ response.getWriter().println("OK " + request.getPathInfo());
140
+ ((Request)request).setHandled(true);
141
+ }
142
+
143
+ }
144
+ }
@@ -0,0 +1,88 @@
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
+ module Buildr
18
+
19
+ # Provides Protocol buffer code generation tasks.
20
+ #
21
+ # Require explicitly using <code>require "buildr/protobuf"</code>.
22
+ #
23
+ # Usage in your project:
24
+ #
25
+ # protoc _("path/to/proto/files")
26
+ #
27
+ # and also supports two options,
28
+ #
29
+ # :output => "target/generated/protoc" # this is the default
30
+ # :lang => "java" # defaults to compile.language
31
+ #
32
+ module Protobuf
33
+ class << self
34
+ def protoc(*args)
35
+ options = Hash === args.last ? args.pop : {}
36
+ rake_check_options options, :output, :lang, :include
37
+
38
+ options[:lang] ||= :java
39
+ options[:output] ||= File.expand_path "target/generated/protoc"
40
+ options[:include] ||= []
41
+
42
+ command_line = []
43
+
44
+ command_line << "--#{options[:lang]}_out=#{options[:output]}" if options[:output]
45
+
46
+ (paths_from_sources(*args) + options[:include]).each { |i| command_line << "-I#{i}" }
47
+
48
+ command_line += files_from_sources(*args)
49
+
50
+ mkdir_p( options[:output] )
51
+
52
+ system protoc_path, *command_line
53
+ end
54
+
55
+ def protoc_path
56
+ ENV['PROTOC'] || "protoc"
57
+ end
58
+
59
+ def files_from_sources(*args)
60
+ args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? FileList[f + "/**/*.proto"] : f }.flatten
61
+ end
62
+
63
+ def paths_from_sources(*args)
64
+ args.flatten.map(&:to_s).collect { |f| File.directory?(f) ? f : File.dirname(f) }
65
+ end
66
+ end
67
+
68
+ def protoc(*args)
69
+ if Hash === args.last
70
+ options = args.pop
71
+ else
72
+ options = {}
73
+ end
74
+
75
+ options[:output] ||= path_to(:target, :generated, :protoc)
76
+ options[:lang] ||= compile.language if compile.language
77
+
78
+ file(options[:output]=>Protobuf.files_from_sources(*args)) do |task|
79
+ Protobuf.protoc task.prerequisites, options
80
+ end
81
+ end
82
+
83
+ end
84
+
85
+ class Project
86
+ include Protobuf
87
+ end
88
+ end
@@ -0,0 +1,93 @@
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
+ require 'buildr/java/ant'
19
+
20
+
21
+ module Buildr
22
+
23
+ # Provides XMLBeans schema compiler. Require explicitly using <code>require "buildr/xmlbeans"</code>.
24
+ #
25
+ # require 'buildr/xmlbeans'
26
+ # define 'some_proj' do
27
+ # compile_xml_beans _(:source, :main, :xsd) # the directory with *.xsd
28
+ # end
29
+ module XMLBeans
30
+
31
+ # You can use ArtifactNamespace to customize the versions of
32
+ # <code>:xmlbeans</code> or <code>:stax</code> used by this module:
33
+ #
34
+ # require 'buildr/xmlbeans'
35
+ # Buildr::XMLBeans::REQUIRES.xmlbeans = '2.2.0'
36
+ REQUIRES = ArtifactNamespace.for(self) do |ns|
37
+ ns.xmlbeans! 'org.apache.xmlbeans:xmlbeans:jar:2.3.0', '>2'
38
+ ns.stax_api! 'stax:stax-api:jar:>=1.0.1'
39
+ end
40
+
41
+ class << self
42
+
43
+ def compile(*args)
44
+ options = Hash === args.last ? args.pop : {}
45
+ options[:verbose] ||= trace?(:xmlbeans)
46
+ rake_check_options options, :verbose, :noop, :javasource, :jar, :compile, :output, :xsb
47
+ puts "Running XMLBeans schema compiler" if verbose
48
+ Buildr.ant "xmlbeans" do |ant|
49
+ ant.taskdef :name=>"xmlbeans", :classname=>"org.apache.xmlbeans.impl.tool.XMLBean",
50
+ :classpath=>requires.join(File::PATH_SEPARATOR)
51
+ ant.xmlbeans :srconly=>"true", :srcgendir=>options[:output].to_s, :classgendir=>options[:output].to_s,
52
+ :javasource=>options[:javasource] do
53
+ args.flatten.each { |file| ant.fileset File.directory?(file) ? { :dir=>file } : { :file=>file } }
54
+ end
55
+ end
56
+ # Touch paths to let other tasks know there's an update.
57
+ touch options[:output].to_s, :verbose=>false
58
+ end
59
+
60
+ def requires()
61
+ @requires ||= REQUIRES.artifacts
62
+ end
63
+ end
64
+
65
+ def compile_xml_beans(*args)
66
+ # Run whenever XSD file changes, but typically we're given an directory of XSD files, or even file patterns
67
+ # (the last FileList is there to deal with things like *.xsdconfig).
68
+ files = args.flatten.map { |file| File.directory?(file) ? FileList["#{file}/*.xsd"] : FileList[file] }.flatten
69
+ # Generate sources and add them to the compile task.
70
+ generated = file(path_to(:target, :generated, :xmlbeans)=>files) do |task|
71
+ XMLBeans.compile args.flatten, :output=>task.name,
72
+ :javasource=>compile.options.source, :xsb=>compile.target
73
+ end
74
+ compile.using(:javac).from(generated).with(*XMLBeans.requires)
75
+ # Once compiled, we need to copy the generated XSB/XSD and one (magical?) class file
76
+ # into the target directory, or the rest is useless.
77
+ compile do |task|
78
+ verbose(false) do
79
+ base = generated.to_s
80
+ FileList["#{base}/**/*.{class,xsb,xsd}"].each do |file|
81
+ target = File.join(compile.target.to_s, Util.relative_path(file, base))
82
+ mkpath File.dirname(target) ; cp file, target
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ class Project
91
+ include XMLBeans
92
+ end
93
+ end
data/bin/buildr ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # Licensed to the Apache Software Foundation (ASF) under one or more
3
+ # contributor license agreements. See the NOTICE file distributed with this
4
+ # work for additional information regarding copyright ownership. The ASF
5
+ # licenses this file to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ # License for the specific language governing permissions and limitations under
15
+ # the License.
16
+
17
+ require 'rubygems'
18
+ require 'buildr'
19
+ Buildr.application.run
data/buildr.buildfile ADDED
@@ -0,0 +1,58 @@
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
+ $LOADED_FEATURES << 'jruby' unless RUBY_PLATFORM =~ /java/ # Pretend to have JRuby, keeps Nailgun happy.
17
+ require 'buildr/jetty'
18
+ require 'buildr/nailgun'
19
+ require 'buildr/scala'
20
+ repositories.remote << 'http://repo1.maven.org/maven2'
21
+ repositories.remote << 'http://scala-tools.org/repo-releases/'
22
+
23
+
24
+ define 'buildr' do
25
+ compile.using :source=>'1.5', :target=>'1.5', :debug=>false
26
+
27
+ define 'java' do
28
+ compile.using(:javac).from(FileList['lib/buildr/java/**/*.java']).into('lib/buildr/java')
29
+ end
30
+
31
+ define 'scala' do
32
+ compile.using(:javac).from(FileList['lib/buildr/scala/**/*.java']).into('lib/buildr/scala')
33
+ end
34
+
35
+ desc 'Buildr extra packages (Antlr, Cobertura, Hibernate, Javacc, JDepend, Jetty, OpenJPA, XmlBeans)'
36
+ define 'extra', :version=>'1.0' do
37
+ compile.using(:javac).from(FileList['addon/buildr/**/*.java']).into('addon/buildr').with(Buildr::Jetty::REQUIRES, Buildr::Nailgun::ARTIFACT_SPEC)
38
+ # Legals included in source code and show in RDoc.
39
+ legal = 'LICENSE', 'NOTICE'
40
+ package(:gem).include(legal).path('lib').include('addon/buildr')
41
+ package(:gem).spec do |spec|
42
+ spec.author = 'Apache Buildr'
43
+ spec.email = 'users@buildr.apache.org'
44
+ spec.homepage = "http://buildr.apache.org"
45
+ spec.rubyforge_project = 'buildr'
46
+ spec.extra_rdoc_files = legal
47
+ spec.rdoc_options << '--webcvs' << 'http://svn.apache.org/repos/asf/buildr/trunk/'
48
+ spec.add_dependency 'buildr', '~> 1.3'
49
+ end
50
+
51
+ install do
52
+ addon package(:gem)
53
+ end
54
+
55
+ upload do
56
+ end
57
+ end
58
+ end
data/buildr.gemspec ADDED
@@ -0,0 +1,78 @@
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
+ unless defined?(Buildr::VERSION)
17
+ require File.join(File.dirname(__FILE__), 'lib', 'buildr', 'version.rb')
18
+ end
19
+
20
+ Gem::Specification.new do |spec|
21
+ spec.name = 'mguymon-buildr'
22
+ spec.version = Buildr::VERSION.dup
23
+ spec.author = 'Apache Buildr'
24
+ spec.email = "users@buildr.apache.org"
25
+ spec.homepage = "http://buildr.apache.org/"
26
+ spec.summary = "Build like you code"
27
+ spec.description = <<-TEXT
28
+ Apache Buildr is a build system for Java-based applications, including support
29
+ for Scala, Groovy and a growing number of JVM languages and tools. We wanted
30
+ something that's simple and intuitive to use, so we only need to tell it what
31
+ to do, and it takes care of the rest. But also something we can easily extend
32
+ for those one-off tasks, with a language that's a joy to use.
33
+ TEXT
34
+ spec.rubyforge_project = 'buildr'
35
+
36
+ # Rakefile needs to create spec for both platforms (ruby and java), using the
37
+ # $platform global variable. In all other cases, we figure it out from RUBY_PLATFORM.
38
+ spec.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
39
+
40
+ spec.files = Dir['{addon,bin,doc,etc,lib,rakelib,spec}/**/*', '*.{gemspec,buildfile}'] +
41
+ ['LICENSE', 'NOTICE', 'CHANGELOG', 'README.rdoc', 'Rakefile', '_buildr', '_jbuildr']
42
+ spec.require_paths = 'lib', 'addon'
43
+ spec.bindir = 'bin' # Use these for applications.
44
+ spec.executable = 'buildr'
45
+
46
+ spec.has_rdoc = true
47
+ spec.extra_rdoc_files = 'README.rdoc', 'CHANGELOG', 'LICENSE', 'NOTICE'
48
+ spec.rdoc_options = '--title', 'Buildr', '--main', 'README.rdoc',
49
+ '--webcvs', 'http://svn.apache.org/repos/asf/buildr/trunk/'
50
+ spec.post_install_message = "To get started run buildr --help"
51
+
52
+ # Tested against these dependencies.
53
+ spec.add_dependency 'rake', '0.8.7'
54
+ spec.add_dependency 'builder', '2.1.2'
55
+ spec.add_dependency 'net-ssh', '2.0.23'
56
+ spec.add_dependency 'net-sftp', '2.0.4'
57
+ spec.add_dependency 'rubyzip', '0.9.4'
58
+ spec.add_dependency 'highline', '1.5.1'
59
+ spec.add_dependency 'json_pure', '1.4.3'
60
+ spec.add_dependency 'rubyforge', '2.0.3'
61
+ spec.add_dependency 'hoe', '2.3.3'
62
+ spec.add_dependency 'rjb', '1.3.3' if spec.platform.to_s == 'ruby'
63
+ spec.add_dependency 'rjb', '1.3.2' if spec.platform.to_s == 'x86-mswin32'
64
+ spec.add_dependency 'atoulme-Antwrap', '0.7.1'
65
+ spec.add_dependency 'diff-lcs', '1.1.2'
66
+ spec.add_dependency 'rspec-expectations', '2.1.0'
67
+ spec.add_dependency 'rspec-mocks', '2.1.0'
68
+ spec.add_dependency 'rspec-core', '2.1.0'
69
+ spec.add_dependency 'rspec', '2.1.0'
70
+ spec.add_dependency 'xml-simple', '1.0.12'
71
+ spec.add_dependency 'minitar', '0.5.3'
72
+ spec.add_dependency 'jruby-openssl', '>= 0.7' if spec.platform.to_s == 'java'
73
+ spec.add_development_dependency 'jekyll', '~> 0.6.2' unless spec.platform.to_s == 'java'
74
+ spec.add_development_dependency 'sdoc'
75
+ spec.add_development_dependency 'rcov', '0.9.9' unless spec.platform.to_s == 'java'
76
+ spec.add_development_dependency 'win32console' if spec.platform.to_s == 'x86-mswin32'
77
+ spec.add_development_dependency 'jekylltask', '>= 1.0.2' unless spec.platform.to_s == 'java'
78
+ end