Skip to content

Commit 3d83990

Browse files
committed
tidy
1 parent 8571726 commit 3d83990

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

Mavenfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# -*- mode:ruby -*-
22

33
gemspec
4-
54
properties 'push.skip': true, 'jruby.version': '9.3.1.0'
65

76
load File.join( basedir,'lib/maven/ruby/version.rb')
87

98
jar "io.takari.polyglot:polyglot-ruby:#{Maven::Ruby::POLYGLOT_VERSION}", scope: :provided
109

10+
execute 'cleanup extensions', 'initialize' do |ctx|
11+
FileUtils.rm_rf "#{ctx.project.build.directory}/../lib/extensions"
12+
end
13+
1114
plugin :dependency do
1215

1316
execute_goal(:"copy-dependencies",
17+
phase: 'prepare-package',
1418
includeScope: :provided,
19+
includeGroupIds: 'io.takari.polyglot',
1520
outputDirectory: '${project.build.directory}/../lib/extensions')
1621

1722
end

lib/maven/ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Maven
22
module Ruby
33
VERSION = '3.9.14'.freeze
4-
POLYGLOT_VERSION = "0.7.2-SNAPSHOT".freeze
4+
POLYGLOT_VERSION = "0.7.1".freeze
55
end
66
end

lib/ruby_maven.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ def self.exec( *args )
3131
args << 'settings.xml'
3232
end
3333
if args.member?('-version') or args.member?('--version') or args.member?('-v')
34-
warn "here"
35-
warn "Polyglot Maven Extension #{Maven::Ruby::POLYGLOT_VERSION} via ruby-maven #{Maven::Ruby::VERSION}"
3634
launch( '--version' )
3735
elsif defined? Bundler
3836
# it can be switching from ruby to jruby with invoking maven
@@ -65,6 +63,9 @@ def self.version
6563
end
6664

6765
def self.launch( *args )
66+
if args.member?('--version') or args.member?('--show-version')
67+
warn "Polyglot Maven Extension #{Maven::Ruby::POLYGLOT_VERSION} via ruby-maven #{Maven::Ruby::VERSION}"
68+
end
6869
old_maven_home = ENV['M2_HOME']
6970
ENV['M2_HOME'] = Maven.home
7071
ext_dir = File.join(Maven.lib, 'ext')
@@ -74,13 +75,14 @@ def self.launch( *args )
7475
file =~ /.*\.jar$/
7576
end.each do |jar|
7677
source = File.join(local_dir, jar)
77-
if jar == "polyglot-ruby-#{Maven::Ruby::POLYGLOT_VERSION}.jar"
78+
if jar =~ /polyglot-.*-#{Maven::Ruby::POLYGLOT_VERSION}.jar/
7879
# ruby maven defines the polyglot version and this jar sets up its classpath
7980
# i.e. on upgrade or downgrade the right version will be picked
80-
FileUtils.cp(source, File.join(ext_dir, "polyglot-ruby.jar"))
81-
elsif not File.exists?(File.join(ext_dir, jar))
81+
FileUtils.cp(source, File.join(ext_dir, jar.sub(/-[0-9.]*(-SNAPSHOT)?.jar$/, '.jar')))
82+
elsif not File.exists?(File.join(ext_dir, jar)) and not jar =~ /jruby-(core|stdlib).*/
8283
# jar files are immutable as they carry the version
83-
FileUtils.cp(source, ext_dir)
84+
warn jar
85+
FileUtils.cp(source, File.join(ext_dir, jar.sub(/-9.4.5.0/, '')))
8486
end
8587
end
8688

0 commit comments

Comments
 (0)