0
|
1 package org.ssdt_ohio.tools.ant;
|
|
2
|
|
3 import org.apache.tools.ant.BuildException;
|
|
4 import org.apache.tools.ant.Project;
|
|
5 import org.apache.tools.ant.Target;
|
|
6 import org.apache.tools.ant.Task;
|
|
7
|
|
8 /** @author smith */
|
|
9 public class AddDependencyTask extends Task {
|
|
10
|
|
11
|
|
12 private String target;
|
|
13 private String depends;
|
|
14
|
|
15 @Override
|
|
16 public void execute() throws BuildException {
|
|
17 if (target == null) {
|
1
|
18 throw new BuildException("'target' attribute is required");
|
0
|
19 }
|
|
20 if (depends == null) {
|
1
|
21 throw new BuildException("'depends' attribute is required");
|
0
|
22 }
|
|
23
|
|
24 Target t = (Target) getProject().getTargets().get(target);
|
|
25
|
|
26 if (t.dependsOn(depends)) {
|
1
|
27 log(target + " already depends on " + depends, Project.MSG_VERBOSE);
|
0
|
28 } else {
|
|
29 log("Adding \"" + depends + "\" dependency to \"" + target + "\"", Project.MSG_VERBOSE);
|
|
30
|
|
31 t.addDependency(depends);
|
|
32 }
|
|
33 }
|
|
34
|
|
35 public void setTarget(String target) {
|
|
36 this.target = target;
|
|
37 }
|
|
38
|
|
39 public void setDepends(String depends) {
|
|
40 this.depends = depends;
|
|
41 }
|
|
42 }
|
|
43
|