rakejava 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/rakejava.rb +29 -14
  2. metadata +4 -4
data/lib/rakejava.rb CHANGED
@@ -81,26 +81,19 @@ class JarFiles < Rake::FileList
81
81
  attr_accessor :root
82
82
 
83
83
  def initialize *args
84
- @root = args.shift
85
- @resolving = false
84
+ @root = args.shift.sub(%r[/+$], '') # remove trailing slashes
85
+ @resolved = false
86
86
  super
87
87
  end
88
88
 
89
89
  def resolve
90
- unless @resolving
91
- @resolving = true
90
+ unless @resolved
91
+ @resolved = true
92
92
  pushd @root
93
93
  super
94
94
  puts "Resolving JarFiles list"
95
- # Hack time because the jar command is busted. Every arg after the
96
- # first file listed after a -C needs to have paths relative to the
97
- # command-launch rather than the -C specified dir. The first file arg
98
- # after a -C works but subsequent ones fail.
99
- hack = @items.shift
100
95
  @items.map! { |i| "#{@root}#{File::SEPARATOR}#{i}" }
101
- @items.unshift(hack)
102
96
  popd
103
- @resolving = false
104
97
  end
105
98
  self
106
99
  end
@@ -221,9 +214,22 @@ module RakeJava
221
214
 
222
215
  def execute args=nil
223
216
  super
224
-
217
+
225
218
  flags = "cf"
226
219
  jar = File.expand_path(@real_name)
220
+
221
+ all_files = []
222
+ @files.each do |file_list|
223
+ all_files << file_list.to_a
224
+ end
225
+ all_files.flatten!
226
+
227
+ # Bail if there's already a jar file and none of the
228
+ # source files are newer.
229
+ if uptodate?(jar, all_files)
230
+ puts "Jar file is up to date. Nothing to do."
231
+ return
232
+ end
227
233
 
228
234
  if @main_class
229
235
  unless @manifest
@@ -244,7 +250,16 @@ module RakeJava
244
250
  cmd = "jar #{flags} #{@real_name}#{manifest_path}"
245
251
 
246
252
  @files.each do |file_list|
247
- cmd << " -C #{file_list.root} #{space_sep(path_esc(file_list))}"
253
+ # Hack time because the jar command is busted. Every arg after the
254
+ # first file listed after a -C needs to have paths relative to the
255
+ # command-launch rather than the -C specified dir. The first file arg
256
+ # after a -C works but subsequent ones fail.
257
+ fixed_list = file_list.to_a
258
+ unless fixed_list.empty?
259
+ fixed_list[0].sub!(%r[^#{file_list.root}/], '')
260
+ end
261
+
262
+ cmd << " -C #{file_list.root} #{space_sep(path_esc(fixed_list))}"
248
263
  end
249
264
 
250
265
  max_cmd_len = 500
@@ -307,4 +322,4 @@ def jar *args, &block
307
322
  RakeJava::JarTask.define_task(*args, &block)
308
323
  end
309
324
 
310
- # vi:tabstop=2:expandtab:filetype=ruby
325
+ # vi:tabstop=3:expandtab:filetype=ruby
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
8
- - 8
9
- version: 1.1.8
7
+ - 2
8
+ - 0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tom Santos
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-08 00:00:00 -07:00
17
+ date: 2010-06-28 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency