]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/global/VariableTask.java
f830e0ac76bbd30e63d5223ac2f533b47e65d253
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / global / VariableTask.java
1 /** @file
2 * This file is ANT task VariableTask.
3 *
4 * VariableTask task implements part of ANT property task. The difference is
5 * this task will override variable with same name, but ANT property task do not.
6 *
7 * Copyright (c) 2006, Intel Corporation
8 * All rights reserved. This program and the accompanying materials
9 * are licensed and made available under the terms and conditions of the BSD License
10 * which accompanies this distribution. The full text of the license may be found at
11 * http://opensource.org/licenses/bsd-license.php
12 *
13 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 */
16 package org.tianocore.build.global;
17
18 import org.apache.tools.ant.BuildException;
19 import org.apache.tools.ant.Task;
20
21 /**
22 * VariableTask task implements part of ANT property task. The difference is
23 * this task will override variable with same name, but ANT property task do not.
24 *
25 * @since GenBuild 1.0
26 */
27 public class VariableTask extends Task {
28
29 /**
30 * property value
31 */
32 private String value;
33
34 /**
35 * property name
36 */
37 private String name;
38
39 /**
40 * Set property name.
41 *
42 * @param name property name
43 */
44 public void setName( String name ) {
45 this.name = name;
46 }
47
48
49 /**
50 * Set property value.
51 *
52 * @param value property value
53 */
54 public void setValue( String value ) {
55 this.value = value;
56 }
57
58 /**
59 * ANT task's entry point, will be called after init().
60 *
61 * @exception BuildException
62 * If name or value is null
63 */
64 public void execute() throws BuildException {
65 if (name == null || value == null) {
66 throw new BuildException("Name or value must not null.");
67 }
68 getProject().setProperty(name, value);
69 }
70 }
71