1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 """ Quality Ant task implementation. """
21 import integration.quality
22 import os
23 import traceback
24
26 """ This is the implementation of the checkBuildDuplicatesMacro Ant task."""
27 try:
28 if attributes.get('output') == None:
29 raise Exception("'output' attribute is not defined.")
30 output = str(attributes.get('output'))
31 task.log("Creating %s" % output)
32 output = open(output, "w+")
33 output.write("<?xml version=\"1.0\"?>\n<buildconflicts>\n")
34 components_per_file = {}
35 for eid in range(elements.get("fileset").size()):
36 dirscanner = elements.get("fileset").get(int(eid)).getDirectoryScanner(project)
37 dirscanner.scan()
38 for jfilename in dirscanner.getIncludedFiles():
39 filename = str(jfilename)
40 task.log("Parsing %s" % filename)
41 filename = os.path.join(str(dirscanner.getBasedir()), filename)
42 parser = integration.quality.AbldWhatParser(open(filename, 'r'))
43 parser.components_per_file = components_per_file
44 parser.parse()
45
46 for filename in components_per_file.keys():
47 if len(components_per_file[filename]) > 1:
48 output.write(" <file name=\"%s\">\n" % filename)
49 output.write("".join(map(lambda x: " <component name=\"%s\"/>\n" % x, components_per_file[filename])))
50 output.write(" </file>\n")
51 output.write("</buildconflicts>\n")
52 output.close()
53 except Exception, exc:
54 task.log('ERROR: %s' % exc)
55 traceback.print_exc()
56 raise exc
57