annotate src/org/ssdt_ohio/tools/ant/AddDependencyTask.java @ 1:82fc5e17cc59

clean up task messages
author smith@nwoca.org
date Sat, 16 Apr 2011 16:22:27 -0400
parents 1918a6aed50a
children de1522a9d4bc
rev   line source
0
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
1 package org.ssdt_ohio.tools.ant;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
2
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
3 import org.apache.tools.ant.BuildException;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
4 import org.apache.tools.ant.Project;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
5 import org.apache.tools.ant.Target;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
6 import org.apache.tools.ant.Task;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
7
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
8 /** @author smith */
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
9 public class AddDependencyTask extends Task {
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
10
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
11
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
12 private String target;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
13 private String depends;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
14
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
15 @Override
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
16 public void execute() throws BuildException {
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
17 if (target == null) {
1
82fc5e17cc59 clean up task messages
smith@nwoca.org
parents: 0
diff changeset
18 throw new BuildException("'target' attribute is required");
0
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
19 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
20 if (depends == null) {
1
82fc5e17cc59 clean up task messages
smith@nwoca.org
parents: 0
diff changeset
21 throw new BuildException("'depends' attribute is required");
0
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
22 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
23
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
24 Target t = (Target) getProject().getTargets().get(target);
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
25
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
26 if (t.dependsOn(depends)) {
1
82fc5e17cc59 clean up task messages
smith@nwoca.org
parents: 0
diff changeset
27 log(target + " already depends on " + depends, Project.MSG_VERBOSE);
0
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
28 } else {
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
29 log("Adding \"" + depends + "\" dependency to \"" + target + "\"", Project.MSG_VERBOSE);
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
30
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
31 t.addDependency(depends);
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
32 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
33 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
34
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
35 public void setTarget(String target) {
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
36 this.target = target;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
37 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
38
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
39 public void setDepends(String depends) {
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
40 this.depends = depends;
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
41 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
42 }
1918a6aed50a Initial ant tasks for SSDT develkit
smith@nwoca.org
parents:
diff changeset
43