Class Raven::JarSourceTask
In: lib/raven/java_tasks.rb
Parent: Rake::Task

Builds a jar file from your sources. Customized by adding directories to the source_path just like the JavacTask.

Methods

Public Instance methods

[Source]

     # File lib/raven/java_tasks.rb, line 151
151:       def execute
152:         super
153:         # Checking if any of our prerequisites is a JavacTask, if

154:         # so we'll just use the build path to construct the jar.

155:         Raven.prereq_filter(prerequisites, :build_path) do |javac_task|
156:          (@source_path ||= []) << javac_task.build_path
157:         end
158:         
159:         # Initializing source path

160:         @source_path = ["src/main/java"] unless @source_path
161:         @source_path.flatten!
162:         
163:         latest = Time.at(0)
164:         @source_path.each do |dir|
165:           dir_latest = Raven.latest_file(dir)
166:           latest = dir_latest if dir_latest > latest
167:         end
168:         
169:         # Manifest inclusion

170:         mfest_param = @manifest ? "-m #{@manifest}" : ""
171:         
172:         # Building the jar from all sources

173:         if !File.exist?("target/#{name}") || File.stat("target/#{name}").mtime < latest
174:           `jar -cf target/#{name} #{mfest_param} -C #{@source_path.pop} .`
175:           while (p = @source_path.pop)
176:             `jar -uf target/#{name} -C #{p} .`
177:           end
178:         end
179:       end

[Source]

     # File lib/raven/java_tasks.rb, line 185
185:       def manifest=(f)
186:         @manifest = f
187:       end

[Source]

     # File lib/raven/java_tasks.rb, line 181
181:       def source_path
182:         @source_path ||= []
183:       end

[Validate]