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
;
17 import org
.apache
.tools
.ant
.BuildException
;
18 import org
.apache
.tools
.ant
.Project
;
19 import org
.apache
.tools
.ant
.Task
;
20 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
21 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
22 import org
.apache
.tools
.ant
.types
.Commandline
;
26 GenDepexTask is to call GenDepex.exe to generate depex section.
29 public class GenDepexTask
extends Task
implements EfiDefine
{
31 /// output binary dependency files name
33 private String outputFile
= "";
35 /// input pre-processed dependency text files name
37 private String inputFile
= "";
39 /// padding integer value
41 private String padding
= "";
45 GenDepexTask execute is to assemble tool command line & execute tool
48 public void execute() throws BuildException
{
50 Project project
= this.getOwningTarget().getProject();
52 // absolute path of edk tools
54 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
59 command
= path
+ "/" + "GenDepex";
62 // argument of GenDepex tool
64 String argument
= inputFile
+ outputFile
+ padding
;
66 // reture value of GenDepex execution
71 Commandline commandLine
= new Commandline();
72 commandLine
.setExecutable(command
);
73 commandLine
.createArgument().setLine(argument
);
75 LogStreamHandler streamHandler
= new LogStreamHandler(this,
76 Project
.MSG_INFO
, Project
.MSG_WARN
);
78 Execute runner
= new Execute(streamHandler
, null);
79 runner
.setAntRun(project
);
80 runner
.setCommandline(commandLine
.getCommandline());
82 System
.out
.println(Commandline
.toString(commandLine
85 returnVal
= runner
.execute();
86 if (EFI_SUCCESS
== returnVal
) {
88 // command execution success
90 System
.out
.println("GenDepex execute succeeded!");
94 // command execution fail
96 System
.out
.println("GenDepex failed. (error="
97 + Integer
.toHexString(returnVal
) + ")");
98 throw new BuildException("GenDepex failed. (error="
99 + Integer
.toHexString(returnVal
) + ")");
101 } catch (Exception e
) {
102 throw new BuildException(e
.getMessage());
109 This function is to set class member "outputFile"
110 @param outputFileName name of output file
112 public void setOutputFile(String outputFileName
) {
113 this.outputFile
= " -O " + outputFileName
;
119 This function is to get class member "outputFile".
121 @return name of ouput file
123 public String
getOutputFile() {
124 return this.outputFile
;
130 This function is to set class member "inputFile".
131 @param inputFileName name of inputFile
133 public void setInputFile(String inputFileName
) {
134 this.inputFile
= " -I " + inputFileName
;
140 This function is to get class member "inputFile"
141 @return name of input file
143 public String
getInputFile() {
144 return this.inputFile
;
150 This function is to set class member "padding"
151 @param paddingNum padding value
153 public void setPadding(String paddingNum
) {
154 this.padding
= " -P " + paddingNum
;
160 This function is to get class member "padding"
161 @return value of padding
163 public String
getPadding() {