Enhancing the Buildr release process

252 Views Asked by At

I'd like to tie a custom task into the default buildr release cycle. I'd like to run this code after the project has been compiled, packaged, tagged and deployed but before it increments the version number and commits that.

How would I tie into this part of the release cycle?

1

There are 1 best solutions below

2
On BEST ANSWER

Unfortunately, the release task isn't composed of sub-tasks that you could potentially hook into and extend with your own task(s).

To quote the current implementation,

# Make a release.
def make
  @this_version = extract_version
  check
  with_release_candidate_version do |release_candidate_buildfile|
    args = '-S', 'buildr', "_#{Buildr::VERSION}_", '--buildfile', release_candidate_buildfile
    args << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?
    args << 'clean' << 'upload' << 'DEBUG=no'
    ruby *args
  end
  tag_release resolve_tag
  update_version_to_next if this_version != resolve_next_version(this_version)
end

As you can see, Buildr forks a separate process and essentially runs buildr clean upload One possibility would be to enhance the upload task and add your tasks as dependencies, e.g.,

task :my_custom_task do
  # do stuff
end

task :upload => [ :my_custom_task ]

If this doesn't meet your needs, I'd recommend opening an enhancement request at https://issues.apache.org/jira/browse/BUILDR.