Ant目标依赖关系树查看器

Ble*_*eek 8 java eclipse ant eclipse-plugin

有没有一个软件(或一个eclipse插件),

给定目标,是否允许我将目标依赖关系视为树?

树不需要是图形的,可以是基于文本的 - 只是一个工具,可以帮助我遍历某人的蚂蚁文件网格来调试它们.

不需要是Eclipse插件.但是,单击一个节点会将该目标的源抛出到编辑器上会很好.

use*_*293 5

我想要同样的东西,但是,像大卫一样,我最终只写了一些代码(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)
Run Code Online (Sandbox Code Playgroud)


Kel*_*nch 4

类似于Eclipse 中的 ant 调试问题。

根据Apache的ANT手册,您可以从该选项开始-projecthelp。之后可能会更加困难,因为各个目标可能具有交叉依赖性,因此根本不可能将层次结构表示为树。

您可以修改build.xml来检测环境变量,例如NO_PRINT,它在每个项目目标中进行测试,如果找到,则仅打印出项目名称而不打印其他内容。该项目的依赖关系将保留并允许 ANT 遍历树并生成将触及的不同目标的打印输出。