X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkTasks%2Forg%2Ftianocore%2Fframework%2Ftasks%2FFlashMapTask.java;h=5265f7c7d6cd006753deae78281bf1ea37623504;hp=be6c21a292631620a5975c6e460c586c65001d69;hb=d946661a82d929b61603cf60fa2fd51fae654926;hpb=d1760183fdfac71899bbe0c41894dd34ee022da1 diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java index be6c21a292..5265f7c7d6 100644 --- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java +++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java @@ -135,6 +135,16 @@ public class FlashMapTask extends Task implements EfiDefine { @throws BuidException **/ public void execute() throws BuildException { + if (isUptodate()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, headerFile.toFileList() + + imageOutFile.toFileList() + + mcoFile.toFileList() + + dscFile.toFileList() + + asmIncFile.toFileList() + + outStrFile + + " is/are up-to-date!"); + return; + } Project project = this.getOwningTarget().getProject(); // @@ -598,4 +608,143 @@ public class FlashMapTask extends Task implements EfiDefine { public void setOutputDir(String outputDir) { this.outputDir = outputDir; } + + // + // Dependency check + // + private boolean isUptodate() { + long srcTimeStamp = 0; + String srcName = ""; + long dstTimeStamp = 0; + String dstName = ""; + long timeStamp = 0; + + if (!flashDefFile.isEmpty()) { + srcName = flashDefFile.getValue(); + timeStamp = new File(srcName).lastModified(); + if (timeStamp > srcTimeStamp) { + srcTimeStamp = timeStamp; + } + } + + if (!mciFile.isEmpty()) { + srcName = mciFile.getValue(); + timeStamp = new File(srcName).lastModified(); + if (timeStamp > srcTimeStamp) { + srcTimeStamp = timeStamp; + } + } + + if (!fdImage.isEmpty()) { + srcName = fdImage.getValue(); + timeStamp = new File(srcName).lastModified(); + if (timeStamp > srcTimeStamp) { + srcTimeStamp = timeStamp; + } + } + + if (inStrFile.length() != 0) { + srcName = inStrFile; + timeStamp = new File(srcName).lastModified(); + if (timeStamp > srcTimeStamp) { + srcTimeStamp = timeStamp; + } + } + + if (!mciFileArray.isEmpty()) { + for (int i = 0; i < mciFileArray.nameList.size(); ++i) { + srcName += mciFileArray.nameList.get(i) + " "; + timeStamp = new File(mciFileArray.nameList.get(i)).lastModified(); + if (timeStamp > srcTimeStamp) { + srcTimeStamp = timeStamp; + } + } + } + + if (!headerFile.isEmpty()) { + dstName = headerFile.getValue(); + File dstFile = new File(dstName); + if (!dstFile.isAbsolute()) { + dstName = outputDir + File.separator + dstName; + dstFile = new File(dstName); + } + + if (srcTimeStamp > dstFile.lastModified()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!"); + return false; + } + } + + if (!imageOutFile.isEmpty()) { + dstName = imageOutFile.getValue(); + File dstFile = new File(dstName); + if (!dstFile.isAbsolute()) { + dstName = outputDir + File.separator + dstName; + dstFile = new File(dstName); + } + + if (srcTimeStamp > dstFile.lastModified()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!"); + return false; + } + } + + if (!mcoFile.isEmpty()) { + dstName = mcoFile.getValue(); + File dstFile = new File(dstName); + if (!dstFile.isAbsolute()) { + dstName = outputDir + File.separator + dstName; + dstFile = new File(dstName); + } + + if (srcTimeStamp > dstFile.lastModified()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!"); + return false; + } + } + + if (!dscFile.isEmpty()) { + dstName = dscFile.getValue(); + File dstFile = new File(dstName); + if (!dstFile.isAbsolute()) { + dstName = outputDir + File.separator + dstName; + dstFile = new File(dstName); + } + + if (srcTimeStamp > dstFile.lastModified()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!"); + return false; + } + } + + if (!asmIncFile.isEmpty()) { + dstName = asmIncFile.getValue(); + File dstFile = new File(dstName); + if (!dstFile.isAbsolute()) { + dstName = outputDir + File.separator + dstName; + dstFile = new File(dstName); + } + + if (srcTimeStamp > dstFile.lastModified()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!"); + return false; + } + } + + if (outStrFile.length() != 0) { + dstName = outStrFile; + File dstFile = new File(dstName); + if (!dstFile.isAbsolute()) { + dstName = outputDir + File.separator + dstName; + dstFile = new File(dstName); + } + + if (srcTimeStamp > dstFile.lastModified()) { + EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!"); + return false; + } + } + + return true; + } }