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

Executes JavaDoc by passing it everything it needs. Stuff like a classpath and sources. The result is generated in target/jdoc. Can be customized exactly in the same way as the javac task.

Methods

Public Instance methods

[Source]

     # File lib/raven/java_tasks.rb, line 283
283:       def build_path
284:         @build_path ||= []
285:       end

[Source]

     # File lib/raven/java_tasks.rb, line 287
287:       def build_path=(p)
288:         @build_path = [p]
289:       end

[Source]

     # File lib/raven/java_tasks.rb, line 254
254:       def execute
255:         super
256:         classpath = Raven.build_cp(prerequisites)
257:         classpath << "target/classes"
258:         @build_path = ["src/main/java"] unless @build_path
259:         
260:         puts "Executing JavaDoc using source path #{@build_path.join(' ')}" if RakeFileUtils.verbose_flag
261:         
262:         Dir.mkdir("target") unless File.exist?("target")
263:         Dir.mkdir("target/jdoc")  unless File.exist?("target/jdoc")
264:         
265:         packages = Set[]
266:         @build_path.each do |d|
267:           Dir.glob("#{d}/**/*.java").each do |java| 
268:             packages << java[(d.length + 1)..(java.rindex('/') - 1)].gsub(%r{[\\/]}, '.')
269:           end
270:         end
271:         packages = packages.to_a
272:         
273:         if (packages.size > 0)
274:           puts "javadoc -classpath #{classpath.join(CP_SEP)} -sourcepath #{@build_path.join(CP_SEP)} -d target/jdoc #{packages.join(' ')}" if RakeFileUtils.verbose_flag
275:           `javadoc -classpath #{classpath.join(CP_SEP)} -sourcepath #{@build_path.join(CP_SEP)} -d target/jdoc #{packages.join(' ')}`
276:           unless $?.exitstatus == 0
277:             puts "Javadoc failed, see above errors."
278:             exit
279:           end
280:         end
281:       end

[Validate]