assaf-buildr 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/CHANGELOG +887 -0
  2. data/DISCLAIMER +7 -0
  3. data/LICENSE +176 -0
  4. data/NOTICE +26 -0
  5. data/README.rdoc +146 -0
  6. data/Rakefile +62 -0
  7. data/_buildr +38 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +236 -0
  10. data/addon/buildr/emma.rb +238 -0
  11. data/addon/buildr/hibernate.rb +142 -0
  12. data/addon/buildr/javacc.rb +85 -0
  13. data/addon/buildr/jdepend.rb +60 -0
  14. data/addon/buildr/jetty.rb +248 -0
  15. data/addon/buildr/jibx.rb +86 -0
  16. data/addon/buildr/nailgun.rb +817 -0
  17. data/addon/buildr/openjpa.rb +90 -0
  18. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  21. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  25. data/addon/buildr/xmlbeans.rb +93 -0
  26. data/bin/buildr +28 -0
  27. data/buildr.buildfile +53 -0
  28. data/buildr.gemspec +58 -0
  29. data/doc/css/default.css +228 -0
  30. data/doc/css/print.css +100 -0
  31. data/doc/css/syntax.css +52 -0
  32. data/doc/images/apache-incubator-logo.png +0 -0
  33. data/doc/images/buildr-hires.png +0 -0
  34. data/doc/images/buildr.png +0 -0
  35. data/doc/images/favicon.png +0 -0
  36. data/doc/images/growl-icon.tiff +0 -0
  37. data/doc/images/note.png +0 -0
  38. data/doc/images/project-structure.png +0 -0
  39. data/doc/images/tip.png +0 -0
  40. data/doc/images/zbuildr.tif +0 -0
  41. data/doc/pages/artifacts.textile +207 -0
  42. data/doc/pages/building.textile +240 -0
  43. data/doc/pages/contributing.textile +208 -0
  44. data/doc/pages/download.textile +62 -0
  45. data/doc/pages/extending.textile +175 -0
  46. data/doc/pages/getting_started.textile +273 -0
  47. data/doc/pages/index.textile +42 -0
  48. data/doc/pages/languages.textile +407 -0
  49. data/doc/pages/mailing_lists.textile +17 -0
  50. data/doc/pages/more_stuff.textile +286 -0
  51. data/doc/pages/packaging.textile +427 -0
  52. data/doc/pages/projects.textile +274 -0
  53. data/doc/pages/recipes.textile +103 -0
  54. data/doc/pages/settings_profiles.textile +274 -0
  55. data/doc/pages/testing.textile +212 -0
  56. data/doc/pages/troubleshooting.textile +103 -0
  57. data/doc/pages/whats_new.textile +323 -0
  58. data/doc/print.haml +51 -0
  59. data/doc/print.toc.yaml +29 -0
  60. data/doc/scripts/buildr-git.rb +412 -0
  61. data/doc/scripts/install-jruby.sh +44 -0
  62. data/doc/scripts/install-linux.sh +64 -0
  63. data/doc/scripts/install-osx.sh +52 -0
  64. data/doc/site.haml +56 -0
  65. data/doc/site.toc.yaml +47 -0
  66. data/etc/KEYS +151 -0
  67. data/etc/git-svn-authors +16 -0
  68. data/lib/buildr.rb +35 -0
  69. data/lib/buildr/core.rb +27 -0
  70. data/lib/buildr/core/application.rb +489 -0
  71. data/lib/buildr/core/application_cli.rb +139 -0
  72. data/lib/buildr/core/build.rb +311 -0
  73. data/lib/buildr/core/checks.rb +382 -0
  74. data/lib/buildr/core/common.rb +154 -0
  75. data/lib/buildr/core/compile.rb +596 -0
  76. data/lib/buildr/core/environment.rb +120 -0
  77. data/lib/buildr/core/filter.rb +362 -0
  78. data/lib/buildr/core/generate.rb +195 -0
  79. data/lib/buildr/core/help.rb +118 -0
  80. data/lib/buildr/core/progressbar.rb +156 -0
  81. data/lib/buildr/core/project.rb +892 -0
  82. data/lib/buildr/core/test.rb +715 -0
  83. data/lib/buildr/core/transports.rb +558 -0
  84. data/lib/buildr/core/util.rb +289 -0
  85. data/lib/buildr/groovy.rb +18 -0
  86. data/lib/buildr/groovy/bdd.rb +105 -0
  87. data/lib/buildr/groovy/compiler.rb +138 -0
  88. data/lib/buildr/ide.rb +19 -0
  89. data/lib/buildr/ide/eclipse.rb +212 -0
  90. data/lib/buildr/ide/idea.ipr.template +300 -0
  91. data/lib/buildr/ide/idea.rb +189 -0
  92. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  93. data/lib/buildr/ide/idea7x.rb +210 -0
  94. data/lib/buildr/java.rb +23 -0
  95. data/lib/buildr/java/ant.rb +92 -0
  96. data/lib/buildr/java/bdd.rb +449 -0
  97. data/lib/buildr/java/commands.rb +211 -0
  98. data/lib/buildr/java/compiler.rb +348 -0
  99. data/lib/buildr/java/deprecated.rb +141 -0
  100. data/lib/buildr/java/jruby.rb +117 -0
  101. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  102. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  103. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
  104. data/lib/buildr/java/packaging.rb +713 -0
  105. data/lib/buildr/java/pom.rb +178 -0
  106. data/lib/buildr/java/rjb.rb +155 -0
  107. data/lib/buildr/java/test_result.rb +308 -0
  108. data/lib/buildr/java/tests.rb +324 -0
  109. data/lib/buildr/java/version_requirement.rb +172 -0
  110. data/lib/buildr/packaging.rb +21 -0
  111. data/lib/buildr/packaging/artifact.rb +730 -0
  112. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  113. data/lib/buildr/packaging/artifact_search.rb +140 -0
  114. data/lib/buildr/packaging/gems.rb +102 -0
  115. data/lib/buildr/packaging/package.rb +233 -0
  116. data/lib/buildr/packaging/tar.rb +104 -0
  117. data/lib/buildr/packaging/zip.rb +722 -0
  118. data/lib/buildr/resources/buildr.icns +0 -0
  119. data/lib/buildr/scala.rb +19 -0
  120. data/lib/buildr/scala/compiler.rb +109 -0
  121. data/lib/buildr/scala/tests.rb +203 -0
  122. data/rakelib/apache.rake +191 -0
  123. data/rakelib/changelog.rake +57 -0
  124. data/rakelib/doc.rake +103 -0
  125. data/rakelib/package.rake +73 -0
  126. data/rakelib/release.rake +65 -0
  127. data/rakelib/rspec.rake +83 -0
  128. data/rakelib/rubyforge.rake +53 -0
  129. data/rakelib/scm.rake +49 -0
  130. data/rakelib/setup.rake +86 -0
  131. data/rakelib/stage.rake +48 -0
  132. data/spec/addon/cobertura_spec.rb +77 -0
  133. data/spec/addon/emma_spec.rb +120 -0
  134. data/spec/addon/test_coverage_spec.rb +255 -0
  135. data/spec/core/application_spec.rb +412 -0
  136. data/spec/core/artifact_namespace_spec.rb +646 -0
  137. data/spec/core/build_spec.rb +415 -0
  138. data/spec/core/checks_spec.rb +537 -0
  139. data/spec/core/common_spec.rb +664 -0
  140. data/spec/core/compile_spec.rb +566 -0
  141. data/spec/core/generate_spec.rb +33 -0
  142. data/spec/core/project_spec.rb +754 -0
  143. data/spec/core/test_spec.rb +1091 -0
  144. data/spec/core/transport_spec.rb +500 -0
  145. data/spec/groovy/bdd_spec.rb +80 -0
  146. data/spec/groovy/compiler_spec.rb +239 -0
  147. data/spec/ide/eclipse_spec.rb +243 -0
  148. data/spec/java/ant.rb +28 -0
  149. data/spec/java/bdd_spec.rb +358 -0
  150. data/spec/java/compiler_spec.rb +446 -0
  151. data/spec/java/java_spec.rb +88 -0
  152. data/spec/java/packaging_spec.rb +1103 -0
  153. data/spec/java/tests_spec.rb +466 -0
  154. data/spec/packaging/archive_spec.rb +503 -0
  155. data/spec/packaging/artifact_spec.rb +754 -0
  156. data/spec/packaging/packaging_helper.rb +63 -0
  157. data/spec/packaging/packaging_spec.rb +589 -0
  158. data/spec/sandbox.rb +137 -0
  159. data/spec/scala/compiler_spec.rb +228 -0
  160. data/spec/scala/tests_spec.rb +215 -0
  161. data/spec/spec_helpers.rb +304 -0
  162. data/spec/version_requirement_spec.rb +123 -0
  163. metadata +369 -0
@@ -0,0 +1,90 @@
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 OpenJPA bytecode enhancement and Mapping tool task. Require explicitly using <code>require "buildr/openjpa"</code>.
23
+ module OpenJPA
24
+
25
+ VERSION = "1.0.1"
26
+
27
+ REQUIRES = [ "org.apache.openjpa:openjpa:jar:#{VERSION}",
28
+ "commons-collections:commons-collections:jar:3.1",
29
+ "commons-dbcp:commons-dbcp:jar:1.2.1",
30
+ "commons-lang:commons-lang:jar:2.1",
31
+ "commons-pool:commons-pool:jar:1.2",
32
+ "javax.persistence:persistence-api:jar:1.0",
33
+ "org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.0",
34
+ "org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0",
35
+ "net.sourceforge.serp:serp:jar:1.11.0" ]
36
+
37
+ Java.classpath << REQUIRES
38
+
39
+ class << self
40
+
41
+ def enhance(options)
42
+ rake_check_options options, :classpath, :properties, :output
43
+ artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s]
44
+ properties = file(options[:properties]).tap { |task| task.invoke }.to_s
45
+
46
+ Buildr.ant "openjpa" do |ant|
47
+ ant.taskdef :name=>"enhancer", :classname=>"org.apache.openjpa.ant.PCEnhancerTask",
48
+ :classpath=>requires.join(File::PATH_SEPARATOR)
49
+ ant.enhancer :directory=>options[:output].to_s do
50
+ ant.config :propertiesFile=>properties
51
+ ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR)
52
+ end
53
+ end
54
+ end
55
+
56
+ def mapping_tool(options)
57
+ rake_check_options options, :classpath, :properties, :sql, :action
58
+ artifacts = Buildr.artifacts(options[:classpath]).each{ |a| a.invoke }.map(&:to_s)
59
+ properties = file(options[:properties].to_s).tap { |task| task.invoke }.to_s
60
+
61
+ Buildr.ant("openjpa") do |ant|
62
+ ant.taskdef :name=>"mapping", :classname=>"org.apache.openjpa.jdbc.ant.MappingToolTask",
63
+ :classpath=>requires.join(File::PATH_SEPARATOR)
64
+ ant.mapping :schemaAction=>options[:action], :sqlFile=>options[:sql].to_s, :ignoreErrors=>"true" do
65
+ ant.config :propertiesFile=>properties
66
+ ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR)
67
+ end
68
+ end
69
+ end
70
+
71
+ private
72
+
73
+ def requires()
74
+ @requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
75
+ end
76
+
77
+ end
78
+
79
+ def open_jpa_enhance(options = nil)
80
+ jpa_options = { :output=>compile.target, :classpath=>compile.dependencies,
81
+ :properties=>path_to(:source, :main, :resources, 'META-INF/persistence.xml') }
82
+ OpenJPA.enhance jpa_options.merge(options || {})
83
+ end
84
+
85
+ end
86
+
87
+ class Project
88
+ include OpenJPA
89
+ end
90
+ end
@@ -0,0 +1,41 @@
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 com.martiansoftware.nailgun.NGContext;
21
+
22
+ public interface BuildrNail {
23
+
24
+ public void main(NGContext ctx);
25
+
26
+ public static class Main {
27
+ private static BuildrNail nail;
28
+ public static void setNail(BuildrNail _nail) { nail = _nail; }
29
+ public static void nailMain(NGContext ctx) {
30
+ nail.main(ctx);
31
+ }
32
+ }
33
+
34
+ }
35
+
36
+ /*
37
+ * Local Variables:
38
+ * indent-tabs-mode: nil
39
+ * c-basic-offset: 2
40
+ * End:
41
+ */
@@ -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,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] ||= Rake.application.options.trace || false
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.each(&:invoke).map(&:to_s)
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
@@ -0,0 +1,28 @@
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
+ start = Time.now
18
+ require 'rubygems'
19
+ require 'buildr'
20
+ Buildr.application.run
21
+ if verbose
22
+ elapsed = Time.now - start
23
+ real = []
24
+ real << ("%ih" % (elapsed / 3600)) if elapsed >= 3600
25
+ real << ("%im" % ((elapsed / 60) % 60)) if elapsed >= 60
26
+ real << ("%.3fs" % (elapsed % 60))
27
+ puts $terminal.color("Completed in #{real.join}", :green)
28
+ end
@@ -0,0 +1,53 @@
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
+ repositories.remote << 'http://repo1.maven.org/maven2'
20
+ repositories.remote << 'http://scala-tools.org/repo-releases/'
21
+
22
+
23
+ define 'buildr' do
24
+ compile.using :source=>'1.4', :target=>'1.4', :debug=>false
25
+
26
+ define 'java' do
27
+ compile.using(:javac).from(FileList['lib/buildr/java/**/*.java']).into('lib/buildr/java')
28
+ end
29
+
30
+ desc 'Buildr extra packages (Antlr, Cobertura, Hibernate, Javacc, JDepend, Jetty, OpenJPA, XmlBeans)'
31
+ define 'extra', :version=>'1.0' do
32
+ compile.using(:javac).from(FileList['addon/buildr/**/*.java']).into('addon/buildr').with(Buildr::Jetty::REQUIRES, Buildr::Nailgun::ARTIFACT_SPEC)
33
+ # Legals included in source code and show in RDoc.
34
+ legal = 'LICENSE', 'DISCLAIMER', 'NOTICE'
35
+ package(:gem).include(legal).path('lib').include('addon/buildr')
36
+ package(:gem).spec do |spec|
37
+ spec.author = 'Apache Buildr'
38
+ spec.email = 'buildr-user@incubator.apache.org'
39
+ spec.homepage = "http://incubator.apache.org/buildr"
40
+ spec.rubyforge_project = 'buildr'
41
+ spec.extra_rdoc_files = legal
42
+ spec.rdoc_options << '--webcvs' << 'http://svn.apache.org/repos/asf/incubator/buildr/trunk/'
43
+ spec.add_dependency 'buildr', '~> 1.3'
44
+ end
45
+
46
+ install do
47
+ addon package(:gem)
48
+ end
49
+
50
+ upload do
51
+ end
52
+ end
53
+ end