logstash/rakelib/vendor.rake
Armin 8b8d5ec9ca TESTS: Improve Gradle Test Configuration
* `clean` actually cleans all dynamically created files, in particular it now properly cleans the generated Gemfile so
that changes to the Gemfile.template reflect in a rerun of `bundler`
* `rubyTests` and `test` are now one-off and will automatically bootstrap JRuby and Gems required by the tests if necessary
* Fixed Readme to document the now much simpler test targets
* All rake tasks remain unchanged and still work exactly as they did before

Fixes #8583
2017-11-06 18:34:47 +00:00

48 lines
1.3 KiB
Ruby

namespace "vendor" do
def vendor(*args)
return File.join("vendor", *args)
end
task "jruby" do |task, args|
system('./gradlew downloadAndInstallJRuby')
end # jruby
task "all" => "jruby"
task "system_gem", :jruby_bin, :name, :version do |task, args|
jruby_bin = args[:jruby_bin]
name = args[:name]
version = args[:version]
IO.popen([jruby_bin, "-S", "gem", "list", name, "--version", version, "--installed"], "r") do |io|
io.readlines # ignore
end
unless $?.success?
puts("Installing #{name} #{version} because the build process needs it.")
system(jruby_bin, "-S", "gem", "install", name, "-v", version, "--no-ri", "--no-rdoc")
raise RuntimeError, $!.to_s unless $?.success?
end
task.reenable # Allow this task to be run again
end
namespace "force" do
task "gems" => ["vendor:gems"]
end
task "gems", [:bundle] do |task, args|
require "bootstrap/environment"
Rake::Task["dependency:bundler"].invoke
puts("Invoking bundler install...")
output, exception = LogStash::Bundler.invoke!(:install => true)
puts(output)
raise(exception) if exception
end # task gems
task "all" => "gems"
desc "Clean the vendored files"
task :clean do
rm_rf(vendor)
end
end