Skip to content

Commit b362c08

Browse files
committed
Use the platform native path.separator when building using JRuby.
1 parent c5af1b6 commit b362c08

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Rakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ desc "Generate parser with ragel"
4848
task :ragel => [JAVA_PARSER_SRC]
4949

5050
if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
51+
require 'java'
52+
path_sep = java.lang.System.getProperty("path.separator")
5153
ENV['JAVA_HOME'] ||= [
5254
'/usr/local/java/jdk',
5355
'/usr/lib/jvm/java-6-openjdk',
5456
'/Library/Java/Home',
5557
].find { |c| File.directory?(c) }
5658
if ENV['JAVA_HOME']
5759
warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}"
58-
ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':'
60+
ENV['PATH'] = ENV['PATH'].split(/path_sep/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * path_sep
5961
warn " *** java binaries are assumed to be in #{java_path.inspect}"
6062
else
6163
warn " *** JAVA_HOME was not set or could not be guessed!"
@@ -65,7 +67,7 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
6567
JRUBY_JAR = File.join(CONFIG["libdir"], "jruby.jar")
6668
if File.exist?(JRUBY_JAR)
6769
JAVA_SOURCES.each do |src|
68-
classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
70+
classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * path_sep
6971
obj = src.sub(/\.java\Z/, '.class')
7072
file obj => src do
7173
sh 'javac', '-classpath', classpath, '-source', '1.8', '-target', '1.8', src

0 commit comments

Comments
 (0)