Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/warbler/jar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ def run_javac(config, compiled_ruby_files)
else
compat_version = ''
end

# Need to use the version of JRuby in the application to compile it
%x{java -classpath #{config.java_libs.join(File::PATH_SEPARATOR)} org.jruby.Main #{compat_version} -S jrubyc \"#{compiled_ruby_files.join('" "')}\"}
raise "Cannot compile Ruby files" unless $?.success?
end

def replace_compiled_ruby_files(config, compiled_ruby_files)
Expand All @@ -59,7 +61,7 @@ def replace_compiled_ruby_files(config, compiled_ruby_files)
config.excludes += compiled_ruby_files

compiled_ruby_files.each do |ruby_source|
files[apply_pathmaps(config, ruby_source, :application)] = StringIO.new("require __FILE__.sub(/\.rb$/, '.class')")
files[apply_pathmaps(config, ruby_source, :application)] = StringIO.new("load __FILE__.sub(/(\.rb)?$/, '.class')")
end
end

Expand All @@ -86,6 +88,7 @@ def create(config_or_path)
rm_f path
ensure_directory_entries
puts "Creating #{path}"
@files.delete("#{config_or_path.jar_name}/#{path}")
create_jar path, @files
end

Expand Down Expand Up @@ -221,8 +224,8 @@ def create_jar(jar_path, entries)
zipfile.get_output_stream(entry) {|f| f << src.read }
elsif src.nil? || File.directory?(src)
if File.symlink?(entry) && ! defined?(JRUBY_VERSION)
$stderr.puts "directory symlinks are not followed unless using JRuby; " +
"#{entry.inspect} contents not in archive"
$stderr.puts "directory symlinks are not followed unless using JRuby; " +
"#{entry.inspect} contents not in archive"
end
zipfile.mkdir(entry.dup) # in case it's frozen rubyzip 0.9.6.1 workaround
elsif File.symlink?(src)
Expand Down
2 changes: 1 addition & 1 deletion lib/warbler/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def define_compiled_task
task "compiled" do
jar.compile(config)
task @name do
rm_f config.compiled_ruby_files.map {|f| f.sub(/\.rb$/, '.class') }
rm_f config.compiled_ruby_files.map {|f| f.sub(/(\.rb)?$/, '.class') }
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/warbler/traits/gemspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def after_configure
end

def update_archive(jar)
(Dir['**/*'] - config.compiled_ruby_files).each do |f|
(@spec.files - config.compiled_ruby_files).each do |f|
jar.files[apply_pathmaps(config, f, :application)] = f
end
config.compiled_ruby_files.each do |f|
f = f.sub(/\.rb$/, '.class')
f = f.sub(/(\.rb)?$/, '.class')
next unless File.exist?(f)
jar.files[apply_pathmaps(config, f, :application)] = f
end
Expand Down