diff options
author | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2007-07-08 13:42:46 +0000 |
---|---|---|
committer | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2007-07-08 13:42:46 +0000 |
commit | 5b7e02aad6d9d09dc782f42d5e8feb0e384ec59e (patch) | |
tree | 11879c3f6fc4fcae1506a0e6ec64d7ab9c036a6d /src/net/sf/antcontrib | |
parent | add8fbe1f556a1cc8b1299edf9634c8e769fefd2 (diff) | |
download | cpptasks-parallel-5b7e02aad6d9d09dc782f42d5e8feb0e384ec59e.tar.gz cpptasks-parallel-5b7e02aad6d9d09dc782f42d5e8feb0e384ec59e.tar.bz2 cpptasks-parallel-5b7e02aad6d9d09dc782f42d5e8feb0e384ec59e.tar.xz cpptasks-parallel-5b7e02aad6d9d09dc782f42d5e8feb0e384ec59e.zip |
Fixed NARPLUGIN_116
Diffstat (limited to 'src/net/sf/antcontrib')
-rw-r--r-- | src/net/sf/antcontrib/cpptasks/DependencyInfo.java | 46 | ||||
-rw-r--r-- | src/net/sf/antcontrib/cpptasks/DependencyTable.java | 103 |
2 files changed, 95 insertions, 54 deletions
diff --git a/src/net/sf/antcontrib/cpptasks/DependencyInfo.java b/src/net/sf/antcontrib/cpptasks/DependencyInfo.java index d29826f..d14966e 100644 --- a/src/net/sf/antcontrib/cpptasks/DependencyInfo.java +++ b/src/net/sf/antcontrib/cpptasks/DependencyInfo.java @@ -26,12 +26,15 @@ public final class DependencyInfo { * Not persisted since almost any change could invalidate it. Initialized * to long.MIN_VALUE on construction. */ - private long compositeLastModified; +// FREEHEP +// private long compositeLastModified; private/* final */String includePathIdentifier; private/* final */String[] includes; private/* final */String source; private/* final */long sourceLastModified; private/* final */String[] sysIncludes; +// FREEHEP + private Object tag = null; public DependencyInfo(String includePathIdentifier, String source, long sourceLastModified, Vector includes, Vector sysIncludes) { if (source == null) { @@ -44,13 +47,17 @@ public final class DependencyInfo { this.sourceLastModified = sourceLastModified; this.includePathIdentifier = includePathIdentifier; this.includes = new String[includes.size()]; - if (includes.size() == 0) { - compositeLastModified = sourceLastModified; - } else { - includes.copyInto(this.includes); - compositeLastModified = Long.MIN_VALUE; - } +// BEGINFREEHEP +// if (includes.size() == 0) { +// compositeLastModified = sourceLastModified; +// } else { +// includes.copyInto(this.includes); +// compositeLastModified = Long.MIN_VALUE; +// } +// ENDFREEHEP this.sysIncludes = new String[sysIncludes.size()]; +// FREEHEP + includes.copyInto(this.includes); sysIncludes.copyInto(this.sysIncludes); } /** @@ -60,9 +67,14 @@ public final class DependencyInfo { * @returns the composite lastModified time, returns Long.MIN_VALUE if not * set */ - public long getCompositeLastModified() { - return compositeLastModified; +// BEGINFREEHEP +// public long getCompositeLastModified() { +// return compositeLastModified; +// } + public void setTag(Object t) { + tag = t; } +// ENDFREEHEP public String getIncludePathIdentifier() { return includePathIdentifier; } @@ -80,7 +92,19 @@ public final class DependencyInfo { String[] sysIncludesClone = (String[]) sysIncludes.clone(); return sysIncludesClone; } - public void setCompositeLastModified(long lastMod) { - compositeLastModified = lastMod; +// BEGINFREEHEP + /** + * Returns true, if dependency info is tagged with object t. + * + * @param t object to compare with + * + * @return boolean, true, if tagged with t, otherwise false + */ + public boolean hasTag(Object t) { + return tag == t; } +// public void setCompositeLastModified(long lastMod) { +// compositeLastModified = lastMod; +// } +// ENDFREEHEP } diff --git a/src/net/sf/antcontrib/cpptasks/DependencyTable.java b/src/net/sf/antcontrib/cpptasks/DependencyTable.java index 9e57eb1..ae20496 100644 --- a/src/net/sf/antcontrib/cpptasks/DependencyTable.java +++ b/src/net/sf/antcontrib/cpptasks/DependencyTable.java @@ -178,29 +178,35 @@ public final class DependencyTable { return !noNeedToRebuild; } public boolean preview(DependencyInfo parent, DependencyInfo[] children) { - int withCompositeTimes = 0; - long parentCompositeLastModified = parent.getSourceLastModified(); - for (int i = 0; i < children.length; i++) { +// BEGINFREEHEP +// int withCompositeTimes = 0; +// long parentCompositeLastModified = parent.getSourceLastModified(); +// ENDFREEHEP + for (int i = 0; i < children.length; i++) { if (children[i] != null) { // // expedient way to determine if a child forces us to // rebuild // visit(children[i]); - long childCompositeLastModified = children[i] - .getCompositeLastModified(); - if (childCompositeLastModified != Long.MIN_VALUE) { - withCompositeTimes++; - if (childCompositeLastModified > parentCompositeLastModified) { - parentCompositeLastModified = childCompositeLastModified; - } - } +// BEGINFREEHEP +// long childCompositeLastModified = children[i] +// .getCompositeLastModified(); +// if (childCompositeLastModified != Long.MIN_VALUE) { +// withCompositeTimes++; +// if (childCompositeLastModified > parentCompositeLastModified) { +// parentCompositeLastModified = childCompositeLastModified; +// } +// } +// ENDFREEHEP } } - if (withCompositeTimes == children.length) { - parent.setCompositeLastModified(parentCompositeLastModified); - } - // +// BEGINFREEHEP +// if (withCompositeTimes == children.length) { +// parent.setCompositeLastModified(parentCompositeLastModified); +// } +// ENDFREEHEP + // // may have been changed by an earlier call to visit() // return noNeedToRebuild; @@ -212,8 +218,9 @@ public final class DependencyTable { } public boolean visit(DependencyInfo dependInfo) { if (noNeedToRebuild) { - if (CUtil.isSignificantlyAfter(dependInfo.getSourceLastModified(), outputLastModified) - || CUtil.isSignificantlyAfter(dependInfo.getCompositeLastModified(), outputLastModified)) { + if (CUtil.isSignificantlyAfter(dependInfo.getSourceLastModified(), outputLastModified)) { +//FREEHEP +// || CUtil.isSignificantlyAfter(dependInfo.getCompositeLastModified(), outputLastModified)) { noNeedToRebuild = false; } } @@ -222,8 +229,9 @@ public final class DependencyTable { // it has not yet been determined whether // we need to rebuild and the composite modified time // has not been determined for this file - return noNeedToRebuild - && dependInfo.getCompositeLastModified() == Long.MIN_VALUE; + return noNeedToRebuild; +// FREEHEP +// && dependInfo.getCompositeLastModified() == Long.MIN_VALUE; } } private/* final */File baseDir; @@ -468,35 +476,43 @@ public final class DependencyTable { public void walkDependencies(CCTask task, DependencyInfo dependInfo, CompilerConfiguration compiler, DependencyInfo[] stack, DependencyVisitor visitor) throws BuildException { +// BEGINFREEHEP + if (dependInfo.hasTag(visitor)) { + return; + } + dependInfo.setTag(visitor); +// ENDFREEHEP // // visit this node // if visit returns true then // visit the referenced include and sysInclude dependencies // if (visitor.visit(dependInfo)) { - // - // find first null entry on stack - // - int stackPosition = -1; - for (int i = 0; i < stack.length; i++) { - if (stack[i] == null) { - stackPosition = i; - stack[i] = dependInfo; - break; - } else { - // - // if we have appeared early in the calling history - // then we didn't exceed the criteria - if (stack[i] == dependInfo) { - return; - } - } - } - if (stackPosition == -1) { - visitor.stackExhausted(); - return; - } - // +// BEGINFREEHEP +// // +// // find first null entry on stack +// // +// int stackPosition = -1; +// for (int i = 0; i < stack.length; i++) { +// if (stack[i] == null) { +// stackPosition = i; +// stack[i] = dependInfo; +// break; +// } else { +// // +// // if we have appeared early in the calling history +// // then we didn't exceed the criteria +// if (stack[i] == dependInfo) { +// return; +// } +// } +// } +// if (stackPosition == -1) { +// visitor.stackExhausted(); +// return; +// } +// ENDFREEHEP + // // locate dependency infos // String[] includes = dependInfo.getIncludes(); @@ -546,7 +562,8 @@ public final class DependencyTable { } } } - stack[stackPosition] = null; +// FREEHEP +// stack[stackPosition] = null; } } private void writeDependencyInfo(BufferedWriter writer, StringBuffer buf, |