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
;
19 import org
.apache
.tools
.ant
.BuildException
;
20 import org
.apache
.tools
.ant
.Project
;
21 import org
.apache
.tools
.ant
.Task
;
22 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
23 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
24 import org
.apache
.tools
.ant
.types
.Commandline
;
28 GenDepexTask is to call GenDepex.exe to generate depex section.
31 public class GenDepexTask
extends Task
implements EfiDefine
{
33 /// output binary dependency files name
35 private String outputFile
= "";
37 /// input pre-processed dependency text files name
39 private String inputFile
= "";
40 private String inputFileName
= "";
42 /// padding integer value
44 private String padding
= "";
48 GenDepexTask execute is to assemble tool command line & execute tool
51 public void execute() throws BuildException
{
53 Project project
= this.getOwningTarget().getProject();
55 // absolute path of edk tools
57 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
62 command
= path
+ "/" + "GenDepex";
65 // argument of GenDepex tool
67 String argument
= inputFile
+ outputFile
+ padding
;
69 // reture value of GenDepex execution
74 Commandline commandLine
= new Commandline();
75 commandLine
.setExecutable(command
);
76 commandLine
.createArgument().setLine(argument
);
78 LogStreamHandler streamHandler
= new LogStreamHandler(this,
79 Project
.MSG_INFO
, Project
.MSG_WARN
);
81 Execute runner
= new Execute(streamHandler
, null);
82 runner
.setAntRun(project
);
83 runner
.setCommandline(commandLine
.getCommandline());
85 log(Commandline
.toString(commandLine
.getCommandline()), Project
.MSG_VERBOSE
);
87 returnVal
= runner
.execute();
88 if (EFI_SUCCESS
== returnVal
) {
89 log("GenDepex succeeded!", Project
.MSG_VERBOSE
);
92 // command execution fail
94 log("ERROR = " + Integer
.toHexString(returnVal
));
95 throw new BuildException("GenDepex failed!");
97 } catch (Exception e
) {
98 throw new BuildException(e
.getMessage());
105 This function is to set class member "outputFile"
106 @param outputFileName name of output file
108 public void setOutputFile(String outputFileName
) {
109 this.outputFile
= " -O " + outputFileName
;
115 This function is to get class member "outputFile".
117 @return name of ouput file
119 public String
getOutputFile() {
120 return this.outputFile
;
126 This function is to set class member "inputFile".
127 @param inputFileName name of inputFile
129 public void setInputFile(String inputFileName
) {
130 this.inputFileName
= (new File(inputFileName
)).getName();
131 this.inputFile
= " -I " + inputFileName
;
137 This function is to get class member "inputFile"
138 @return name of input file
140 public String
getInputFile() {
141 return this.inputFile
;
147 This function is to set class member "padding"
148 @param paddingNum padding value
150 public void setPadding(String paddingNum
) {
151 this.padding
= " -P " + paddingNum
;
157 This function is to get class member "padding"
158 @return value of padding
160 public String
getPadding() {