mguymon-buildr 1.4.5-java
Sign up to get free protection for your applications and to get access to all the features.
- 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,117 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Releasing
|
4
|
+
---
|
5
|
+
|
6
|
+
Now that we built and tested our awesome software, let's tell the world and release it.
|
7
|
+
|
8
|
+
Each buildfile can specify the current version with a constant named @VERSION_NUMBER@ or @THIS_VERSION@.
|
9
|
+
|
10
|
+
{% highlight ruby %}
|
11
|
+
THIS_VERSION = "1.0.0-SNAPSHOT"
|
12
|
+
|
13
|
+
define 'killer-app' do
|
14
|
+
|
15
|
+
project.version = THIS_VERSION
|
16
|
+
|
17
|
+
# ...
|
18
|
+
end
|
19
|
+
{% endhighlight %}
|
20
|
+
|
21
|
+
|
22
|
+
h2(#default). What does a release do?
|
23
|
+
|
24
|
+
The default behavior of the @Release@ task is the following:
|
25
|
+
# Check that the version to be released and the next version are different
|
26
|
+
# Check that the project is being tracked by Git or Subversion
|
27
|
+
# Package, test and deploy the artifacts using @THIS_VERSION@ value minus the @-SNAPSHOT@ suffix (if any)
|
28
|
+
# Tag the repository with the released version number
|
29
|
+
# Update the value of @THIS_VERSION@ in the buildfile with the next version number
|
30
|
+
|
31
|
+
Buildr will increment the last digit of the 3-digit versioni number if @THIS_VERSION@ ends with @-SNAPSHOT@.
|
32
|
+
So, at the end of a release, the buildfile now looks like this:
|
33
|
+
|
34
|
+
{% highlight ruby %}
|
35
|
+
THIS_VERSION = "1.0.1-SNAPSHOT"
|
36
|
+
|
37
|
+
define 'killer-app' do
|
38
|
+
|
39
|
+
project.version = THIS_VERSION
|
40
|
+
|
41
|
+
# ...
|
42
|
+
end
|
43
|
+
{% endhighlight %}
|
44
|
+
|
45
|
+
And the Git repository now contains two new commits and a new tag.
|
46
|
+
|
47
|
+
{% highlight sh %}
|
48
|
+
~/w/killer-app[master]$git ol -4
|
49
|
+
c1af3d5 (HEAD, origin/master, master) Changed version number to 1.0.1-SNAPSHOT
|
50
|
+
dd35015 (tag: 1.0.0) Changed version number to 1.0.0
|
51
|
+
76c96e7 Last fix before the release
|
52
|
+
{% endhighlight %}
|
53
|
+
|
54
|
+
|
55
|
+
h2(#custom_version). How to specify my own version number scheme?
|
56
|
+
|
57
|
+
If @THIS_VERSION@ does not contain @-SNAPSHOT@, Buildr delegates the resolution of the next version number to the user which has 2 differents ways to express her wishes: @Release.next_version@ or the environment variable @NEXT_VERSION@.
|
58
|
+
|
59
|
+
h3(#next_version_proc). Using Release.next_version
|
60
|
+
|
61
|
+
The @Release@ class can receive the next version of the buildfile. This could be a string or a proc that would receive the current version and return the next version.
|
62
|
+
|
63
|
+
{% highlight ruby %}
|
64
|
+
THIS_VERSION = "1.0.0-SNAPSHOT"
|
65
|
+
|
66
|
+
# a string
|
67
|
+
Release.next_version = "2.0.0-SNAPSHOT"
|
68
|
+
|
69
|
+
# or a proc
|
70
|
+
Release.next_version = lambda do |this_version| # 1.0.0-SNAPSHOT
|
71
|
+
new_version = @THIS_VERSION@.split(/\./)
|
72
|
+
new_version[0] = new_version[0] + 1
|
73
|
+
new_version
|
74
|
+
end
|
75
|
+
|
76
|
+
define 'killer-app' do
|
77
|
+
|
78
|
+
project.version = THIS_VERSION
|
79
|
+
|
80
|
+
# ...
|
81
|
+
end
|
82
|
+
{% endhighlight %}
|
83
|
+
|
84
|
+
|
85
|
+
h3(#next_version_envvar). Using the environment variable NEXT_VERSION
|
86
|
+
|
87
|
+
If the environment variable @NEXT_VERSION@ is set, Buildr will use this value to update @THIS_VERSION@ at the end of the release.
|
88
|
+
|
89
|
+
For conveniency, this variable is case insensitive.
|
90
|
+
|
91
|
+
So, all 3 following commands will run a release with a custom new version:
|
92
|
+
|
93
|
+
{% highlight sh %}
|
94
|
+
$ buildr release next_version="1.0.0-rc1"
|
95
|
+
$ env next_version="1.0.0-rc1" buildr release
|
96
|
+
$ env NEXT_VERSION="1.0.0-rc1" buildr release
|
97
|
+
{% endhighlight %}
|
98
|
+
|
99
|
+
Those commands will generate the Buildfile below:
|
100
|
+
|
101
|
+
{% highlight ruby %}
|
102
|
+
THIS_VERSION = "1.0.0-rc1"
|
103
|
+
|
104
|
+
define 'killer-app' do
|
105
|
+
|
106
|
+
project.version = THIS_VERSION
|
107
|
+
|
108
|
+
# ...
|
109
|
+
end
|
110
|
+
{% endhighlight %}
|
111
|
+
|
112
|
+
The environment variable @NEXT_VERSION@ has precedence over Release.next_version.
|
113
|
+
|
114
|
+
h2(#custom_tag_and_msg). How to specify my own tag name and commit message?
|
115
|
+
|
116
|
+
As explained earlier, Buildr will create two new commits and a new tag in the version control system. Similarly to @Release.next_version@, the commit message and the tag name can be customized with @Release.message@ and @Release.tag_name@. Both could be strings or procs that would receive the released version @THIS_VERSION@ without @-SNAPSHOT@.
|
117
|
+
|
@@ -0,0 +1,512 @@
|
|
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
|
+
|
18
|
+
# This script helps buildr developers to obtain their own git clone from
|
19
|
+
# github, and also provides GitFlow commands to keep the git mirror in sync
|
20
|
+
# with Apache SVN.
|
21
|
+
#
|
22
|
+
# If you already have a buildr clone, just do the following:
|
23
|
+
#
|
24
|
+
# git config alias.apache '!'"ruby $PWD/doc/scripts/buildr-git.rb"
|
25
|
+
#
|
26
|
+
# After this, you have a 'git apache' command and you can try (be sure to read the help)
|
27
|
+
#
|
28
|
+
# git apache help
|
29
|
+
# git apache setup svn --help
|
30
|
+
# git apache sync --help
|
31
|
+
#
|
32
|
+
# To configure your local repo for svn synchronization,
|
33
|
+
#
|
34
|
+
# git apache update-authors
|
35
|
+
# git remote add upstream git@github.com:buildr/buildr.git
|
36
|
+
# git apache setup svn --username apacheLogin --apache-git upstream
|
37
|
+
# git apache sync
|
38
|
+
#
|
39
|
+
# This script can also be run without having a local buildr clone:
|
40
|
+
#
|
41
|
+
# ruby -ropen-uri -e 'eval(open("http://svn.apache.org/viewvc/buildr/trunk/doc/scripts/buildr-git.rb?view=co").read)' help
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
require 'yaml'
|
46
|
+
require 'open-uri'
|
47
|
+
|
48
|
+
if $0 == '-e' # invoked from open-uri
|
49
|
+
gitflow = "http://svn.apache.org/viewvc/buildr/trunk/doc/scripts/gitflow.rb?view=co"
|
50
|
+
eval(open(gitflow).read)
|
51
|
+
else
|
52
|
+
require File.expand_path('gitflow', File.dirname(__FILE__))
|
53
|
+
end
|
54
|
+
|
55
|
+
GitFlow.program = 'buildr-git'
|
56
|
+
|
57
|
+
module BuildrGit
|
58
|
+
|
59
|
+
class UpdateUsersCommand < GitFlow/'update-users'
|
60
|
+
|
61
|
+
@help = "Update list of Apache SVN committers from Jukka's list."
|
62
|
+
@@url = 'http://people.apache.org/~jukka/authors.txt'
|
63
|
+
|
64
|
+
def self.authors_file
|
65
|
+
File.expand_path('.git/authors.txt', Dir.pwd)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.user_email(apache_login, authors_file = nil)
|
69
|
+
authors_file ||= self.authors_file
|
70
|
+
authors = YAML.load(File.read(authors_file).gsub!(/\s+=\s+/, ': '))
|
71
|
+
contact = authors[apache_login]
|
72
|
+
fail "You are not listed as apache commiter on #{authors_file}" unless contact
|
73
|
+
fail "Not a valid contact line: #{contact}" unless contact =~ /\s+<(.*)>/
|
74
|
+
[$`, $1]
|
75
|
+
end
|
76
|
+
|
77
|
+
def options(opts)
|
78
|
+
opts.url = @@url
|
79
|
+
opts.file = self.class.authors_file
|
80
|
+
[['-u', '--url URL',
|
81
|
+
"From URL. defaults to: #{opts.url}", lambda { |url|
|
82
|
+
opts.url = url
|
83
|
+
}],
|
84
|
+
['-f', '--file FILE',
|
85
|
+
"Write to FILE, defaults to #{opts.file}", lambda { |path|
|
86
|
+
opts.file = path
|
87
|
+
}]
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
def execute(opts, argv)
|
92
|
+
FileUtils.mkdir_p(File.dirname(opts.file))
|
93
|
+
content = open(opts.url).read
|
94
|
+
File.open(opts.file, "w") { |f| f.print content }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class CloneCommand < GitFlow/:clone
|
99
|
+
@help = "Create a clone from github.com/buildr repository."
|
100
|
+
|
101
|
+
def options(opts)
|
102
|
+
opts.origin = 'git://github.com/buildr/buildr.git'
|
103
|
+
opts.svn_prefix = 'apache'
|
104
|
+
opts.project = 'buildr'
|
105
|
+
opts.local = expand_path(opts.project)
|
106
|
+
[['--prefix SVN_PREFIX', opts.svn_prefix, lambda { |p|
|
107
|
+
opts.svn_prefix = p }],
|
108
|
+
['--origin GIT_ORIGIN', opts.origin, lambda { |o|
|
109
|
+
opts.origin = o }],
|
110
|
+
['-d', '--dir DIR', opts.local, lambda { |d| opts.local = d }]
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
def execute(opts, argv)
|
115
|
+
git 'clone', opts.origin, opts.local
|
116
|
+
Dir.chdir(opts.local) do
|
117
|
+
run 'update-users'
|
118
|
+
run 'setup'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
class SetupCommand < GitFlow/:setup
|
124
|
+
@help = "Setup your buildr clone to be used with git mirror."
|
125
|
+
def options(opt)
|
126
|
+
[]
|
127
|
+
end
|
128
|
+
|
129
|
+
def execute(opt, argv)
|
130
|
+
run 'setup', 'alias'
|
131
|
+
run 'setup', 'svn'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class SetupAliasCommand < SetupCommand/:alias
|
136
|
+
def execute(opt, argv)
|
137
|
+
me = expand_path('doc/scripts/buildr-git.rb')
|
138
|
+
git 'config', 'alias.apache', "!ruby #{me}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class SetupSvnCommand < SetupCommand/:svn
|
143
|
+
@help = "Setup for getting changes from Apache SVN."
|
144
|
+
|
145
|
+
def options(opt)
|
146
|
+
opt.svn_prefix = 'apache'
|
147
|
+
opt.svn_path = 'buildr'
|
148
|
+
opt.townhall = 'origin'
|
149
|
+
[['--username SVN_USER', 'Use Apache svn username for this svn remote',
|
150
|
+
lambda { |e| opt.apache_login = e }],
|
151
|
+
['--svn-prefix PREFIX', 'The name of svn remote to use for project.',
|
152
|
+
"Defaults to #{opt.svn_prefix}",
|
153
|
+
lambda{|p| opt.svn_prefix = p }],
|
154
|
+
['--svn-uri URI', lambda {|p| opt.svn_uri = p }],
|
155
|
+
['--svn-rev REVISION', lambda {|p| opt.svn_rev = p }],
|
156
|
+
['--svn-path PATH', 'The path to append to svn-uri.',
|
157
|
+
"Defaults to #{opt.svn_path}", lambda {|p| opt.svn_path = p }],
|
158
|
+
['--apache-git REMOTE', 'The name of remote you are using as town-hall git repo.',
|
159
|
+
"Defaults to #{opt.townhall}",
|
160
|
+
lambda {|p| opt.townhall = p }]
|
161
|
+
]
|
162
|
+
end
|
163
|
+
|
164
|
+
def execute(opt, argv)
|
165
|
+
authors_file = UpdateUsersCommand.authors_file
|
166
|
+
git 'config', 'svn.authorsfile', authors_file
|
167
|
+
git 'config', 'apache.svn', opt.svn_prefix
|
168
|
+
git 'config', 'apache.git', opt.townhall
|
169
|
+
|
170
|
+
if opt.apache_login
|
171
|
+
user, email = UpdateUsersCommand.user_email(opt.apache_login, authors_file)
|
172
|
+
puts "You claim to be #{user} <#{email}> with apache login: #{opt.apache_login}"
|
173
|
+
git('config', 'user.name', user)
|
174
|
+
git('config', 'user.email', email)
|
175
|
+
end
|
176
|
+
|
177
|
+
if opt.svn_rev
|
178
|
+
revision = opt.svn_rev
|
179
|
+
else
|
180
|
+
location, revision = svn_loc_rev
|
181
|
+
revision = opt.svn_rev || revision
|
182
|
+
end
|
183
|
+
|
184
|
+
if opt.svn_uri
|
185
|
+
repo = opt.svn_uri
|
186
|
+
else
|
187
|
+
fail "No #{opt.svn_path} directory on #{location}" unless
|
188
|
+
location =~ /\/#{opt.svn_path}/
|
189
|
+
repo = $`
|
190
|
+
end
|
191
|
+
|
192
|
+
# Tell git where the svn repository is
|
193
|
+
git('config', "svn-remote.#{opt.svn_prefix}.url", repo)
|
194
|
+
git('config', "svn-remote.#{opt.svn_prefix}.fetch",
|
195
|
+
"#{opt.svn_path}/trunk:refs/remotes/#{opt.svn_prefix}/trunk")
|
196
|
+
git('config', "svn-remote.#{opt.svn_prefix}.branches",
|
197
|
+
"#{opt.svn_path}/branches/*:refs/remotes/#{opt.svn_prefix}/*")
|
198
|
+
git('config', "svn-remote.#{opt.svn_prefix}.tags",
|
199
|
+
"#{opt.svn_path}/tags/*:refs/remotes/#{opt.svn_prefix}/tags/*")
|
200
|
+
|
201
|
+
# Store the user for svn dcommit
|
202
|
+
if opt.apache_login
|
203
|
+
git('config', "svn-remote.#{opt.svn_prefix}.username", opt.apache_login)
|
204
|
+
end
|
205
|
+
|
206
|
+
# Create the svn branch, do this instead of pulling the full svn history
|
207
|
+
git('update-ref', "refs/remotes/#{opt.svn_prefix}/trunk",
|
208
|
+
'refs/remotes/origin/master')
|
209
|
+
# create tags from git
|
210
|
+
git('tag').split.each do |tag|
|
211
|
+
git('update-ref', "refs/remotes/#{opt.svn_prefix}/tags/#{tag}",
|
212
|
+
"refs/tags/#{tag}")
|
213
|
+
end
|
214
|
+
# update svn metadata
|
215
|
+
mkdir_p(expand_path('.git/svn'))
|
216
|
+
svn_meta = expand_path('.git/svn/.metadata')
|
217
|
+
git('config', '--file', svn_meta,
|
218
|
+
"svn-remote.#{opt.svn_prefix}.branches-maxRev", revision)
|
219
|
+
git('config', '--file', svn_meta,
|
220
|
+
"svn-remote.#{opt.svn_prefix}.tags-maxRev", revision)
|
221
|
+
end
|
222
|
+
|
223
|
+
def svn_loc_rev
|
224
|
+
meta = sh('git log -n 10 | grep git-svn-id | head -n 1').chomp
|
225
|
+
fail "No svn metadata on last 10 commits" if meta.empty?
|
226
|
+
meta.split[1].split('@')
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
class FetchCommand < GitFlow/:fetch
|
231
|
+
@help = "Get changes from svn, creating tags, branches on townhall"
|
232
|
+
@documentation = <<-DOC
|
233
|
+
This command can be used to fetch changes from Apache\'s SVN repo.
|
234
|
+
|
235
|
+
GIT CONFIG VALUES:
|
236
|
+
|
237
|
+
apache.svn - The svn remote using to get changes from Apache SVN.
|
238
|
+
Set by setup-svn --svn-prefix.
|
239
|
+
DOC
|
240
|
+
|
241
|
+
def options(opt)
|
242
|
+
opt.apache_svn = git('config', '--get', 'apache.svn').chomp rescue nil
|
243
|
+
[['--apache-svn SVN_REMOTE', 'The SVN remote used to get changes from Apache',
|
244
|
+
"Current value: #{opt.apache_svn}",
|
245
|
+
lambda { |r| opt.apache_svn = r }]
|
246
|
+
]
|
247
|
+
end
|
248
|
+
|
249
|
+
def execute(opt, argv)
|
250
|
+
fail "Missing apache.svn config value" unless opt.apache_svn
|
251
|
+
git('svn', 'fetch', opt.apache_svn)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class SyncCommand < GitFlow/:sync
|
256
|
+
@help = "Synchronizes between Apache svn and git townhall."
|
257
|
+
@documentation = <<-DOC
|
258
|
+
This command will perform the following actions:
|
259
|
+
* fetch changes from apache svn.
|
260
|
+
* rebase them on the current branch or on the one specified with --onto
|
261
|
+
* dcommit (this will push your changes to Apache trunk)
|
262
|
+
|
263
|
+
GIT CONFIG VALUES:
|
264
|
+
|
265
|
+
apache.svn
|
266
|
+
The svn remote using to get changes from Apache SVN.
|
267
|
+
Set by setup-svn --svn-prefix.
|
268
|
+
|
269
|
+
apache.git
|
270
|
+
The git remote used as townhall repository.
|
271
|
+
Set by setup-svn --townhall.
|
272
|
+
|
273
|
+
svn-remote.APACHE_GIT.username
|
274
|
+
If configured, sync will use this svn username while dcommiting.
|
275
|
+
DOC
|
276
|
+
|
277
|
+
def options(opt)
|
278
|
+
git('branch').split.tap { |n| opt.current = n[n.index('*')+1] }
|
279
|
+
opt.branch = opt.current
|
280
|
+
opt.svn_branch = 'trunk'
|
281
|
+
opt.git_branch = 'master'
|
282
|
+
opt.apache_git = git('config', '--get', 'apache.git').chomp rescue nil
|
283
|
+
opt.apache_svn = git('config', '--get', 'apache.svn').chomp rescue nil
|
284
|
+
opt.svn_username = git('config', '--get',
|
285
|
+
"svn-remote.#{opt.apache_svn}.username").chomp rescue nil
|
286
|
+
[['--apache-svn SVN_REMOTE', 'The SVN remote used to get changes from Apache',
|
287
|
+
"Current value: #{opt.apache_svn}",
|
288
|
+
lambda { |r| opt.apache_svn = r }],
|
289
|
+
['--apache-git REMOTE', 'The git remote used as town-hall repository.',
|
290
|
+
"Current value: #{opt.apache_git}",
|
291
|
+
lambda { |r| opt.apache_git = r }],
|
292
|
+
['--username SVN_USER',
|
293
|
+
'Specify the SVN username for dcommit',
|
294
|
+
"Defaults to: #{opt.svn_username}",
|
295
|
+
lambda { |b| opt.svn_username = b }],
|
296
|
+
['--svn-branch SVN_BRANCH',
|
297
|
+
'Specify the SVN branch to rebase changes from, and where to dcommit',
|
298
|
+
"Defaults to: #{opt.svn_branch}",
|
299
|
+
lambda { |b| opt.svn_branch = b }],
|
300
|
+
['--git-branch REMOTE_BRANCH',
|
301
|
+
'Specify the remote town-hall branch (on apache.git) to update',
|
302
|
+
"Defaults to: #{opt.git_branch}",
|
303
|
+
lambda { |b| opt.git_branch = b }],
|
304
|
+
['--branch BRANCH', 'Specify the local branch to take changes from',
|
305
|
+
"Current branch: #{opt.branch}",
|
306
|
+
lambda { |b| opt.branch = b }]
|
307
|
+
]
|
308
|
+
end
|
309
|
+
|
310
|
+
def execute(opt, argv)
|
311
|
+
# obtain the svn url
|
312
|
+
url = git('config', '--get', "svn-remote.#{opt.apache_svn}.url").chomp
|
313
|
+
# obtain the path for project
|
314
|
+
path = git('config', '--get', "svn-remote.#{opt.apache_svn}.branches").
|
315
|
+
chomp.split('/branches').first
|
316
|
+
commit_url = "#{url}/#{path}/#{opt.svn_branch}"
|
317
|
+
|
318
|
+
# obtain latest changes from svn
|
319
|
+
git('svn', 'fetch', '--svn-remote', opt.apache_svn)
|
320
|
+
# obtain latest changes from git
|
321
|
+
git('fetch', opt.apache_git,
|
322
|
+
"#{opt.git_branch}:refs/remotes/#{opt.apache_git}/#{opt.git_branch}")
|
323
|
+
|
324
|
+
# rebase svn changes in the desired branch
|
325
|
+
git('rebase', "#{opt.apache_svn}/#{opt.svn_branch}", opt.branch)
|
326
|
+
git('rebase', "#{opt.apache_git}/#{opt.git_branch}", opt.branch)
|
327
|
+
|
328
|
+
# dcommit to the specific svn branch
|
329
|
+
['svn', 'dcommit',
|
330
|
+
'--svn-remote', opt.apache_svn, '--commit-url', commit_url].tap do |cmd|
|
331
|
+
if opt.svn_username
|
332
|
+
cmd << '--username' << opt.svn_username
|
333
|
+
end
|
334
|
+
git(*cmd)
|
335
|
+
end
|
336
|
+
|
337
|
+
# update townhall remote ref
|
338
|
+
git('update-ref',
|
339
|
+
"refs/remotes/#{opt.apache_git}/#{opt.git_branch}",
|
340
|
+
"refs/remotes/#{opt.apache_svn}/#{opt.svn_branch}")
|
341
|
+
|
342
|
+
# forward the remote townhall/master to apache/trunk
|
343
|
+
git('push', opt.apache_git,
|
344
|
+
"refs/remotes/#{opt.apache_git}/#{opt.git_branch}:#{opt.git_branch}")
|
345
|
+
|
346
|
+
# get back to the original branch
|
347
|
+
git('checkout', opt.current)
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
|
352
|
+
# This one is displayed when the user executes this script using
|
353
|
+
# open-uri -e
|
354
|
+
HEADER = <<HEADER
|
355
|
+
|
356
|
+
Buildr official commit channel is Apache's svn repository, however some
|
357
|
+
developers may prefer to use git while working on several features and
|
358
|
+
merging other's changes.
|
359
|
+
|
360
|
+
This script will configure a gitflow copy on so you can commit to svn.
|
361
|
+
|
362
|
+
Enter <-h> to see options, <-H> to see notes about configured aliases
|
363
|
+
and recommended workflow, or any other option.
|
364
|
+
|
365
|
+
Ctrl+D or an invalid option to abort
|
366
|
+
HEADER
|
367
|
+
|
368
|
+
# When fork is completed, we display the following notice on a
|
369
|
+
# pager, giving the user a brief overview of git aliases used
|
370
|
+
# to keep the mirror in sync.
|
371
|
+
NOTICE = <<NOTICE
|
372
|
+
ALIASES:
|
373
|
+
|
374
|
+
Some git aliases have been created for developer convenience:
|
375
|
+
|
376
|
+
git apache fetch # get changes from apache/trunk without merging them
|
377
|
+
# you can inspect what's happening on trunk without
|
378
|
+
# having to worry about merging conflicts.
|
379
|
+
# Inspect the remote branch with `git log apache/trunk`
|
380
|
+
# Or if you have a git-ui like `tig` you can use that.
|
381
|
+
|
382
|
+
git apache merge # Merge already fetched changes on the current branch
|
383
|
+
# Use this command to get up to date with trunk changes
|
384
|
+
# you can always cherry-pick from the apache/trunk
|
385
|
+
# branch.
|
386
|
+
|
387
|
+
git apache pull # get apache-fetch && git apache-merge
|
388
|
+
|
389
|
+
git apache push # Push to Apache's SVN. Only staged changes (those
|
390
|
+
# recorded using `git commit`) will be sent to SVN.
|
391
|
+
# You need not to be on the master branch.
|
392
|
+
# Actually you can work on a tiny-feature branch and
|
393
|
+
# commit directly from it.
|
394
|
+
#
|
395
|
+
# VERY IMPORTANT:
|
396
|
+
#
|
397
|
+
# Missing commits on Apache's SVN will be sent using
|
398
|
+
# your apache svn account. This means that you can
|
399
|
+
# make some commits on behalf of others (like patches
|
400
|
+
# comming from JIRA issues or casual contributors)
|
401
|
+
# Review the apache-push alias on .git/config if you
|
402
|
+
# want to change login-name used for commit to SVN.
|
403
|
+
#
|
404
|
+
# See the recommended workflow to avoid commiting
|
405
|
+
# other developers' changes and the following section.
|
406
|
+
|
407
|
+
THE GITHUB MIRROR:
|
408
|
+
|
409
|
+
Buildr has an unofficial git mirror on github, maintained by Apache committers:
|
410
|
+
|
411
|
+
http://github.com/buildr/buildr
|
412
|
+
|
413
|
+
This mirror DOES NOT replace Apache's SVN repository. We really care about
|
414
|
+
using Apache infrastructure and following Apache project guidelines for
|
415
|
+
contributions. This git mirror is provided only for developers convenience,
|
416
|
+
allowing them to easily create experimental branches or review code from
|
417
|
+
other committers.
|
418
|
+
|
419
|
+
All code that wants to make it to the official Apache Buildr repository needs
|
420
|
+
to be committed to the Apache SVN repository by using the command:
|
421
|
+
|
422
|
+
git synchronize
|
423
|
+
|
424
|
+
This command will synchronize both ways svn<->git to keep trunk upto date.
|
425
|
+
You need to be an Apache committer and have permissions on the SVN repo.
|
426
|
+
|
427
|
+
It's VERY IMPORTANT for Buildr committers to remember that contributions from
|
428
|
+
external entities wanting to be accepted will require them to sign the Apache ICLA.
|
429
|
+
We provide the git mirror to make it easier for people to experiment and
|
430
|
+
contribute back to Buildr, before merging their code in, please remember they
|
431
|
+
have to create create a JIRA issue granting ASF permission to include their code,
|
432
|
+
just like any other contribution following Apache's guidelines.
|
433
|
+
|
434
|
+
So, it's very important - if you care about meritocracy - to follow or at
|
435
|
+
least that you get an idea of the recommended workflow.
|
436
|
+
|
437
|
+
RECOMMENDED WORKFLOW:
|
438
|
+
|
439
|
+
So now that you have your local buildr copy you can create topic branches
|
440
|
+
to work on independent features, and still merge easily with head changes.
|
441
|
+
|
442
|
+
They may seem lots of things to consider, but it's all for Buildr's healt.
|
443
|
+
As all things git, you can always follow your own workflow and even create
|
444
|
+
aliases on you .git/config file to avoid typing much. So, here they are:
|
445
|
+
|
446
|
+
1) get your gitflow configured
|
447
|
+
(you have already do so, this was the most difficult part)
|
448
|
+
|
449
|
+
2) create a topic branch to work on, say.. you want to add cool-feature:
|
450
|
+
|
451
|
+
git checkout -b cool-feature master
|
452
|
+
# now on branch cool-feature
|
453
|
+
|
454
|
+
3) hack hack hack.. use the source luke.
|
455
|
+
every time you feel you have something important like added failing
|
456
|
+
spec, added part of feature, or resolved some conflict from merges,
|
457
|
+
you can commit your current progress. If you want to be selective, use:
|
458
|
+
|
459
|
+
git commit --interactive
|
460
|
+
|
461
|
+
3) review your changes, get ALL specs passing, repeat step 3 as needed
|
462
|
+
|
463
|
+
4) let's see what are they doing on trunk
|
464
|
+
|
465
|
+
git apache-fetch
|
466
|
+
# You can inspect the upstream changes without having to merge them
|
467
|
+
git log apache/trunk # what are they doing!!
|
468
|
+
|
469
|
+
5) integrate mainstream changes to your cool-feature branch, you can always
|
470
|
+
use `git cherry-pick` to select only some commits.
|
471
|
+
|
472
|
+
git merge apache/trunk cool-feature
|
473
|
+
|
474
|
+
6) Go to 3 unless ALL specs are passing.
|
475
|
+
|
476
|
+
7.a) (Skip to 7.b you have commit bit on Apache's SVN)
|
477
|
+
Create a patch using `git format-patch`
|
478
|
+
Promote your changes, create a JIRA issue and upload it granting Apache
|
479
|
+
license to include your code:
|
480
|
+
|
481
|
+
https://issues.apache.org/jira/browse/BUILDR
|
482
|
+
dev@buildr.apache.org
|
483
|
+
|
484
|
+
7.b) Now you have everyhing on staging area and merged important changes
|
485
|
+
from apache/trunk, it's time to commit them to Apache's SVN.
|
486
|
+
|
487
|
+
git apache-push
|
488
|
+
|
489
|
+
8) Optional. If you are a buildr committer you may want to synchronize
|
490
|
+
the github mirror for helping others to get changes without having to
|
491
|
+
wait on Victor's cronjob to run every hour (useful for urgent changes).
|
492
|
+
|
493
|
+
git synchronize
|
494
|
+
|
495
|
+
9) Pull changes from origin frequently.
|
496
|
+
|
497
|
+
git fetch origin
|
498
|
+
git rebase --onto origin/master master master
|
499
|
+
|
500
|
+
10) Unconditionally, Go to step 2 ;)
|
501
|
+
Share your gitflow workflow, git tips, etc.
|
502
|
+
|
503
|
+
RESOURCES:
|
504
|
+
|
505
|
+
http://github.com/buildr/buildr/tree/master
|
506
|
+
http://git.or.cz/gitwiki/GitCheatSheet
|
507
|
+
http://groups.google.com/group/git-users/web/git-references
|
508
|
+
|
509
|
+
NOTICE
|
510
|
+
#' for emacs
|
511
|
+
|
512
|
+
end
|