Fixed EDKT102;

Fixed some dependency check issue and made several optimizations on the dependency check logic. Now the rebuild is speeded up enormously.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@885 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36
2006-07-12 02:41:10 +00:00
parent a99a79e46f
commit 196ad8d77c
6 changed files with 75 additions and 38 deletions

View File

@@ -282,7 +282,7 @@ public class FrameworkBuildTask extends Task{
GlobalData.setToolChainEnvInfo(envToolChainInfo);
str = getValue("TOOL_CHAIN_CONF", targetFileInfo);
if (str != null) {
if (str != null && str.trim().length() > 0) {
toolsDefFilename = str;
}

View File

@@ -247,7 +247,7 @@ public class GenBuildTask extends Ant {
// don't do anything if no tools found
//
if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {
System.out.println("!!!Warning: No build issued. No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
System.out.println("Warning: No build issued. No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
continue;
}
@@ -431,7 +431,6 @@ public class GenBuildTask extends Ant {
key[4] = "NAME";
String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);
File cmdFile = new File(cmdPath + File.separatorChar + cmdName);
// GlobalData.log.info("PATH: " + cmdFile.getPath());
getProject().setProperty(cmd[m], cmdFile.getPath().replaceAll("(\\\\)", "/"));
//
@@ -439,7 +438,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "FLAGS";
String cmdFlags = GlobalData.getCommandSetting(key, fpdModuleId);
// GlobalData.log.info("Flags: " + cmdFlags);
Set<String> addset = new LinkedHashSet<String>();
Set<String> subset = new LinkedHashSet<String>();
putFlagsToSet(addset, cmdFlags);
@@ -450,7 +448,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "EXT";
String extName = GlobalData.getCommandSetting(key, fpdModuleId);
// GlobalData.log.info("Ext: " + extName);
if ( extName != null && ! extName.equalsIgnoreCase("")) {
getProject().setProperty(cmd[m] + "_EXT", extName);
}
@@ -463,7 +460,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "FAMILY";
String toolChainFamily = GlobalData.getCommandSetting(key, fpdModuleId);
// GlobalData.log.info("FAMILY: " + toolChainFamily);
if (toolChainFamily != null) {
getProject().setProperty(cmd[m] + "_FAMILY", toolChainFamily);
}
@@ -473,7 +469,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "SPATH";
String spath = GlobalData.getCommandSetting(key, fpdModuleId);
// GlobalData.log.info("SPATH: " + spath);
if (spath != null) {
getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));
}
@@ -486,7 +481,6 @@ public class GenBuildTask extends Ant {
//
key[4] = "DPATH";
String dpath = GlobalData.getCommandSetting(key, fpdModuleId);
// GlobalData.log.info("DPATH: " + dpath);
if (dpath != null) {
getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));
}

View File

@@ -549,7 +549,7 @@ public class ModuleBuildFileGenerator {
return ;
}
if (fp.initSections(ffsKeyword, project, fpdModuleId)) {
String targetFilename = fpdModuleId.getModule().getGuid() + "-" + fpdModuleId.getModule().getName() + FpdParserTask.getSuffix(fpdModuleId.getModule().getModuleType());
String targetFilename = fpdModuleId.getModule().getGuid() + "-" + "${BASE_NAME}" + FpdParserTask.getSuffix(fpdModuleId.getModule().getModuleType());
String[] list = fp.getGenSectionElements(document, "${BASE_NAME}", fpdModuleId.getModule().getGuid(), targetFilename);
for (int i = 0; i < list.length; i++) {

View File

@@ -16,10 +16,14 @@ package org.tianocore.build.global;
import java.util.ArrayList;
import java.util.List;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.DataType;
import org.apache.tools.ant.types.FileSet;
/**
DpFileList is a container of Dpfile at the point of ANT task/datatype
**/
public class DpFileList {
public class DpFileList extends DataType {
///
/// Keep all the file names from all nested DpFile
///
@@ -46,5 +50,15 @@ public class DpFileList {
public void addConfiguredFile(DpFile f) {
this.nameList.addAll(f.getList());
}
public void addConfiguredFileSet(FileSet fileSet) {
DirectoryScanner ds = fileSet.getDirectoryScanner(getProject());
String dir = fileSet.getDir(getProject()).getAbsolutePath();
String[] files = ds.getIncludedFiles();
for (int i = 0; i < files.length; ++i) {
nameList.add(dir + "/" + files[i]);
}
}
}

View File

@@ -13,19 +13,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
--*/
package org.tianocore.build.global;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Sequential;
import java.io.File;
import java.util.Iterator;
/**
Class OnDepdendency is used to check the timestamp between source files and
target files, which can be used to determine if the target files are needed to
be re-generated from source files.
**/
public class OnDependency extends Task {
///
/// cache the modified timestamp of files accessed, to speed up the depencey check
///
private static Map<String, Long> timeStampCache = new HashMap<String, Long>();
///
/// source files list
///
@@ -77,12 +83,20 @@ public class OnDependency extends Task {
Iterator srcIt = sources.nameList.iterator();
while (srcIt.hasNext()) {
String srcFileName = (String)srcIt.next();
File srcFile = new File(srcFileName);
if (!srcFile.exists()) {
throw new BuildException(srcFileName + " doesn't exist !!!");
long srcTimeStamp;
if (timeStampCache.containsKey(srcFileName)) {
srcTimeStamp = ((Long)timeStampCache.get(srcFileName)).longValue();
} else {
File srcFile = new File(srcFileName);
if (!srcFile.exists()) {
throw new BuildException(srcFileName + " doesn't exist !!!");
}
srcTimeStamp = srcFile.lastModified();
timeStampCache.put(srcFileName, new Long(srcTimeStamp));
}
if (dstTimeStamp < srcFile.lastModified()) {
if (dstTimeStamp < srcTimeStamp) {
return true;
}
}