buildr 1.2.10 → 1.3.0
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 +566 -268
- data/DISCLAIMER +7 -1
- data/KEYS +151 -0
- data/NOTICE +23 -8
- data/README +122 -22
- data/Rakefile +49 -229
- data/{lib → addon}/buildr/antlr.rb +23 -10
- data/addon/buildr/cobertura.rb +232 -0
- data/{lib → addon}/buildr/hibernate.rb +20 -4
- data/{lib → addon}/buildr/javacc.rb +27 -12
- data/addon/buildr/jdepend.rb +60 -0
- data/{lib → addon}/buildr/jetty.rb +34 -18
- data/addon/buildr/nailgun.rb +892 -0
- data/{lib → addon}/buildr/openjpa.rb +23 -6
- 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/{lib/buildr/jetty → addon/buildr/org/apache/buildr}/JettyWrapper.java +19 -0
- data/{lib → addon}/buildr/xmlbeans.rb +39 -14
- data/bin/buildr +21 -7
- data/buildr.gemspec +50 -0
- data/doc/css/default.css +225 -0
- data/doc/css/print.css +95 -0
- data/doc/css/syntax.css +43 -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/note.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +317 -0
- data/doc/pages/building.textile +501 -0
- data/doc/pages/contributing.textile +178 -0
- data/doc/pages/download.textile +25 -0
- data/doc/pages/extending.textile +229 -0
- data/doc/pages/getting_started.textile +337 -0
- data/doc/pages/index.textile +63 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +367 -0
- data/doc/pages/packaging.textile +592 -0
- data/doc/pages/projects.textile +449 -0
- data/doc/pages/recipes.textile +127 -0
- data/doc/pages/settings_profiles.textile +339 -0
- data/doc/pages/testing.textile +475 -0
- data/doc/pages/troubleshooting.textile +121 -0
- data/doc/pages/whats_new.textile +389 -0
- data/doc/print.haml +52 -0
- data/doc/print.toc.yaml +28 -0
- data/doc/scripts/buildr-git.rb +411 -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 +55 -0
- data/doc/site.toc.yaml +44 -0
- data/lib/buildr.rb +28 -45
- data/lib/buildr/core.rb +27 -0
- data/lib/buildr/core/application.rb +373 -0
- data/lib/buildr/core/application_cli.rb +134 -0
- data/lib/{core → buildr/core}/build.rb +91 -77
- data/lib/{core → buildr/core}/checks.rb +116 -95
- data/lib/buildr/core/common.rb +155 -0
- data/lib/buildr/core/compile.rb +594 -0
- data/lib/buildr/core/environment.rb +120 -0
- data/lib/buildr/core/filter.rb +258 -0
- data/lib/{core → buildr/core}/generate.rb +22 -5
- data/lib/buildr/core/help.rb +118 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/{core → buildr/core}/project.rb +468 -213
- data/lib/buildr/core/test.rb +690 -0
- data/lib/{core → buildr/core}/transports.rb +107 -127
- data/lib/buildr/core/util.rb +235 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/{java → buildr/ide}/eclipse.rb +86 -60
- data/lib/{java → buildr/ide}/idea.ipr.template +16 -0
- data/lib/buildr/ide/idea.rb +194 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +210 -0
- data/lib/buildr/java.rb +26 -0
- data/lib/buildr/java/ant.rb +71 -0
- data/lib/buildr/java/bdd_frameworks.rb +267 -0
- data/lib/buildr/java/commands.rb +210 -0
- data/lib/buildr/java/compilers.rb +432 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/groovyc.rb +137 -0
- data/lib/buildr/java/jruby.rb +99 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail.class +0 -0
- data/lib/buildr/java/org/apache/buildr/BuildrNail.java +41 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +116 -0
- data/lib/buildr/java/packaging.rb +706 -0
- data/lib/{java → buildr/java}/pom.rb +20 -4
- data/lib/buildr/java/rjb.rb +142 -0
- data/lib/buildr/java/test_frameworks.rb +290 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +21 -0
- data/lib/{java → buildr/packaging}/artifact.rb +170 -179
- data/lib/buildr/packaging/artifact_namespace.rb +957 -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/{tasks → buildr/packaging}/tar.rb +18 -1
- data/lib/{tasks → buildr/packaging}/zip.rb +153 -105
- data/rakelib/apache.rake +126 -0
- data/rakelib/changelog.rake +56 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +44 -0
- data/rakelib/release.rake +53 -0
- data/rakelib/rspec.rake +81 -0
- data/rakelib/rubyforge.rake +45 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +59 -0
- data/rakelib/stage.rake +45 -0
- data/spec/application_spec.rb +316 -0
- data/spec/archive_spec.rb +494 -0
- data/spec/artifact_namespace_spec.rb +635 -0
- data/spec/artifact_spec.rb +738 -0
- data/spec/build_spec.rb +193 -0
- data/spec/checks_spec.rb +537 -0
- data/spec/common_spec.rb +579 -0
- data/spec/compile_spec.rb +561 -0
- data/spec/groovy_compilers_spec.rb +239 -0
- data/spec/java_bdd_frameworks_spec.rb +238 -0
- data/spec/java_compilers_spec.rb +446 -0
- data/spec/java_packaging_spec.rb +1042 -0
- data/spec/java_test_frameworks_spec.rb +414 -0
- data/spec/packaging_helper.rb +63 -0
- data/spec/packaging_spec.rb +589 -0
- data/spec/project_spec.rb +739 -0
- data/spec/sandbox.rb +116 -0
- data/spec/scala_compilers_spec.rb +239 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helpers.rb +283 -0
- data/spec/test_spec.rb +871 -0
- data/spec/transport_spec.rb +300 -0
- data/spec/version_requirement_spec.rb +115 -0
- metadata +188 -77
- data/lib/buildr/cobertura.rb +0 -89
- data/lib/buildr/jdepend.rb +0 -40
- data/lib/buildr/jetty/JettyWrapper$1.class +0 -0
- data/lib/buildr/jetty/JettyWrapper$BuildrHandler.class +0 -0
- data/lib/buildr/jetty/JettyWrapper.class +0 -0
- data/lib/buildr/scala.rb +0 -368
- data/lib/core/application.rb +0 -188
- data/lib/core/common.rb +0 -562
- data/lib/core/help.rb +0 -72
- data/lib/core/rake_ext.rb +0 -81
- data/lib/java/ant.rb +0 -71
- data/lib/java/compile.rb +0 -589
- data/lib/java/idea.rb +0 -159
- data/lib/java/java.rb +0 -432
- data/lib/java/packaging.rb +0 -581
- data/lib/java/test.rb +0 -795
- data/lib/tasks/concat.rb +0 -35
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
# Portion of this file derived from Rake.
|
|
17
|
+
# Copyright (c) 2003, 2004 Jim Weirich
|
|
18
|
+
#
|
|
19
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
# in the Software without restriction, including without limitation the rights
|
|
22
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
# furnished to do so, subject to the following conditions:
|
|
25
|
+
#
|
|
26
|
+
# The above copyright notice and this permission notice shall be included in
|
|
27
|
+
# all copies or substantial portions of the Software.
|
|
28
|
+
#
|
|
29
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
# SOFTWARE.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
require 'getoptlong'
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
module Buildr
|
|
42
|
+
module CommandLineInterface
|
|
43
|
+
|
|
44
|
+
OPTIONS = [ # :nodoc:
|
|
45
|
+
['--help', '-h', GetoptLong::NO_ARGUMENT,
|
|
46
|
+
'Display this help message.'],
|
|
47
|
+
['--nosearch', '-n', GetoptLong::NO_ARGUMENT,
|
|
48
|
+
'Do not search parent directories for the buildfile.'],
|
|
49
|
+
['--quiet', '-q', GetoptLong::NO_ARGUMENT,
|
|
50
|
+
'Do not log messages to standard output.'],
|
|
51
|
+
['--buildfile', '-f', GetoptLong::REQUIRED_ARGUMENT,
|
|
52
|
+
'Use FILE as the buildfile.'],
|
|
53
|
+
['--require', '-r', GetoptLong::REQUIRED_ARGUMENT,
|
|
54
|
+
'Require MODULE before executing buildfile.'],
|
|
55
|
+
['--trace', '-t', GetoptLong::NO_ARGUMENT,
|
|
56
|
+
'Turn on invoke/execute tracing, enable full backtrace.'],
|
|
57
|
+
['--version', '-v', GetoptLong::NO_ARGUMENT,
|
|
58
|
+
'Display the program version.'],
|
|
59
|
+
['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT,
|
|
60
|
+
'Environment name (e.g. development, test, production).']
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
def collect_tasks
|
|
64
|
+
top_level_tasks.clear
|
|
65
|
+
ARGV.each do |arg|
|
|
66
|
+
if arg =~ /^(\w+)=(.*)$/
|
|
67
|
+
ENV[$1.upcase] = $2
|
|
68
|
+
else
|
|
69
|
+
top_level_tasks << arg
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
top_level_tasks.push("default") if top_level_tasks.size == 0
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def parse_options
|
|
76
|
+
opts = GetoptLong.new(*command_line_options)
|
|
77
|
+
opts.each { |opt, value| do_option(opt, value) }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def do_option(opt, value)
|
|
81
|
+
case opt
|
|
82
|
+
when '--help'
|
|
83
|
+
help
|
|
84
|
+
exit
|
|
85
|
+
when '--buildfile'
|
|
86
|
+
rakefiles.clear
|
|
87
|
+
rakefiles << value
|
|
88
|
+
when '--version'
|
|
89
|
+
puts version
|
|
90
|
+
exit
|
|
91
|
+
when '--environment'
|
|
92
|
+
ENV['BUILDR_ENV'] = value
|
|
93
|
+
when '--require'
|
|
94
|
+
requires << value
|
|
95
|
+
when '--nosearch', '--quiet', '--trace'
|
|
96
|
+
super
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def command_line_options
|
|
101
|
+
OPTIONS.collect { |lst| lst[0..-2] }
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def version
|
|
105
|
+
"Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby '+JRUBY_VERSION+')'}"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def usage
|
|
109
|
+
puts version
|
|
110
|
+
puts
|
|
111
|
+
puts 'Usage:'
|
|
112
|
+
puts ' buildr [options] [tasks] [name=value]'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def help
|
|
116
|
+
usage
|
|
117
|
+
puts
|
|
118
|
+
puts 'Options:'
|
|
119
|
+
OPTIONS.sort.each do |long, short, mode, desc|
|
|
120
|
+
if mode == GetoptLong::REQUIRED_ARGUMENT
|
|
121
|
+
if desc =~ /\b([A-Z]{2,})\b/
|
|
122
|
+
long = long + "=#{$1}"
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
printf " %-20s (%s)\n", long, short
|
|
126
|
+
printf " %s\n", desc
|
|
127
|
+
end
|
|
128
|
+
puts
|
|
129
|
+
puts 'For help with your buildfile:'
|
|
130
|
+
puts ' buildr help'
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end
|
|
134
|
+
end
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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/core/project'
|
|
18
|
+
require 'buildr/core/common'
|
|
19
|
+
require 'buildr/core/checks'
|
|
20
|
+
require 'buildr/core/environment'
|
|
4
21
|
|
|
5
|
-
module Buildr
|
|
6
|
-
|
|
7
|
-
desc "Build the project"
|
|
8
|
-
Project.local_task("build") { |name| "Building #{name}" }
|
|
9
|
-
desc "Clean files generated during a build"
|
|
10
|
-
Project.local_task("clean") { |name| "Cleaning #{name}" }
|
|
11
|
-
desc "Create packages"
|
|
12
|
-
Project.local_task("package"=>"build") { |name| "Packaging #{name}" }
|
|
13
|
-
desc "Install packages created by the project"
|
|
14
|
-
Project.local_task("install"=>"package") { |name| "Installing packages from #{name}" }
|
|
15
|
-
desc "Remove previously installed packages"
|
|
16
|
-
Project.local_task("uninstall") { |name| "Uninstalling packages from #{name}" }
|
|
17
|
-
desc "Upload packages created by the project"
|
|
18
|
-
Project.local_task("upload"=>"package") { |name| "Deploying packages from #{name}" }
|
|
19
|
-
|
|
20
|
-
[ :build, :clean, :package, :install, :uninstall, :upload ].each do |name|
|
|
21
|
-
Project.on_define { |project| project.recursive_task name }
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
task("deploy"=>"upload") do
|
|
25
|
-
warn_deprecated "Please use the 'upload' task instead of 'deploy'."
|
|
26
|
-
end
|
|
27
22
|
|
|
23
|
+
module Buildr
|
|
28
24
|
|
|
29
25
|
class Options
|
|
30
26
|
|
|
@@ -39,31 +35,57 @@ module Buildr
|
|
|
39
35
|
|
|
40
36
|
end
|
|
41
37
|
|
|
42
|
-
task(
|
|
38
|
+
task('parallel') { Buildr.options.parallel = true }
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
module Build
|
|
42
|
+
|
|
43
|
+
include Extension
|
|
44
|
+
|
|
45
|
+
first_time do
|
|
46
|
+
desc 'Build the project'
|
|
47
|
+
Project.local_task('build') { |name| "Building #{name}" }
|
|
48
|
+
desc 'Clean files generated during a build'
|
|
49
|
+
Project.local_task('clean') { |name| "Cleaning #{name}" }
|
|
50
|
+
|
|
51
|
+
desc 'The default task it build'
|
|
52
|
+
task 'default'=>'build'
|
|
53
|
+
end
|
|
43
54
|
|
|
55
|
+
before_define do |project|
|
|
56
|
+
project.recursive_task 'build'
|
|
57
|
+
project.recursive_task 'clean'
|
|
58
|
+
project.clean do
|
|
59
|
+
verbose(true) do
|
|
60
|
+
rm_rf project.path_to(:target)
|
|
61
|
+
rm_rf project.path_to(:reports)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
44
65
|
|
|
45
|
-
class Project
|
|
46
66
|
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@target ||= _("target")
|
|
67
|
+
# *Deprecated:* Use +path_to(:target)+ instead.
|
|
68
|
+
def target
|
|
69
|
+
Buildr.application.deprecated 'Use path_to(:target) instead'
|
|
70
|
+
layout.expand(:target)
|
|
52
71
|
end
|
|
53
72
|
|
|
73
|
+
# *Deprecated:* Use Layout instead.
|
|
54
74
|
def target=(dir)
|
|
55
|
-
|
|
75
|
+
Buildr.application.deprecated 'Use Layout instead'
|
|
76
|
+
layout[:target] = _(dir)
|
|
56
77
|
end
|
|
57
78
|
|
|
58
|
-
#
|
|
59
|
-
# use it to determine where to place reports, e.g. when running test cases or code analysis.
|
|
60
|
-
# The clean task nukes it.
|
|
79
|
+
# *Deprecated:* Use +path_to(:reports)+ instead.
|
|
61
80
|
def reports()
|
|
62
|
-
|
|
81
|
+
Buildr.application.deprecated 'Use path_to(:reports) instead'
|
|
82
|
+
layout.expand(:reports)
|
|
63
83
|
end
|
|
64
84
|
|
|
85
|
+
# *Deprecated:* Use Layout instead.
|
|
65
86
|
def reports=(dir)
|
|
66
|
-
|
|
87
|
+
Buildr.application.deprecated 'Use Layout instead'
|
|
88
|
+
layout[:reports] = _(dir)
|
|
67
89
|
end
|
|
68
90
|
|
|
69
91
|
# :call-seq:
|
|
@@ -72,7 +94,7 @@ module Buildr
|
|
|
72
94
|
#
|
|
73
95
|
# Returns the project's build task. With arguments or block, also enhances that task.
|
|
74
96
|
def build(*prereqs, &block)
|
|
75
|
-
task(
|
|
97
|
+
task('build').enhance prereqs, &block
|
|
76
98
|
end
|
|
77
99
|
|
|
78
100
|
# :call-seq:
|
|
@@ -81,25 +103,12 @@ module Buildr
|
|
|
81
103
|
#
|
|
82
104
|
# Returns the project's clean task. With arguments or block, also enhances that task.
|
|
83
105
|
def clean(*prereqs, &block)
|
|
84
|
-
task(
|
|
106
|
+
task('clean').enhance prereqs, &block
|
|
85
107
|
end
|
|
86
108
|
|
|
87
109
|
end
|
|
88
110
|
|
|
89
111
|
|
|
90
|
-
Project.on_define do |project|
|
|
91
|
-
project.clean do
|
|
92
|
-
verbose(true) do
|
|
93
|
-
rm_rf project.path_to(:target)
|
|
94
|
-
rm_rf project.path_to(:reports)
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
desc "The default task it build"
|
|
100
|
-
task "default"=>"build"
|
|
101
|
-
|
|
102
|
-
|
|
103
112
|
class Release
|
|
104
113
|
|
|
105
114
|
THIS_VERSION_PATTERN = /THIS_VERSION|VERSION_NUMBER\s*=\s*(["'])(.*)\1/
|
|
@@ -119,13 +128,13 @@ module Buildr
|
|
|
119
128
|
sh "#{command} clean upload #{options.join(' ')}"
|
|
120
129
|
end
|
|
121
130
|
tag version
|
|
122
|
-
commit version +
|
|
131
|
+
commit version + '-SNAPSHOT'
|
|
123
132
|
end
|
|
124
133
|
|
|
125
134
|
protected
|
|
126
135
|
|
|
127
136
|
def command() #:nodoc:
|
|
128
|
-
Config::CONFIG[
|
|
137
|
+
Config::CONFIG['arch'] =~ /dos|win32/i ? $PROGRAM_NAME.ext('cmd') : $PROGRAM_NAME
|
|
129
138
|
end
|
|
130
139
|
|
|
131
140
|
# :call-seq:
|
|
@@ -136,7 +145,7 @@ module Buildr
|
|
|
136
145
|
def check()
|
|
137
146
|
fail "SVN URL must end with 'trunk' or 'branches/...'" unless svn_url =~ /(trunk)|(branches.*)$/
|
|
138
147
|
# Status check reveals modified file, but also SVN externals which we can safely ignore.
|
|
139
|
-
status = svn(
|
|
148
|
+
status = svn('status', '--ignore-externals').reject { |line| line =~ /^X\s/ }
|
|
140
149
|
fail "Uncommitted SVN files violate the First Principle Of Release!\n#{status}" unless
|
|
141
150
|
status.empty?
|
|
142
151
|
end
|
|
@@ -161,20 +170,20 @@ module Buildr
|
|
|
161
170
|
# NEXT_VERSION = 1.2.1
|
|
162
171
|
# and the method will return 1.2.0.
|
|
163
172
|
def with_next_version()
|
|
164
|
-
new_filename =
|
|
173
|
+
new_filename = Buildr.application.buildfile + '.next'
|
|
165
174
|
modified = change_version do |this_version, next_version|
|
|
166
|
-
one_after = next_version.split(
|
|
175
|
+
one_after = next_version.split('.')
|
|
167
176
|
one_after[-1] = one_after[-1].to_i + 1
|
|
168
|
-
[ next_version, one_after.join(
|
|
177
|
+
[ next_version, one_after.join('.') ]
|
|
169
178
|
end
|
|
170
|
-
File.open(new_filename,
|
|
179
|
+
File.open(new_filename, 'w') { |file| file.write modified }
|
|
171
180
|
begin
|
|
172
181
|
yield new_filename
|
|
173
|
-
mv new_filename,
|
|
182
|
+
mv new_filename, Buildr.application.buildfile
|
|
174
183
|
ensure
|
|
175
184
|
rm new_filename rescue nil
|
|
176
185
|
end
|
|
177
|
-
File.read(
|
|
186
|
+
File.read(Buildr.application.buildfile).scan(THIS_VERSION_PATTERN)[0][1]
|
|
178
187
|
end
|
|
179
188
|
|
|
180
189
|
# :call-seq:
|
|
@@ -186,18 +195,18 @@ module Buildr
|
|
|
186
195
|
# This method yields to the block with the current (this) and next version numbers and expects
|
|
187
196
|
# an array with the new this and next version numbers.
|
|
188
197
|
def change_version()
|
|
189
|
-
|
|
190
|
-
this_version =
|
|
198
|
+
buildfile = File.read(Buildr.application.buildfile)
|
|
199
|
+
this_version = buildfile.scan(THIS_VERSION_PATTERN)[0][1] or
|
|
191
200
|
fail "Looking for THIS_VERSION = \"...\" in your Buildfile, none found"
|
|
192
|
-
next_version =
|
|
201
|
+
next_version = buildfile.scan(NEXT_VERSION_PATTERN)[0][1] or
|
|
193
202
|
fail "Looking for NEXT_VERSION = \"...\" in your Buildfile, none found"
|
|
194
203
|
this_version, next_version = yield(this_version, next_version)
|
|
195
204
|
if verbose
|
|
196
|
-
puts
|
|
205
|
+
puts 'Upgrading version numbers:'
|
|
197
206
|
puts " This: #{this_version}"
|
|
198
207
|
puts " Next: #{next_version}"
|
|
199
208
|
end
|
|
200
|
-
|
|
209
|
+
buildfile.gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/, %Q{"#{this_version}"}) }.
|
|
201
210
|
gsub(NEXT_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/, %Q{"#{next_version}"}) }
|
|
202
211
|
end
|
|
203
212
|
|
|
@@ -207,8 +216,8 @@ module Buildr
|
|
|
207
216
|
# Tags the current working copy with the release version number.
|
|
208
217
|
def tag(version)
|
|
209
218
|
url = svn_url.sub(/(trunk$)|(branches.*)$/, "tags/#{version}")
|
|
210
|
-
svn
|
|
211
|
-
svn
|
|
219
|
+
svn 'remove', url, '-m', 'Removing old copy' rescue nil
|
|
220
|
+
svn 'copy', Dir.pwd, url, '-m', "Release #{version}"
|
|
212
221
|
end
|
|
213
222
|
|
|
214
223
|
# :call-seq:
|
|
@@ -216,10 +225,10 @@ module Buildr
|
|
|
216
225
|
#
|
|
217
226
|
# Last, we commit what we currently have in the working copy.
|
|
218
227
|
def commit(version)
|
|
219
|
-
|
|
228
|
+
buildfile = File.read(Buildr.application.buildfile).
|
|
220
229
|
gsub(THIS_VERSION_PATTERN) { |ver| ver.sub(/(["']).*\1/, %Q{"#{version}"}) }
|
|
221
|
-
File.open(
|
|
222
|
-
svn
|
|
230
|
+
File.open(Buildr.application.buildfile, 'w') { |file| file.write buildfile }
|
|
231
|
+
svn 'commit', '-m', "Changed version number to #{version}", Buildr.application.buildfile
|
|
223
232
|
end
|
|
224
233
|
|
|
225
234
|
# :call-seq:
|
|
@@ -227,22 +236,27 @@ module Buildr
|
|
|
227
236
|
#
|
|
228
237
|
# Executes SVN command and returns the output.
|
|
229
238
|
def svn(*args)
|
|
230
|
-
cmd =
|
|
239
|
+
cmd = 'svn ' + args.map { |arg| arg[' '] ? %Q{"#{arg}"} : arg }.join(' ')
|
|
231
240
|
puts cmd if verbose
|
|
232
|
-
`#{cmd}`.tap { fail
|
|
241
|
+
`#{cmd}`.tap { fail 'SVN command failed' unless $?.exitstatus == 0 }
|
|
233
242
|
end
|
|
234
243
|
|
|
235
244
|
# Return the current SVN URL
|
|
236
245
|
def svn_url
|
|
237
|
-
url = svn(
|
|
246
|
+
url = svn('info').scan(/URL: (.*)/)[0][0]
|
|
238
247
|
end
|
|
239
248
|
end
|
|
240
249
|
|
|
241
250
|
end
|
|
242
251
|
|
|
243
|
-
desc
|
|
244
|
-
task
|
|
252
|
+
desc 'Make a release'
|
|
253
|
+
task 'release' do |task|
|
|
245
254
|
Release.make
|
|
246
255
|
end
|
|
247
256
|
|
|
248
257
|
end
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class Buildr::Project
|
|
261
|
+
include Buildr::Build
|
|
262
|
+
end
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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/core/project'
|
|
18
|
+
require 'buildr/packaging/zip'
|
|
19
|
+
require 'test/unit'
|
|
20
|
+
require 'spec/matchers'
|
|
21
|
+
require 'spec/expectations'
|
|
4
22
|
|
|
5
|
-
module Buildr
|
|
6
23
|
|
|
7
|
-
|
|
24
|
+
module Buildr
|
|
25
|
+
# Methods added to Project to allow checking the build.
|
|
26
|
+
module Checks
|
|
8
27
|
|
|
9
|
-
module Matchers
|
|
28
|
+
module Matchers #:nodoc:
|
|
10
29
|
|
|
11
30
|
class << self
|
|
12
31
|
|
|
@@ -111,7 +130,7 @@ module Buildr
|
|
|
111
130
|
# Run the expectation. We only print the expectation name when tracing (to know they all ran),
|
|
112
131
|
# or when we get a failure.
|
|
113
132
|
begin
|
|
114
|
-
puts description if
|
|
133
|
+
puts description if Buildr.application.options.trace
|
|
115
134
|
klass.new.instance_eval &@block
|
|
116
135
|
rescue Exception=>error
|
|
117
136
|
raise error.exception("#{description}\n#{error}").tap { |wrapped| wrapped.set_backtrace(error.backtrace) }
|
|
@@ -120,10 +139,31 @@ module Buildr
|
|
|
120
139
|
|
|
121
140
|
end
|
|
122
141
|
|
|
123
|
-
end
|
|
124
142
|
|
|
143
|
+
include Extension
|
|
144
|
+
|
|
145
|
+
before_define do |project|
|
|
146
|
+
# The check task can do any sort of interesting things, but the most important is running expectations.
|
|
147
|
+
project.task("check") do |task|
|
|
148
|
+
project.expectations.inject(true) do |passed, expect|
|
|
149
|
+
begin
|
|
150
|
+
expect.run_against project
|
|
151
|
+
passed
|
|
152
|
+
rescue Exception=>error
|
|
153
|
+
if verbose
|
|
154
|
+
puts error.backtrace.detect { |line| line =~ /#{Buildr.application.buildfile}/ } || ""
|
|
155
|
+
puts error
|
|
156
|
+
end
|
|
157
|
+
false
|
|
158
|
+
end
|
|
159
|
+
end or fail "Checks failed for project #{project.name} (see errors above)."
|
|
160
|
+
end
|
|
161
|
+
project.task("package").enhance do |task|
|
|
162
|
+
# Run all actions before checks.
|
|
163
|
+
task.enhance { project.task("check").invoke }
|
|
164
|
+
end
|
|
165
|
+
end
|
|
125
166
|
|
|
126
|
-
class Project
|
|
127
167
|
|
|
128
168
|
# :call-seq:
|
|
129
169
|
# check(description) { ... }
|
|
@@ -154,7 +194,7 @@ module Buildr
|
|
|
154
194
|
# During development you can write placeholder expectations by omitting the block. This will simply report
|
|
155
195
|
# the expectation as pending.
|
|
156
196
|
def check(*args, &block)
|
|
157
|
-
expectations <<
|
|
197
|
+
expectations << Checks::Expectation.new(*args, &block)
|
|
158
198
|
end
|
|
159
199
|
|
|
160
200
|
# :call-seq:
|
|
@@ -167,28 +207,6 @@ module Buildr
|
|
|
167
207
|
|
|
168
208
|
end
|
|
169
209
|
|
|
170
|
-
Project.on_define do |project|
|
|
171
|
-
# The check task can do any sort of interesting things, but the most important is running expectations.
|
|
172
|
-
project.task("check") do |task|
|
|
173
|
-
project.expectations.inject(true) do |passed, expect|
|
|
174
|
-
begin
|
|
175
|
-
expect.run_against project
|
|
176
|
-
passed
|
|
177
|
-
rescue Exception=>error
|
|
178
|
-
if verbose
|
|
179
|
-
puts error.backtrace.detect { |line| line =~ /#{Rake.application.rakefile}/ } || ""
|
|
180
|
-
puts error
|
|
181
|
-
end
|
|
182
|
-
false
|
|
183
|
-
end
|
|
184
|
-
end or fail "Checks failed for project #{project.name} (see errors above)."
|
|
185
|
-
end
|
|
186
|
-
project.task("package").enhance do |task|
|
|
187
|
-
# Run all actions before checks.
|
|
188
|
-
task.enhance { project.task("check").invoke }
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
210
|
end
|
|
193
211
|
|
|
194
212
|
|
|
@@ -268,94 +286,97 @@ module Zip #:nodoc:
|
|
|
268
286
|
end
|
|
269
287
|
|
|
270
288
|
|
|
271
|
-
|
|
272
|
-
class ArchiveTask
|
|
273
|
-
|
|
274
|
-
class Path
|
|
275
|
-
|
|
276
|
-
# :call-seq:
|
|
277
|
-
# exist() => boolean
|
|
278
|
-
#
|
|
279
|
-
# Returns true if this path exists. This only works if the path has any entries in it,
|
|
280
|
-
# so exist on path happens to be the opposite of empty.
|
|
281
|
-
def exist?()
|
|
282
|
-
!entries.empty?
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
# :call-seq:
|
|
286
|
-
# empty?() => boolean
|
|
287
|
-
#
|
|
288
|
-
# Returns true if this path is empty (has no other entries inside).
|
|
289
|
-
def empty?()
|
|
290
|
-
entries.all? { |entry| entry.empty? }
|
|
291
|
-
end
|
|
292
|
-
|
|
293
|
-
# :call-seq:
|
|
294
|
-
# contain(file*) => boolean
|
|
295
|
-
#
|
|
296
|
-
# Returns true if this ZIP file path contains all the specified files. You can use relative
|
|
297
|
-
# file names and glob patterns (using *, **, etc).
|
|
298
|
-
def contain?(*files)
|
|
299
|
-
files.all? { |file| entries.detect { |entry| File.fnmatch(file, entry.to_s) } }
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
# :call-seq:
|
|
303
|
-
# entry(name) => ZipEntry
|
|
304
|
-
#
|
|
305
|
-
# Returns a ZIP file entry. You can use this to check if the entry exists and its contents,
|
|
306
|
-
# for example:
|
|
307
|
-
# package(:jar).path("META-INF").entry("LICENSE").should contain(/Apache Software License/)
|
|
308
|
-
def entry(name)
|
|
309
|
-
root.entry("#{@path}#{name}")
|
|
310
|
-
end
|
|
311
|
-
|
|
312
|
-
protected
|
|
289
|
+
class Buildr::ArchiveTask
|
|
313
290
|
|
|
314
|
-
|
|
315
|
-
return root.entries unless @path
|
|
316
|
-
@entries ||= root.entries.inject([]) { |selected, entry|
|
|
317
|
-
selected << entry.name.sub(@path, "") if entry.name.starts_with?(@path)
|
|
318
|
-
selected
|
|
319
|
-
}
|
|
320
|
-
end
|
|
291
|
+
class Path #:nodoc:
|
|
321
292
|
|
|
293
|
+
# :call-seq:
|
|
294
|
+
# exist() => boolean
|
|
295
|
+
#
|
|
296
|
+
# Returns true if this path exists. This only works if the path has any entries in it,
|
|
297
|
+
# so exist on path happens to be the opposite of empty.
|
|
298
|
+
def exist?()
|
|
299
|
+
!entries.empty?
|
|
322
300
|
end
|
|
323
301
|
|
|
324
302
|
# :call-seq:
|
|
325
303
|
# empty?() => boolean
|
|
326
304
|
#
|
|
327
|
-
# Returns true if this
|
|
305
|
+
# Returns true if this path is empty (has no other entries inside).
|
|
328
306
|
def empty?()
|
|
329
|
-
|
|
307
|
+
entries.all? { |entry| entry.empty? }
|
|
330
308
|
end
|
|
331
309
|
|
|
332
310
|
# :call-seq:
|
|
333
311
|
# contain(file*) => boolean
|
|
334
312
|
#
|
|
335
|
-
# Returns true if this ZIP file contains all the specified files. You can use
|
|
313
|
+
# Returns true if this ZIP file path contains all the specified files. You can use relative
|
|
336
314
|
# file names and glob patterns (using *, **, etc).
|
|
337
315
|
def contain?(*files)
|
|
338
|
-
|
|
316
|
+
files.all? { |file| entries.detect { |entry| File.fnmatch(file, entry.to_s, File::FNM_PATHNAME) } }
|
|
339
317
|
end
|
|
340
318
|
|
|
341
|
-
end
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
class ZipTask
|
|
345
|
-
|
|
346
319
|
# :call-seq:
|
|
347
|
-
# entry(name) =>
|
|
320
|
+
# entry(name) => ZipEntry
|
|
348
321
|
#
|
|
349
322
|
# Returns a ZIP file entry. You can use this to check if the entry exists and its contents,
|
|
350
323
|
# for example:
|
|
351
|
-
# package(:jar).
|
|
352
|
-
def entry(
|
|
353
|
-
|
|
324
|
+
# package(:jar).path("META-INF").entry("LICENSE").should contain(/Apache Software License/)
|
|
325
|
+
def entry(name)
|
|
326
|
+
root.entry("#{@path}#{name}")
|
|
354
327
|
end
|
|
355
328
|
|
|
329
|
+
protected
|
|
330
|
+
|
|
356
331
|
def entries() #:nodoc:
|
|
357
|
-
|
|
332
|
+
return root.entries unless @path
|
|
333
|
+
@entries ||= root.entries.inject([]) { |selected, entry|
|
|
334
|
+
selected << entry.name.sub(@path, "") if entry.name.index(@path) == 0
|
|
335
|
+
selected
|
|
336
|
+
}
|
|
358
337
|
end
|
|
359
338
|
|
|
360
339
|
end
|
|
340
|
+
|
|
341
|
+
# :call-seq:
|
|
342
|
+
# empty?() => boolean
|
|
343
|
+
#
|
|
344
|
+
# Returns true if this ZIP file is empty (has no other entries inside).
|
|
345
|
+
def empty?()
|
|
346
|
+
path("").empty
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# :call-seq:
|
|
350
|
+
# contain(file*) => boolean
|
|
351
|
+
#
|
|
352
|
+
# Returns true if this ZIP file contains all the specified files. You can use absolute
|
|
353
|
+
# file names and glob patterns (using *, **, etc).
|
|
354
|
+
def contain?(*files)
|
|
355
|
+
path("").contain?(*files)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
class Buildr::ZipTask #:nodoc:
|
|
362
|
+
|
|
363
|
+
# :call-seq:
|
|
364
|
+
# entry(name) => Entry
|
|
365
|
+
#
|
|
366
|
+
# Returns a ZIP file entry. You can use this to check if the entry exists and its contents,
|
|
367
|
+
# for example:
|
|
368
|
+
# package(:jar).entry("META-INF/LICENSE").should contain(/Apache Software License/)
|
|
369
|
+
def entry(entry_name)
|
|
370
|
+
::Zip::ZipEntry.new(name, entry_name)
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
def entries() #:nodoc:
|
|
374
|
+
@entries ||= Zip::ZipFile.open(name) { |zip| zip.entries }
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class Buildr::Project
|
|
381
|
+
include Buildr::Checks
|
|
361
382
|
end
|