Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant target dependency tree viewer

IS there a piece of software (or an eclipse plug-in) which,

given a target, would allow me to view the target dependency as a tree?

The tree does not need to be graphical, could be text based - just a tool that would help me traverse thro someone's mesh of ant files to debug them.

Does not need to be an Eclipse plug-in. However, would be nice when a node is clicked would throw the source of that target onto an editor.

like image 687
Blessed Geek Avatar asked Oct 03 '11 17:10

Blessed Geek


People also ask

How do you check a dependency tree in ivy?

Have a look at <ivy:dependencytree /> that will display the dependency tree in the console.


1 Answers

I wanted the same thing, but, like David, I ended up just writing a bit of code (Python):

from xml.etree import ElementTree

build_file_path = r'/path/to/build.xml'
root = ElementTree.parse(build_file_path)

# target name to list of names of dependencies
target_deps = {}

for t in root.iter('target'):
  if 'depends' in t.attrib:
    deps = [d.strip() for d in t.attrib['depends'].split(',')]
  else:
    deps = []
  name = t.attrib['name']
  target_deps[name] = deps

def print_target(target, depth=0):
  indent = '  ' * depth
  print indent + target
  for dep in target_deps[target]:
    print_target(dep, depth+1)

for t in target_deps:
  print
  print_target(t)
like image 162
user3286293 Avatar answered Sep 27 '22 22:09

user3286293