]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalPath.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / types / ConditionalPath.java
1 /*
2 *
3 * Copyright 2001-2004 The Ant-Contrib project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package net.sf.antcontrib.cpptasks.types;
18 import java.io.File;
19
20 import net.sf.antcontrib.cpptasks.CUtil;
21
22 import org.apache.tools.ant.BuildException;
23 import org.apache.tools.ant.Project;
24 import org.apache.tools.ant.types.Path;
25 /**
26 * An Ant Path object augmented with if and unless conditionals
27 *
28 * @author Curt Arnold
29 */
30 public class ConditionalPath extends Path {
31 private String ifCond;
32 private String unlessCond;
33 private File file;
34 public ConditionalPath(Project project) {
35 super(project);
36 }
37 public ConditionalPath(Project p, String path) {
38 super(p, path);
39 }
40 public File getFile() {
41 return file;
42 }
43 /**
44 * Returns true if the Path's if and unless conditions (if any) are
45 * satisfied.
46 */
47 public boolean isActive(org.apache.tools.ant.Project p)
48 throws BuildException {
49 return CUtil.isActive(p, ifCond, unlessCond);
50 }
51 /**
52 * Sets the property name for the 'if' condition.
53 *
54 * The path will be ignored unless the property is defined.
55 *
56 * The value of the property is insignificant, but values that would imply
57 * misinterpretation ("false", "no") will throw an exception when
58 * evaluated.
59 *
60 * @param propName
61 * property name
62 */
63 public void setIf(String propName) {
64 ifCond = propName;
65 }
66 /**
67 * Set the property name for the 'unless' condition.
68 *
69 * If named property is set, the path will be ignored.
70 *
71 * The value of the property is insignificant, but values that would imply
72 * misinterpretation ("false", "no") of the behavior will throw an
73 * exception when evaluated.
74 *
75 * @param propName
76 * name of property
77 */
78 public void setUnless(String propName) {
79 unlessCond = propName;
80 }
81 /**
82 * Specifies the file which lists many include paths that should appear on
83 * the command line. Each line is an include path. The includepath will be
84 * quated if it contains embedded blanks.
85 *
86 * @param file
87 * name of the file
88 */
89 public void setFile(File file) {
90 this.file = file;
91 }
92 }