Skip to content

Commit

Permalink
fix the order of execution to ensure bin/*.bat files are packed
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Feb 24, 2014
1 parent f87a497 commit 720fcac
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
25 changes: 19 additions & 6 deletions maven/jruby-stdlib/pom.rb
Expand Up @@ -19,7 +19,7 @@
'jruby.complete.gems' => '${jruby.complete.home}/lib/ruby/gems/shared' )

execute( 'fix shebang on gem bin files and add *.bat files',
'process-resources' ) do |ctx|
'initialize' ) do |ctx|

puts 'fix the gem stub files'
jruby_home = ctx.project.properties.get_property( 'jruby.home' )
Expand All @@ -32,11 +32,24 @@
end

puts 'generate the missing bat files'
RbConfig::CONFIG['bindir'] = bindir
require "#{jruby_home}/core/src/main/ruby/jruby/commands.rb"
JRuby::Commands.generate_bat_stubs

puts 'copy jruby.bash to jruby'
Dir[File.join( jruby_home, 'bin', '*' )].each do |fn|
next unless File.file?(fn)
next if fn =~ /.bat$/
next if File.exist?("#{fn}.bat")
next unless File.open(fn, 'r', :internal_encoding => 'ASCII-8BIT') do |io|
line = io.readline rescue ""
line =~ /^#!.*ruby/
end
puts "Generating #{File.basename(fn)}.bat"
File.open("#{fn}.bat", "wb") do |f|
f.print "@ECHO OFF\r\n"
f.print "@\"%~dp0jruby.exe\" -S #{File.basename(fn)} %*\r\n"
end
end
end

execute( 'copy bin/jruby.bash to bin/jruby',
'process-resources' ) do |ctx|
require 'fileutils'
jruby_complete = ctx.project.properties.get_property( 'jruby.complete.home' )
FileUtils.cp( File.join( jruby_complete, 'bin', 'jruby.bash' ),
Expand Down
13 changes: 12 additions & 1 deletion maven/jruby-stdlib/pom.xml
Expand Up @@ -77,7 +77,7 @@
<executions>
<execution>
<id>fix shebang on gem bin files and add *.bat files</id>
<phase>process-resources</phase>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
Expand All @@ -86,6 +86,17 @@
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
<execution>
<id>copy bin/jruby.bash to bin/jruby</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>copy bin/jruby.bash to bin/jruby</taskId>
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
Expand Down

0 comments on commit 720fcac

Please sign in to comment.