-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathAnt.qll
More file actions
43 lines (36 loc) · 1.32 KB
/
Ant.qll
File metadata and controls
43 lines (36 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Provides classes and predicates for working with targets in Apache Ant build files.
*/
import XML
/** An XML element that represents an Ant target. */
class AntTarget extends XmlElement {
AntTarget() { super.getName() = "target" }
/** Gets the name of this Ant target. */
string getName() { result = this.getAttributeValue("name") }
/**
* Gets a string containing the dependencies of this Ant target,
* without whitespace and with a leading and trailing comma.
*
* This is a utility method used for extracting individual dependencies.
*/
string getDependsString() {
result =
"," +
this.getAttributeValue("depends")
.replaceAll(" ", "")
.replaceAll("\r", "")
.replaceAll("\n", "")
.replaceAll("\t", "") + ","
}
/** Holds if this Ant target depends on the specified target. */
predicate dependsOn(AntTarget that) {
this.getFile() = that.getFile() and
this.getDependsString().matches("%," + that.getName() + ",%")
}
/** Gets an Ant target on which this Ant target depends. */
AntTarget getADependency() { this.dependsOn(result) }
}
/** An Ant target that occurs in an Ant build file with the default name `build.xml`. */
class MainAntTarget extends AntTarget {
MainAntTarget() { this.getFile().getBaseName() = "build.xml" }
}