]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / types / ConditionalFileSet.java
CommitLineData
878ddf1f 1/*\r
2 * \r
3 * Copyright 2001-2004 The Ant-Contrib project\r
4 *\r
5 * Licensed under the Apache License, Version 2.0 (the "License");\r
6 * you may not use this file except in compliance with the License.\r
7 * You may obtain a copy of the License at\r
8 *\r
9 * http://www.apache.org/licenses/LICENSE-2.0\r
10 *\r
11 * Unless required by applicable law or agreed to in writing, software\r
12 * distributed under the License is distributed on an "AS IS" BASIS,\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 * See the License for the specific language governing permissions and\r
15 * limitations under the License.\r
16 */\r
17package net.sf.antcontrib.cpptasks.types;\r
18import net.sf.antcontrib.cpptasks.CUtil;\r
19\r
20import org.apache.tools.ant.BuildException;\r
21import org.apache.tools.ant.Project;\r
22import org.apache.tools.ant.types.AbstractFileSet;\r
23import org.apache.tools.ant.types.FileSet;\r
24/**\r
25 * An Ant FileSet object augmented with if and unless conditions.\r
26 * \r
27 * @author Curt Arnold\r
28 */\r
29public class ConditionalFileSet extends FileSet {\r
30 private String ifCond;\r
31 private String unlessCond;\r
32 public ConditionalFileSet() {\r
33 }\r
34 public void execute() throws org.apache.tools.ant.BuildException {\r
35 throw new org.apache.tools.ant.BuildException(\r
36 "Not an actual task, but looks like one for documentation purposes");\r
37 }\r
38 /**\r
39 * overrides FileSet's implementation which would throw an exception since\r
40 * the referenced object isn't this type.\r
41 */\r
42 protected AbstractFileSet getRef(Project p) {\r
43 return (AbstractFileSet) getRefid().getReferencedObject(p);\r
44 }\r
45 /**\r
46 * Returns true if the Path's if and unless conditions (if any) are\r
47 * satisfied.\r
48 */\r
49 public boolean isActive() throws BuildException {\r
50 Project p = getProject();\r
51 if (p == null) {\r
52 throw new java.lang.IllegalStateException(\r
53 "setProject() should have been called");\r
54 }\r
55 return CUtil.isActive(p, ifCond, unlessCond);\r
56 }\r
57 /**\r
58 * Sets the property name for the 'if' condition.\r
59 * \r
60 * The fileset will be ignored unless the property is defined.\r
61 * \r
62 * The value of the property is insignificant, but values that would imply\r
63 * misinterpretation ("false", "no") will throw an exception when\r
64 * evaluated.\r
65 */\r
66 public void setIf(String propName) {\r
67 ifCond = propName;\r
68 }\r
69 /**\r
70 * Set the property name for the 'unless' condition.\r
71 * \r
72 * If named property is set, the fileset will be ignored.\r
73 * \r
74 * The value of the property is insignificant, but values that would imply\r
75 * misinterpretation ("false", "no") of the behavior will throw an\r
76 * exception when evaluated.\r
77 * \r
78 * @param propName\r
79 * name of property\r
80 */\r
81 public void setUnless(String propName) {\r
82 unlessCond = propName;\r
83 }\r
84}\r