]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/types/ConditionalFileSet.java
3 * Copyright 2001-2004 The Ant-Contrib project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package net
.sf
.antcontrib
.cpptasks
.types
;
18 import net
.sf
.antcontrib
.cpptasks
.CUtil
;
20 import org
.apache
.tools
.ant
.BuildException
;
21 import org
.apache
.tools
.ant
.Project
;
22 import org
.apache
.tools
.ant
.types
.AbstractFileSet
;
23 import org
.apache
.tools
.ant
.types
.FileSet
;
25 * An Ant FileSet object augmented with if and unless conditions.
29 public class ConditionalFileSet
extends FileSet
{
30 private String ifCond
;
31 private String unlessCond
;
32 public ConditionalFileSet() {
34 public void execute() throws org
.apache
.tools
.ant
.BuildException
{
35 throw new org
.apache
.tools
.ant
.BuildException(
36 "Not an actual task, but looks like one for documentation purposes");
39 * overrides FileSet's implementation which would throw an exception since
40 * the referenced object isn't this type.
42 protected AbstractFileSet
getRef(Project p
) {
43 return (AbstractFileSet
) getRefid().getReferencedObject(p
);
46 * Returns true if the Path's if and unless conditions (if any) are
49 public boolean isActive() throws BuildException
{
50 Project p
= getProject();
52 throw new java
.lang
.IllegalStateException(
53 "setProject() should have been called");
55 return CUtil
.isActive(p
, ifCond
, unlessCond
);
58 * Sets the property name for the 'if' condition.
60 * The fileset will be ignored unless the property is defined.
62 * The value of the property is insignificant, but values that would imply
63 * misinterpretation ("false", "no") will throw an exception when
66 public void setIf(String propName
) {
70 * Set the property name for the 'unless' condition.
72 * If named property is set, the fileset will be ignored.
74 * The value of the property is insignificant, but values that would imply
75 * misinterpretation ("false", "no") of the behavior will throw an
76 * exception when evaluated.
81 public void setUnless(String propName
) {
82 unlessCond
= propName
;