comparison src/org/ssdt_ohio/tools/ant/AddDependencyTask.java @ 0:1918a6aed50a

Initial ant tasks for SSDT develkit
author smith@nwoca.org
date Sat, 16 Apr 2011 16:06:16 -0400
parents
children 82fc5e17cc59
comparison
equal deleted inserted replaced
-1:000000000000 0:1918a6aed50a
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) {
18 throw new BuildException("target attribute is required");
19 }
20 if (depends == null) {
21 throw new BuildException("depends attribute is required");
22 }
23
24 Target t = (Target) getProject().getTargets().get(target);
25
26 if (t.dependsOn(depends)) {
27 log(target +" already depends on " + depends, Project.MSG_VERBOSE);
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