# frozen_string_literal: true

packaging 'pom'

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

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

pom 'org.jruby:jruby', '${jruby.version}'

plugin('org.codehaus.mojo:exec-maven-plugin', '3.5.0',
       executable: :java,
       environmentVariables: { 'GEM_HOME' => '${gem.home}',
                               'GEM_PATH' => '${gem.home}' }) do
  execute_goal(:exec, id: 'no more warnings', phase: :test,
                      arguments: ['-classpath',
                                  xml('<classpath/>'),
                                  'org.jruby.Main',
                                  'test_no_more_warnings.rb'])
  execute_goal(:exec, id: 'freeze loading', phase: :test,
                      arguments: ['-classpath',
                                  xml('<classpath/>'),
                                  'org.jruby.Main',
                                  'test_freeze_loading.rb'])
  execute_goal(:exec, id: 'ignore gemspec on require_jar', phase: :test,
                      arguments: ['-classpath',
                                  xml('<classpath/>'),
                                  'org.jruby.Main',
                                  '-I.', '-rjar-dependencies', '-e',
                                  'require_jar "jline", "jline", "2.11"'])
end

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