module Buildr::JDepend

Addes the projectname:jdepend:swing, projectname:jdepend:text and projectname:jdepend:xml tasks.

Require explicitly using require "buildr/jdepend".

Public Class Methods

dependencies() click to toggle source

The specs for requirements

# File addon/buildr/jdepend.rb, line 26
def dependencies
  [
    'jdepend:jdepend:jar:2.9.1'
  ]
end
jdepend(output_file, target_paths, options = {}) click to toggle source
# File addon/buildr/jdepend.rb, line 32
def jdepend(output_file, target_paths, options = {})
  dependencies = (options[:dependencies] || []) + self.dependencies
  cp = Buildr.artifacts(dependencies).each(&:invoke).map(&:to_s)

  args = []
  if output_file
    args << '-file'
    args << output_file
  end
  target_paths.each do |target_path|
    file(target_path).invoke
    args << target_path.to_s if ::File.exist?(target_path.to_s)
  end

  # If no output file then we must be trying to run the swing app
  command = output_file ? 'jdepend.xmlui.JDepend' : 'jdepend.swingui.JDepend'

  begin
    Java::Commands.java command, *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}])
  rescue => e
    raise e if options[:fail_on_error]
  end
end