Fix a bug on GenBuild and have a minor update on BuildMacro.xml
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / ExpandTask.java
1 /** @file
2 This file is ANT task Expand.
3
4 Expand task is used to prepare ANT properties for further build.
5
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16 package org.tianocore.build;
17
18 import org.apache.tools.ant.BuildException;
19 import org.apache.tools.ant.Task;
20
21 import org.tianocore.build.global.GlobalData;
22
23 /**
24 Expand task is used to prepare ANT properties for further build.
25 <p>Current, prepare the dependent Library instance list for <code>LIBS</code></p>
26
27 @since GenBuild 1.0
28 **/
29 public class ExpandTask extends Task {
30
31 /**
32 Public construct method. It is necessary for ANT task.
33 **/
34 public ExpandTask () {
35 }
36
37 /**
38 ANT task's entry point, will be called after init().
39
40 Set <code>LIBS</code> for further build usage.
41 **/
42 public void execute() throws BuildException {
43 String basename = getProject().getProperty("BASE_NAME");
44 String arch = getProject().getProperty("ARCH");
45 arch = arch.toUpperCase();
46 String[] libraries = GlobalData.getModuleLibrary(basename, arch);
47 String str = "";
48 for (int i = 0; i < libraries.length; i ++){
49 str += " " + GlobalData.getLibrary(libraries[i], arch);
50 }
51 getProject().setProperty("LIBS", str);
52
53 }
54 }