Browse Source

New magic name org.apache.ant.scriptcache

master
pyxide Stefan Bodewig 8 years ago
parent
commit
fd0fb26cc5
2 changed files with 11 additions and 1 deletions
  1. +6
    -0
      src/main/org/apache/tools/ant/MagicNames.java
  2. +5
    -1
      src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java

+ 6
- 0
src/main/org/apache/tools/ant/MagicNames.java View File

@@ -55,6 +55,12 @@ public final class MagicNames {
*/
public static final String SCRIPT_REPOSITORY = "org.apache.ant.scriptrepo";

/**
* The name of the script cache used by the script runner.
* Value {@value}
*/
public static final String SCRIPT_CACHE = "org.apache.ant.scriptcache";

/**
* The name of the reference to the System Class Loader.
* Value {@value}


+ 5
- 1
src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java View File

@@ -21,6 +21,7 @@ package org.apache.tools.ant.util.optional;
import java.util.Iterator;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.ReflectWrapper;
import org.apache.tools.ant.util.ScriptRunnerBase;
@@ -84,7 +85,10 @@ public class JavaxScriptRunner extends ScriptRunnerBase {

if (getCompiled()) {

final String compiledScriptRefName = execName + ".compiled." + getScript().hashCode() + "." + getProject().hashCode();
final String compiledScriptRefName = MagicNames.SCRIPT_CACHE + "." + getLanguage() +
"." + getScript().hashCode() + "." +
(null == getClass().getClassLoader() ? 0 : getClass().getClassLoader().hashCode());

if (null == compiledScript) {
compiledScript = getProject().getReference(compiledScriptRefName);
}


Loading…
Cancel
Save