ittayd-buildr 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +915 -0
- data/DISCLAIMER +7 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +146 -0
- data/Rakefile +64 -0
- data/_buildr +28 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +221 -0
- data/addon/buildr/openjpa.rb +90 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/path.rb +136 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +58 -0
- data/doc/css/default.css +228 -0
- data/doc/css/print.css +100 -0
- data/doc/css/syntax.css +52 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +207 -0
- data/doc/pages/building.textile +240 -0
- data/doc/pages/contributing.textile +208 -0
- data/doc/pages/download.textile +62 -0
- data/doc/pages/extending.textile +175 -0
- data/doc/pages/getting_started.textile +273 -0
- data/doc/pages/index.textile +42 -0
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +314 -0
- data/doc/pages/packaging.textile +427 -0
- data/doc/pages/projects.textile +274 -0
- data/doc/pages/recipes.textile +103 -0
- data/doc/pages/settings_profiles.textile +274 -0
- data/doc/pages/testing.textile +212 -0
- data/doc/pages/troubleshooting.textile +103 -0
- data/doc/pages/whats_new.textile +323 -0
- data/doc/print.haml +51 -0
- data/doc/print.toc.yaml +29 -0
- data/doc/scripts/buildr-git.rb +412 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +56 -0
- data/doc/site.toc.yaml +47 -0
- data/etc/KEYS +151 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr/core/application.rb +665 -0
- data/lib/buildr/core/build.rb +311 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +590 -0
- data/lib/buildr/core/environment.rb +117 -0
- data/lib/buildr/core/filter.rb +366 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +49 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +923 -0
- data/lib/buildr/core/test.rb +715 -0
- data/lib/buildr/core/transports.rb +560 -0
- data/lib/buildr/core/util.rb +294 -0
- data/lib/buildr/core.rb +29 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/ide/eclipse.rb +222 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +190 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +212 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/java/ant.rb +92 -0
- data/lib/buildr/java/bdd.rb +451 -0
- data/lib/buildr/java/cobertura.rb +236 -0
- data/lib/buildr/java/commands.rb +211 -0
- data/lib/buildr/java/compiler.rb +348 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +238 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
- data/lib/buildr/java/packaging.rb +717 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +307 -0
- data/lib/buildr/java/tests.rb +329 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +759 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +64 -0
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr.rb +33 -0
- data/rakelib/apache.rake +191 -0
- data/rakelib/changelog.rake +57 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +76 -0
- data/rakelib/release.rake +65 -0
- data/rakelib/rspec.rake +83 -0
- data/rakelib/rubyforge.rake +56 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +81 -0
- data/rakelib/stage.rake +48 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +419 -0
- data/spec/core/build_spec.rb +423 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +582 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +776 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +500 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +239 -0
- data/spec/ide/eclipse_spec.rb +311 -0
- data/spec/java/ant.rb +33 -0
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/java/cobertura_spec.rb +77 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +120 -0
- data/spec/java/java_spec.rb +96 -0
- data/spec/java/packaging_spec.rb +1120 -0
- data/spec/java/test_coverage_spec.rb +255 -0
- data/spec/java/tests_spec.rb +471 -0
- data/spec/packaging/archive_spec.rb +503 -0
- data/spec/packaging/artifact_namespace_spec.rb +646 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +589 -0
- data/spec/sandbox.rb +139 -0
- data/spec/scala/compiler_spec.rb +228 -0
- data/spec/scala/tests_spec.rb +215 -0
- data/spec/spec_helpers.rb +327 -0
- data/spec/version_requirement_spec.rb +123 -0
- metadata +377 -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,136 @@
|
|
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
|
+
|
18
|
+
# This Addon extends Buildr with a -C command line option like `make', `tar'
|
19
|
+
# and other unix programs have and with a -p command line option to define a project
|
20
|
+
#
|
21
|
+
#
|
22
|
+
# == Usage:
|
23
|
+
# buildr -R buildr/path --help
|
24
|
+
#
|
25
|
+
# Note: This file must be loaded using the --require-early (-R) option since it
|
26
|
+
# needs to be run before command line argument processing takes place.
|
27
|
+
#
|
28
|
+
# The --directory (-C) option instructs buildr to change the working directory
|
29
|
+
# before trying to find the buildfile. This option can be useful when invoking
|
30
|
+
# buildr from other build systems, most likely by your system package manager.
|
31
|
+
#
|
32
|
+
# The --project (-p) option specifies the default project to run tasks on, for example:
|
33
|
+
# instead of:
|
34
|
+
#
|
35
|
+
# buildr deep:down:project:clean deep:down:project:compile deep:down:project:api:install
|
36
|
+
#
|
37
|
+
# you can do
|
38
|
+
#
|
39
|
+
# buildr -R buildr/path -p deep/down/project clean compile api/install
|
40
|
+
#
|
41
|
+
# You can do for example, to invoke the compile target on subproj:
|
42
|
+
#
|
43
|
+
# buildr -R buildr/path some/very/nested/subproj/compile
|
44
|
+
#
|
45
|
+
# Or invoke a filetask by its path:
|
46
|
+
#
|
47
|
+
# buildr -R buildr/path ./api/target/api-1.0.0.jar
|
48
|
+
#
|
49
|
+
# === TIP: Make your buildfile executable.
|
50
|
+
#
|
51
|
+
# If you always want to use path-like arguments for your project, you may want to edit your buildfile like:
|
52
|
+
#
|
53
|
+
# #!/usr/bin/env ruby
|
54
|
+
# exit !!eval(DATA.read) if $0 == __FILE__ # run buildr unless included
|
55
|
+
#
|
56
|
+
# # all your buildfile project definitions go here
|
57
|
+
#
|
58
|
+
# __END__
|
59
|
+
# require 'rubygems'
|
60
|
+
# require 'buildr'
|
61
|
+
# require 'buildr/path' # load this addon
|
62
|
+
# Buildr.application.run(ARGV)
|
63
|
+
#
|
64
|
+
# Then just make it executable..
|
65
|
+
# chmod 755 buildfile
|
66
|
+
# And run it
|
67
|
+
# ./buildfile -p deep/down/project clean compile api/install
|
68
|
+
module PathArgs
|
69
|
+
|
70
|
+
def standard_buildr_options
|
71
|
+
super +
|
72
|
+
[
|
73
|
+
['--directory', '-C DIR', 'Change to DIR before doing anything.',
|
74
|
+
lambda { |value|
|
75
|
+
value = File.expand_path(value, original_dir)
|
76
|
+
raise ArgumentError, "Not a directory: #{value}" unless File.directory?(value)
|
77
|
+
options.requested_workdir = value
|
78
|
+
}
|
79
|
+
],
|
80
|
+
['--project', '-p PROJECT', 'Set project as the local project.',
|
81
|
+
lambda { |value|
|
82
|
+
raise ArgumentError, "Not a directory: #{value}" if value.include?(File::SEPARATOR) and not File.directory?(value)
|
83
|
+
options.requested_workproj = value
|
84
|
+
}
|
85
|
+
]
|
86
|
+
]
|
87
|
+
end
|
88
|
+
|
89
|
+
# Lookup for a task using the given task_name.
|
90
|
+
# This method extends Rake's functionality to obtain the task for a file path
|
91
|
+
# or the build task if given a project basedir.
|
92
|
+
def lookup(task_name, initial_scope=nil) #nodoc:
|
93
|
+
unless task = super
|
94
|
+
original = File.expand_path(options.requested_workdir || '', original_dir)
|
95
|
+
path = File.expand_path(task_name, original)
|
96
|
+
if !(task = @tasks[path]) && project = Buildr::Project.local_projects(path).first
|
97
|
+
project_path = project.path_to(nil)
|
98
|
+
if project_path == path
|
99
|
+
task = @tasks[project.name + ':build']
|
100
|
+
else
|
101
|
+
project_task = path.sub(/^#{project_path}\/?/, '').gsub('/',':')
|
102
|
+
task = @tasks[project.name + ':' + project_task] || @tasks[project_task]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
task
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def find_buildfile #:nodoc:
|
112
|
+
path = File.expand_path(options.requested_workdir || '', original_dir)
|
113
|
+
Dir.chdir(@original_dir = options.requested_workdir = path) if File.directory?(path)
|
114
|
+
super
|
115
|
+
end
|
116
|
+
|
117
|
+
def top_level #:nodoc:
|
118
|
+
if options.requested_workproj
|
119
|
+
path = File.expand_path(options.requested_workproj, original_dir)
|
120
|
+
if File.directory?(path)
|
121
|
+
project = Buildr::Project.local_projects(options.requested_workproj).first
|
122
|
+
else
|
123
|
+
project_name = options.requested_workproj.gsub(File::SEPARATOR, ':')
|
124
|
+
project = Buildr.project(project_name)
|
125
|
+
end
|
126
|
+
path = project.path_to(nil)
|
127
|
+
Dir.chdir(@original_dir = path)
|
128
|
+
end
|
129
|
+
super
|
130
|
+
end
|
131
|
+
|
132
|
+
end # PathArgs
|
133
|
+
|
134
|
+
Buildr.application.extend PathArgs
|
135
|
+
|
136
|
+
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] ||= 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
|
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,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
|
data/buildr.gemspec
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
|
+
|
17
|
+
Gem::Specification.new do |spec|
|
18
|
+
spec.name = 'buildr'
|
19
|
+
spec.version = '1.3.4'
|
20
|
+
spec.author = 'Apache Buildr'
|
21
|
+
spec.email = "buildr-user@incubator.apache.org"
|
22
|
+
spec.homepage = "http://incubator.apache.org/buildr"
|
23
|
+
spec.summary = "A build system that doesn't suck"
|
24
|
+
spec.rubyforge_project = 'buildr'
|
25
|
+
|
26
|
+
# Rakefile needs to create spec for both platforms (ruby and java), using the
|
27
|
+
# $platform global variable. In all other cases, we figure it out from RUBY_PLATFORM.
|
28
|
+
spec.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
|
29
|
+
|
30
|
+
spec.files = Dir['lib/**/*', 'bin/**/*', 'addon/**/*', 'doc/**/*', 'spec/**/*',
|
31
|
+
'README.rdoc', 'LICENSE', 'NOTICE', 'DISCLAIMER', 'CHANGELOG',
|
32
|
+
'buildr.*', 'Rakefile', 'rakelib/**/*', '_buildr', 'etc/**/*']
|
33
|
+
spec.require_paths = ['lib', 'addon']
|
34
|
+
spec.bindir = 'bin' # Use these for applications.
|
35
|
+
spec.executable = 'buildr'
|
36
|
+
|
37
|
+
spec.has_rdoc = true
|
38
|
+
spec.extra_rdoc_files = ['README.rdoc', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER']
|
39
|
+
spec.rdoc_options << '--title' << "Buildr" << '--main' << 'README.rdoc' <<
|
40
|
+
'--line-numbers' << '--inline-source' << '-p' <<
|
41
|
+
'--webcvs' << 'http://svn.apache.org/repos/asf/incubator/buildr/trunk/'
|
42
|
+
|
43
|
+
# Tested against these dependencies.
|
44
|
+
spec.add_dependency 'rake', '0.8.3'
|
45
|
+
spec.add_dependency 'builder', '2.1.2'
|
46
|
+
spec.add_dependency 'net-ssh', '2.0.4'
|
47
|
+
spec.add_dependency 'net-sftp', '2.0.1'
|
48
|
+
spec.add_dependency 'rubyzip', '0.9.1'
|
49
|
+
spec.add_dependency 'highline', '1.4.0'
|
50
|
+
spec.add_dependency 'rubyforge', '1.0.1'
|
51
|
+
spec.add_dependency 'hoe', '1.8.1'
|
52
|
+
spec.add_dependency 'rjb', '1.1.6' if spec.platform.to_s == 'ruby'
|
53
|
+
spec.add_dependency 'Antwrap', '0.7.0'
|
54
|
+
spec.add_dependency 'rspec', '1.1.11'
|
55
|
+
spec.add_dependency 'xml-simple', '1.0.11'
|
56
|
+
spec.add_dependency 'archive-tar-minitar', '0.5.2'
|
57
|
+
spec.add_dependency 'jruby-openssl', '0.2' if spec.platform.to_s == 'java'
|
58
|
+
end
|