Hi,
(sorry, this is quite a long email)

in the page http://buildr.apache.org/releasing.html in the "How to
specify my own version number scheme" section, I think I found an error:

# or a proc
Release.next_version = lambda do |this_version| # 1.0.0-SNAPSHOT
    new_version = @[email protected](/\./)
    new_version[0] = new_version[0] + 1
    new_version
end

This will not work for several reasons :
- syntax error on @[email protected] (I don't know that
@VERSION_NUMBER@ means, maybe someone could explain it to me or give me
a pointer)
- "new_version[0] + 1" will not work since new_version[0] in a string
- it returns an array instead of a string (commit message : Changed
version number to ["1", 2, "0-SNAPSHOT"])

$ buildr release
(in /home/jp/src/perso/presentation_buildr/exemple, development)
Buildr aborted!
SyntaxError :
/home/jp/src/perso/presentation_buildr/exemple/buildfile:15: syntax
error, unexpected $undefined, expecting keyword_end
  new_version = @[email protected] /\./
                                ^
/var/lib/gems/1.9.1/gems/buildr-1.4.12/lib/buildr/core/application.rb:424:in
`raw_load_buildfile'
/var/lib/gems/1.9.1/gems/buildr-1.4.12/lib/buildr/core/application.rb:225:in
`block in load_buildfile'
/var/lib/gems/1.9.1/gems/buildr-1.4.12/lib/buildr/core/application.rb:220:in
`load_buildfile'


This works on my machine, but maybe this is not the original idea :
Release.next_version = lambda do |this_version|
  new_version = VERSION_NUMBER.split /\./
  new_version[0] = new_version[0].to_i + 1
  #new_version[1] = 0
  #new_version[2] = "0-SNAPSHOT"
  new_version.join '.'
end

$ buildr release test=no

(in /home/jp/src/perso/presentation_buildr/exemple, development)
(in /home/jp/src/perso/presentation_buildr/exemple, development)
Cleaning exemple
Building exemple
Compiling exemple:A into
/home/jp/src/perso/presentation_buildr/exemple/A/target/classes
Skipping tests for exemple:A
Packaging exemple-A-1.3.0.jar
Compiling exemple:B into
/home/jp/src/perso/presentation_buildr/exemple/B/target/classes
Packaging exemple-A-1.3.0.jar
Compiling exemple:B into
/home/jp/src/perso/presentation_buildr/exemple/B/target/classes
Compiling exemple:D into
/home/jp/src/perso/presentation_buildr/exemple/D/target/classes
Skipping tests for exemple:B
Packaging exemple-B-1.3.0.jar
Skipping tests for exemple:D
Packaging exemple-D-1.3.0.jar
Compiling exemple:C into
/home/jp/src/perso/presentation_buildr/exemple/C/target/classes
Skipping tests for exemple
Skipping tests for exemple:C
Packaging exemple
Packaging exemple-C-1.3.0.war
Deploying packages from exemple
Deploying barreverte.fr:exemple-A:pom:1.3.0
Deploying barreverte.fr:exemple-A:jar:1.3.0
Deploying barreverte.fr:exemple-B:pom:1.3.0
Deploying barreverte.fr:exemple-B:jar:1.3.0
Deploying barreverte.fr:exemple-D:pom:1.3.0
Deploying barreverte.fr:exemple-D:jar:1.3.0
Deploying barreverte.fr:exemple-C:pom:1.3.0
Deploying barreverte.fr:exemple-C:war:1.3.0
Completed in 2.620s
Committing buildfile with version number 1.3.0
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 373 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
To [email protected]:jpcaruana/presentation_buildr.git
   4960c6c..5a5958b  test_buildr_release -> test_buildr_release
Tagging release 1.3.0
error: tag '1.3.0' not found.
remote: warning: Deleting a non-existent ref.
To [email protected]:jpcaruana/presentation_buildr.git
 - [deleted]         1.3.0
Counting objects: 1, done.
Writing objects: 100% (1/1), 191 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
To [email protected]:jpcaruana/presentation_buildr.git
 * [new tag]         1.3.0 -> 1.3.0
Current version is now 1.4.0-SNAPSHOT
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 393 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
To [email protected]:jpcaruana/presentation_buildr.git
   5a5958b..ac06f56  test_buildr_release -> test_buildr_release
Completed in 10.031s


I also found that
project.version = THIS_VERSION

is not necessary (see my test at
https://github.com/jpcaruana/presentation_buildr/tree/test_buildr_release)

I haven't checked out buildr source code for a long time, so I don't know :
- if the website is in the repo
- if I could submit a 'fix' to the site


Thanks for your feedback.

ps: using 'buildr release next_version="2.0.0-SNAPSHOT"' overrides
Release.next_version = lambda in the buildfile : that's neat :-) !

ps2: I found the message "error: tag '1.3.0' not found." disturbing
since this is an expected behaviour. An already existing tag is an issue
and the build should fail - in facts, it fails on the upload part. Maybe
buildr could fail faster by checking tag existence before
compile/test/package/upload.
-- 
Jean-Philippe Caruana

Reply via email to