mguymon-buildr 1.4.5-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +1291 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +44 -0
- data/_buildr +35 -0
- data/_jbuildr +35 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/bnd.rb +147 -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 +149 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jaxb_xjc.rb +72 -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 +88 -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/protobuf.rb +88 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +78 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +90 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +217 -0
- data/doc/building.textile +276 -0
- data/doc/contributing.textile +268 -0
- data/doc/css/default.css +236 -0
- data/doc/css/print.css +101 -0
- data/doc/css/syntax.css +23 -0
- data/doc/download.textile +151 -0
- data/doc/extending.textile +212 -0
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/asf-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.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/index.textile +109 -0
- data/doc/installing.textile +284 -0
- data/doc/languages.textile +599 -0
- data/doc/mailing_lists.textile +29 -0
- data/doc/more_stuff.textile +845 -0
- data/doc/packaging.textile +618 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +276 -0
- data/doc/quick_start.textile +210 -0
- data/doc/releasing.textile +117 -0
- data/doc/scripts/buildr-git.rb +512 -0
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +73 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +287 -0
- data/doc/testing.textile +247 -0
- data/etc/KEYS +189 -0
- data/lib/buildr.rb +44 -0
- data/lib/buildr/clojure.rb +34 -0
- data/lib/buildr/clojure/shell.rb +52 -0
- data/lib/buildr/core.rb +34 -0
- data/lib/buildr/core/application.rb +700 -0
- data/lib/buildr/core/build.rb +516 -0
- data/lib/buildr/core/cc.rb +166 -0
- data/lib/buildr/core/checks.rb +253 -0
- data/lib/buildr/core/common.rb +151 -0
- data/lib/buildr/core/compile.rb +622 -0
- data/lib/buildr/core/doc.rb +276 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +404 -0
- data/lib/buildr/core/generate.rb +197 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/jrebel.rb +42 -0
- data/lib/buildr/core/linux.rb +30 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +161 -0
- data/lib/buildr/core/project.rb +975 -0
- data/lib/buildr/core/run.rb +43 -0
- data/lib/buildr/core/shell.rb +137 -0
- data/lib/buildr/core/test.rb +843 -0
- data/lib/buildr/core/transports.rb +575 -0
- data/lib/buildr/core/util.rb +537 -0
- data/lib/buildr/groovy.rb +20 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +153 -0
- data/lib/buildr/groovy/doc.rb +76 -0
- data/lib/buildr/groovy/shell.rb +57 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +427 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/lib/buildr/ide/idea.rb +576 -0
- data/lib/buildr/java.rb +25 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +460 -0
- data/lib/buildr/java/cobertura.rb +297 -0
- data/lib/buildr/java/commands.rb +223 -0
- data/lib/buildr/java/compiler.rb +135 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/doc.rb +86 -0
- data/lib/buildr/java/ecj.rb +69 -0
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/external.rb +73 -0
- data/lib/buildr/java/jruby.rb +122 -0
- data/lib/buildr/java/jtestr_result.rb +295 -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 +142 -0
- data/lib/buildr/java/packaging.rb +734 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +154 -0
- data/lib/buildr/java/test_result.rb +101 -0
- data/lib/buildr/java/tests.rb +362 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +25 -0
- data/lib/buildr/packaging/archive.rb +535 -0
- data/lib/buildr/packaging/artifact.rb +904 -0
- data/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +105 -0
- data/lib/buildr/packaging/package.rb +249 -0
- data/lib/buildr/packaging/repository_array.rb +108 -0
- data/lib/buildr/packaging/tar.rb +189 -0
- data/lib/buildr/packaging/version_requirement.rb +192 -0
- data/lib/buildr/packaging/zip.rb +178 -0
- data/lib/buildr/packaging/ziptask.rb +356 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/resources/completed.png +0 -0
- data/lib/buildr/resources/failed.png +0 -0
- data/lib/buildr/resources/icons-license.txt +17 -0
- data/lib/buildr/run.rb +195 -0
- data/lib/buildr/scala.rb +26 -0
- data/lib/buildr/scala/bdd.rb +118 -0
- data/lib/buildr/scala/compiler.rb +242 -0
- data/lib/buildr/scala/doc.rb +142 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +52 -0
- data/lib/buildr/scala/tests.rb +171 -0
- data/lib/buildr/shell.rb +185 -0
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +137 -0
- data/rakelib/metrics.rake +39 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +160 -0
- data/rakelib/rspec.rake +91 -0
- data/rakelib/setup.rake +66 -0
- data/rakelib/stage.rake +220 -0
- data/spec/addon/bnd_spec.rb +330 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/spec/core/application_spec.rb +631 -0
- data/spec/core/build_spec.rb +837 -0
- data/spec/core/cc_spec.rb +224 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +725 -0
- data/spec/core/compile_spec.rb +658 -0
- data/spec/core/doc_spec.rb +195 -0
- data/spec/core/extension_spec.rb +201 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +772 -0
- data/spec/core/run_spec.rb +93 -0
- data/spec/core/shell_spec.rb +146 -0
- data/spec/core/test_spec.rb +1320 -0
- data/spec/core/transport_spec.rb +544 -0
- data/spec/core/util_spec.rb +141 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +251 -0
- data/spec/groovy/doc_spec.rb +65 -0
- data/spec/ide/eclipse_spec.rb +739 -0
- data/spec/ide/idea_spec.rb +1145 -0
- data/spec/java/ant_spec.rb +37 -0
- data/spec/java/bdd_spec.rb +374 -0
- data/spec/java/cobertura_spec.rb +112 -0
- data/spec/java/commands_spec.rb +93 -0
- data/spec/java/compiler_spec.rb +252 -0
- data/spec/java/doc_spec.rb +56 -0
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +121 -0
- data/spec/java/external_spec.rb +56 -0
- data/spec/java/java_spec.rb +132 -0
- data/spec/java/packaging_spec.rb +1266 -0
- data/spec/java/run_spec.rb +78 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +497 -0
- data/spec/packaging/archive_spec.rb +775 -0
- data/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/spec/packaging/artifact_spec.rb +1074 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +719 -0
- data/spec/packaging/repository_array_spec.rb +109 -0
- data/spec/sandbox.rb +165 -0
- data/spec/scala/bdd_spec.rb +124 -0
- data/spec/scala/compiler_spec.rb +289 -0
- data/spec/scala/doc_spec.rb +88 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +283 -0
- data/spec/spec_helpers.rb +369 -0
- data/spec/version_requirement_spec.rb +143 -0
- data/spec/xpath_matchers.rb +121 -0
- metadata +600 -0
|
@@ -0,0 +1,86 @@
|
|
|
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 'java/java'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module Buildr
|
|
21
|
+
|
|
22
|
+
# Provides JiBX bytecode enhancement. Require explicitly using <code>require 'buildr/jibx'</code>.
|
|
23
|
+
module JiBX
|
|
24
|
+
|
|
25
|
+
JIBX_VERSION = '1.1.5'
|
|
26
|
+
BCEL_VERSION = '5.2'
|
|
27
|
+
STAX_VERSION = '1.0-2'
|
|
28
|
+
XPP3_VERSION = '1.1.4c'
|
|
29
|
+
|
|
30
|
+
REQUIRES = [ "org.jibx:jibx-bind:jar:#{JIBX_VERSION}",
|
|
31
|
+
"org.jibx:jibx-run:jar:#{JIBX_VERSION}",
|
|
32
|
+
"org.apache.bcel:bcel:jar:#{BCEL_VERSION}",
|
|
33
|
+
"javax.xml.stream:stax-api:jar:#{STAX_VERSION}",
|
|
34
|
+
"xpp3:xpp3:jar:#{XPP3_VERSION}" ]
|
|
35
|
+
|
|
36
|
+
Java.classpath << REQUIRES
|
|
37
|
+
|
|
38
|
+
class << self
|
|
39
|
+
|
|
40
|
+
def bind(options)
|
|
41
|
+
rake_check_options options, :classpath, :output, :binding, :target, :verbose, :load
|
|
42
|
+
artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s]
|
|
43
|
+
binding = file(options[:binding]).tap { |task| task.invoke }.to_s
|
|
44
|
+
|
|
45
|
+
Buildr.ant 'jibx' do |ant|
|
|
46
|
+
ant.taskdef :name=>'bind', :classname=>'org.jibx.binding.ant.CompileTask',
|
|
47
|
+
:classpath => requires.join(File::PATH_SEPARATOR)
|
|
48
|
+
ant.bind :verbose => options[:verbose].to_s, :load => options[:load].to_s, :binding=>options[:binding].to_s do
|
|
49
|
+
ant.classpath :path => artifacts.join(File::PATH_SEPARATOR)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def requires()
|
|
57
|
+
@requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def jibx_bind(options = nil)
|
|
63
|
+
|
|
64
|
+
# FIXME - add support for :bindingfileset and :classpathset
|
|
65
|
+
# Note: either :binding or :bindingfileset should be set, and either
|
|
66
|
+
# :classpath or :classpathset should be set, and options passed to
|
|
67
|
+
# ant.bind should be adjusted accordingly. At present, only :binding
|
|
68
|
+
# and :classpath are supported (which should be fine for most!)
|
|
69
|
+
jibx_options = { :output => compile.target,
|
|
70
|
+
:classpath => compile.classpath,
|
|
71
|
+
:binding => path_to(:source, :main, :resources, 'META-INF/binding.xml'),
|
|
72
|
+
:target => compile.target,
|
|
73
|
+
:load => false,
|
|
74
|
+
:verbose => false
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
JiBX.bind jibx_options.merge(options || {})
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Project
|
|
83
|
+
include JiBX
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
@@ -0,0 +1,221 @@
|
|
|
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 'jruby'
|
|
18
|
+
require 'rbconfig'
|
|
19
|
+
require 'tmpdir'
|
|
20
|
+
require 'buildr/drb'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
module Buildr
|
|
24
|
+
|
|
25
|
+
# This addon is provided for fast interaction with a DRb BuildrServer (buildr/drb).
|
|
26
|
+
#
|
|
27
|
+
# This module delegates task invocation to the BuildrServer, it only implements
|
|
28
|
+
# nailgun required logic (server/client).
|
|
29
|
+
#
|
|
30
|
+
# Usage:
|
|
31
|
+
#
|
|
32
|
+
# buildr -r buildr/nailgun nailgun:start
|
|
33
|
+
#
|
|
34
|
+
# Once the server has been started you can invoke tasks using the nailgun client
|
|
35
|
+
# installed on $JRUBY_HOME/tool/nailgun. It's recommended to add this path to
|
|
36
|
+
# your PATH environment variable, so that the ng command is available at any dir.
|
|
37
|
+
#
|
|
38
|
+
# ng build # invoke the build task
|
|
39
|
+
#
|
|
40
|
+
module Nailgun
|
|
41
|
+
extend self
|
|
42
|
+
|
|
43
|
+
VERSION = '0.7.1'
|
|
44
|
+
NAME = "nailgun-#{VERSION}"
|
|
45
|
+
URL = "http://downloads.sourceforge.net/nailgun/#{NAME}.zip"
|
|
46
|
+
ARTIFACT_SPEC = "com.martiansoftware:nailgun:jar:#{VERSION}"
|
|
47
|
+
PORT = DRbApplication::PORT + 2
|
|
48
|
+
ADDON_BIN = File.dirname(__FILE__)
|
|
49
|
+
|
|
50
|
+
# Returns the path to JRUBY_HOME.
|
|
51
|
+
def jruby_home
|
|
52
|
+
ENV['JRUBY_HOME'] || Config::CONFIG['prefix']
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns the path to NAILGUN_HOME.
|
|
56
|
+
def nailgun_home
|
|
57
|
+
ENV['NAILGUN_HOME'] || File.expand_path('tool/nailgun', jruby_home)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def tmp_path(*paths)
|
|
61
|
+
File.join(Dir.tmpdir, 'nailgun', *paths)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
module Util
|
|
65
|
+
extend self
|
|
66
|
+
|
|
67
|
+
def add_to_sysloader(path)
|
|
68
|
+
sysloader = java.lang.ClassLoader.getSystemClassLoader
|
|
69
|
+
add_url_method = java.lang.Class.forName('java.net.URLClassLoader').
|
|
70
|
+
getDeclaredMethod('addURL', [java.net.URL.java_class].to_java(java.lang.Class))
|
|
71
|
+
add_url_method.setAccessible(true)
|
|
72
|
+
add_url_method.invoke(sysloader, [java.io.File.new(path).toURI.toURL].to_java(java.net.URL))
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# invoke a java constructor
|
|
76
|
+
def ctor(on_class, *args)
|
|
77
|
+
parameters = []
|
|
78
|
+
classes = []
|
|
79
|
+
args.each do |obj|
|
|
80
|
+
case obj
|
|
81
|
+
when nil
|
|
82
|
+
classes.push(nil)
|
|
83
|
+
parameters.push(nil)
|
|
84
|
+
when Hash
|
|
85
|
+
vclass = obj.keys.first
|
|
86
|
+
value = obj[vclass]
|
|
87
|
+
classes.push(vclass.java_class)
|
|
88
|
+
parameters.push(value)
|
|
89
|
+
else
|
|
90
|
+
parameters.push obj
|
|
91
|
+
classes.push obj.class.java_class
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
on_class = [on_class.java_class].to_java(java.lang.Class)[0]
|
|
95
|
+
ctor = on_class.getDeclaredConstructor(classes.to_java(java.lang.Class))
|
|
96
|
+
ctor.setAccessible(true)
|
|
97
|
+
ctor.newInstance(parameters.to_java(java.lang.Object))
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end # Util
|
|
101
|
+
|
|
102
|
+
module Client
|
|
103
|
+
|
|
104
|
+
def main(nail)
|
|
105
|
+
nail.out.println "Connected to #{nail.getNGServer}"
|
|
106
|
+
|
|
107
|
+
runtime = JRuby.runtime
|
|
108
|
+
|
|
109
|
+
stdout = Util.ctor(org.jruby.RubyIO, runtime, java.io.OutputStream => nail.out)
|
|
110
|
+
stderr = Util.ctor(org.jruby.RubyIO, runtime, java.io.OutputStream => nail.err)
|
|
111
|
+
stdin = Util.ctor(org.jruby.RubyIO, runtime, java.io.InputStream => nail.in)
|
|
112
|
+
|
|
113
|
+
dir = nail.getWorkingDirectory
|
|
114
|
+
argv = [nail.command] + nail.args
|
|
115
|
+
|
|
116
|
+
DRbApplication.remote_run :dir => dir, :argv => argv,
|
|
117
|
+
:in => stdin, :out => stdout, :err => stderr
|
|
118
|
+
rescue => e
|
|
119
|
+
nail.err.println e unless SystemExit === e
|
|
120
|
+
nail.exit 1
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
end # Client
|
|
124
|
+
|
|
125
|
+
module Server
|
|
126
|
+
def initialize(host, port)
|
|
127
|
+
@host = host || "*"
|
|
128
|
+
@port = port
|
|
129
|
+
super(host, port)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def start
|
|
133
|
+
self.allow_nails_by_class_name = false
|
|
134
|
+
|
|
135
|
+
NGClient::Main.nail = NGClient.new
|
|
136
|
+
self.default_nail_class = NGClient::Main
|
|
137
|
+
|
|
138
|
+
@thread = java.lang.Thread.new(self)
|
|
139
|
+
@thread.setName(to_s)
|
|
140
|
+
@thread.start
|
|
141
|
+
|
|
142
|
+
sleep 1 while getPort == 0
|
|
143
|
+
info "#{self} Started."
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def stop
|
|
147
|
+
@thread.kill
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def to_s
|
|
151
|
+
version = "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby '+ (Buildr.settings.build['jruby'] || JRUBY_VERSION) +')'}"
|
|
152
|
+
self.class.name+'('+[version, @host, @port].join(', ')+')'
|
|
153
|
+
end
|
|
154
|
+
end # Server
|
|
155
|
+
|
|
156
|
+
namespace(:nailgun) do
|
|
157
|
+
|
|
158
|
+
dist_zip = Buildr.download(tmp_path(NAME + '.zip') => URL)
|
|
159
|
+
dist_dir = Buildr.unzip(tmp_path(NAME) => dist_zip)
|
|
160
|
+
|
|
161
|
+
nailgun_jar = file(tmp_path(NAME, NAME, NAME + '.jar'))
|
|
162
|
+
nailgun_jar.enhance [dist_dir] unless File.exist?(nailgun_jar.to_s)
|
|
163
|
+
|
|
164
|
+
attr_reader :artifact
|
|
165
|
+
@artifact = Buildr.artifact(ARTIFACT_SPEC).from(nailgun_jar)
|
|
166
|
+
|
|
167
|
+
compiled_bin = file(tmp_path(NAME, NAME, 'ng' + Config::CONFIG['EXEEXT']) => dist_dir.target) do |task|
|
|
168
|
+
unless task.to_s.pathmap('%x') == '.exe'
|
|
169
|
+
Dir.chdir(task.to_s.pathmap('%d')) do
|
|
170
|
+
info "Compiling #{task.to_s}"
|
|
171
|
+
system('make', task.to_s.pathmap('%f')) or
|
|
172
|
+
fail "Nailgun binary compilation failed."
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
attr_reader :installed_bin
|
|
178
|
+
@installed_bin = file(File.expand_path(compiled_bin.to_s.pathmap('%f'), nailgun_home) => compiled_bin) do |task|
|
|
179
|
+
mkpath task.to_s.pathmap('%d'), :verbose => false
|
|
180
|
+
cp compiled_bin.to_s, task.to_s, :verbose => false
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
task('drb-notice') do
|
|
184
|
+
info ''
|
|
185
|
+
info 'Running in JRuby, a nailgun server will be started so that'
|
|
186
|
+
info 'you can use your nailgun client to invoke buildr tasks: '
|
|
187
|
+
info ''
|
|
188
|
+
info ' '+Nailgun.installed_bin.to_s
|
|
189
|
+
info ''
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
task('drb' => ['drb-notice', 'start'])
|
|
193
|
+
|
|
194
|
+
desc 'Start the nailgun server'
|
|
195
|
+
task('start' => [installed_bin, 'setup']) do |task|
|
|
196
|
+
server = NGServer.new(nil, PORT)
|
|
197
|
+
server.start
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
task('setup' => artifact) do
|
|
201
|
+
module Util
|
|
202
|
+
include Buildr::Util
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
Util.add_to_sysloader artifact.to_s
|
|
206
|
+
Util.add_to_sysloader ADDON_BIN
|
|
207
|
+
|
|
208
|
+
class NGClient
|
|
209
|
+
include org.apache.buildr.BuildrNail
|
|
210
|
+
include Client
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
class NGServer < com.martiansoftware.nailgun.NGServer
|
|
214
|
+
include Server
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
end # ng_tasks
|
|
219
|
+
|
|
220
|
+
end # module Nailgun
|
|
221
|
+
end
|
|
@@ -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
|
+
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
|
+
class << self
|
|
38
|
+
|
|
39
|
+
def enhance(options)
|
|
40
|
+
rake_check_options options, :classpath, :properties, :output
|
|
41
|
+
artifacts = Buildr.artifacts(options[:classpath]).each { |a| a.invoke }.map(&:to_s) + [options[:output].to_s]
|
|
42
|
+
properties = file(options[:properties]).tap { |task| task.invoke }.to_s
|
|
43
|
+
|
|
44
|
+
Buildr.ant "openjpa" do |ant|
|
|
45
|
+
ant.taskdef :name=>"enhancer", :classname=>"org.apache.openjpa.ant.PCEnhancerTask",
|
|
46
|
+
:classpath=>requires.join(File::PATH_SEPARATOR)
|
|
47
|
+
ant.enhancer :directory=>options[:output].to_s do
|
|
48
|
+
ant.config :propertiesFile=>properties
|
|
49
|
+
ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def mapping_tool(options)
|
|
55
|
+
rake_check_options options, :classpath, :properties, :sql, :action
|
|
56
|
+
artifacts = Buildr.artifacts(options[:classpath]).each{ |a| a.invoke }.map(&:to_s)
|
|
57
|
+
properties = file(options[:properties].to_s).tap { |task| task.invoke }.to_s
|
|
58
|
+
|
|
59
|
+
Buildr.ant("openjpa") do |ant|
|
|
60
|
+
ant.taskdef :name=>"mapping", :classname=>"org.apache.openjpa.jdbc.ant.MappingToolTask",
|
|
61
|
+
:classpath=>requires.join(File::PATH_SEPARATOR)
|
|
62
|
+
ant.mapping :schemaAction=>options[:action], :sqlFile=>options[:sql].to_s, :ignoreErrors=>"true" do
|
|
63
|
+
ant.config :propertiesFile=>properties
|
|
64
|
+
ant.classpath :path=>artifacts.join(File::PATH_SEPARATOR)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
private
|
|
70
|
+
|
|
71
|
+
def requires()
|
|
72
|
+
@requires ||= Buildr.artifacts(REQUIRES).each { |artifact| artifact.invoke }.map(&:to_s)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def open_jpa_enhance(options = nil)
|
|
78
|
+
jpa_options = { :output=>compile.target, :classpath=>compile.dependencies,
|
|
79
|
+
:properties=>path_to(:source, :main, :resources, 'META-INF/persistence.xml') }
|
|
80
|
+
OpenJPA.enhance jpa_options.merge(options || {})
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class Project
|
|
86
|
+
include OpenJPA
|
|
87
|
+
end
|
|
88
|
+
end
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
+
*/
|
|
Binary file
|
|
Binary file
|