# frozen_string_literal: true

repository id: 'mavengems', url: 'mavengem:https://rubygems.org'

# gemfile

gem 'leafy-metrics', '0.6.1'

gem! 'bundler', '${bundler.version}'

phase :test do
  plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0',
         executable: :java,
         environmentVariables: { 'GEM_HOME' => '${gem.home}',
                                 'GEM_PATH' => '${gem.home}',
                                 'JARS_VERBOSE' => true }) do
    execute_goal(:exec,
                 id: 'jruby -S lock_jars',
                 arguments: ['-classpath',
                             xml('<classpath/>'),
                             'org.jruby.Main',
                             '${gem.home}/bin/lock_jars', '--tree'])
    execute_goal(:exec,
                 id: 'jruby test.rb',
                 arguments: ['-classpath',
                             xml('<classpath/>'),
                             'org.jruby.Main',
                             'test.rb'])
    execute_goal(:exec,
                 id: 'jruby -r jars/setup test.rb',
                 arguments: ['-classpath',
                             xml('<classpath/>'),
                             'org.jruby.Main',
                             '-rjars/setup', 'test.rb'])
  end
end

properties('gem.home' => '${project.basedir}/../rubygems',
           'gem.path' => '${gem.home}')

jar 'org.jruby:jruby-complete', '${jruby.version}'

gem 'jar-dependencies', '${jar-dependencies.version}'
gem 'ruby-maven', '${ruby-maven.version}'

jruby_plugin :gem, '${jruby.plugins.version}' do
  execute_goal :initialize
end
