4 GenDepexTask is to call GenDepex.exe to generate depex section.
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
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.
16 package org
.tianocore
.framework
.tasks
;
20 import org
.apache
.tools
.ant
.BuildException
;
21 import org
.apache
.tools
.ant
.Project
;
22 import org
.apache
.tools
.ant
.Task
;
23 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
24 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
25 import org
.apache
.tools
.ant
.types
.Commandline
;
27 import org
.tianocore
.common
.logger
.EdkLog
;
32 GenDepexTask is to call GenDepex.exe to generate depex section.
35 public class GenDepexTask
extends Task
implements EfiDefine
{
36 private static String toolName
= "GenDepex";
38 // output binary dependency files name
40 private FileArg outputFile
= new FileArg();
42 // input pre-processed dependency text files name
44 private FileArg inputFile
= new FileArg();
46 // padding integer value
48 private ToolArg padding
= new FileArg();
52 GenDepexTask execute is to assemble tool command line & execute tool
55 public void execute() throws BuildException
{
57 Project project
= this.getOwningTarget().getProject();
59 // absolute path of edk tools
61 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
66 command
= path
+ File
.separator
+ toolName
;
69 // argument of GenDepex tool
71 String argument
= "" + inputFile
+ outputFile
+ padding
;
73 // reture value of GenDepex execution
78 Commandline commandLine
= new Commandline();
79 commandLine
.setExecutable(command
);
80 commandLine
.createArgument().setLine(argument
);
82 LogStreamHandler streamHandler
= new LogStreamHandler(this,
83 Project
.MSG_INFO
, Project
.MSG_WARN
);
85 Execute runner
= new Execute(streamHandler
, null);
86 runner
.setAntRun(project
);
87 runner
.setCommandline(commandLine
.getCommandline());
89 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(commandLine
.getCommandline()));
90 EdkLog
.log(this, inputFile
.toFileList() + " => " + outputFile
.toFileList());
92 returnVal
= runner
.execute();
93 if (EFI_SUCCESS
== returnVal
) {
94 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, "GenDepex succeeded!");
97 // command execution fail
99 EdkLog
.log(this, "ERROR = " + Integer
.toHexString(returnVal
));
100 throw new BuildException("GenDepex failed!");
102 } catch (Exception e
) {
103 throw new BuildException(e
.getMessage());
110 This function is to set class member "outputFile"
111 @param outputFileName name of output file
113 public void setOutputFile(String outputFileName
) {
114 this.outputFile
.setArg(" -O ", outputFileName
);
120 This function is to get class member "outputFile".
122 @return name of ouput file
124 public String
getOutputFile() {
125 return this.outputFile
.getValue();
131 This function is to set class member "inputFile".
132 @param inputFileName name of inputFile
134 public void setInputFile(String inputFileName
) {
135 this.inputFile
.setArg(" -I ", inputFileName
);
141 This function is to get class member "inputFile"
142 @return name of input file
144 public String
getInputFile() {
145 return this.inputFile
.getValue();
151 This function is to set class member "padding"
152 @param paddingNum padding value
154 public void setPadding(String paddingNum
) {
155 this.padding
.setArg(" -P ", paddingNum
);
161 This function is to get class member "padding"
162 @return value of padding
164 public String
getPadding() {
165 return this.padding
.getValue();