// FREEHEP added synchronized public synchronized void markForRebuild(TargetInfo targetInfo) { // // if it must already be rebuilt, no need to check further // if (!targetInfo.getRebuild()) { TargetHistory history = get(targetInfo.getConfiguration().toString(), targetInfo.getOutput().getName()); if (history == null) { targetInfo.mustRebuild(); } else { SourceHistory[] sourceHistories = history.getSources(); File[] sources = targetInfo.getSources(); if (sourceHistories.length != sources.length) { targetInfo.mustRebuild(); } else { Hashtable sourceMap = new Hashtable(sources.length); for (int i = 0; i < sources.length; i++) { try { sourceMap.put(sources[i].getCanonicalPath(), sources[i]); } catch (IOException ex) { sourceMap.put(sources[i].getAbsolutePath(), sources[i]); } } for (int i = 0; i < sourceHistories.length; i++) { // // relative file name, must absolutize it on output // directory // String absPath = sourceHistories[i].getAbsolutePath(outputDir); File match = (File) sourceMap.get(absPath); if (match != null) { try { match = (File) sourceMap.get(new File(absPath).getCanonicalPath()); } catch (IOException ex) { targetInfo.mustRebuild(); break; } } if (match == null || match.lastModified() != sourceHistories[i].getLastModified()) { targetInfo.mustRebuild(); break; } } } } } }
// FREEHEP added synchronized public synchronized void update(TargetInfo linkTarget) { File outputFile = linkTarget.getOutput(); String outputName = outputFile.getName(); // // if output file doesn't exist or predates the start of the // compile or link step (most likely a compilation error) then // do not write add a history entry // if (outputFile.exists() && !CUtil.isSignificantlyBefore(outputFile.lastModified(), historyFile.lastModified())) { dirty = true; history.remove(outputName); SourceHistory[] sourceHistories = linkTarget.getSourceHistories(outputDirPath); TargetHistory newHistory = new TargetHistory( linkTarget.getConfiguration().getIdentifier(), outputName, outputFile.lastModified(), sourceHistories); history.put(outputName, newHistory); } }