Browse Source

Ignore fork attribute if build.compiler doesn't point to a JDK javac.

Submitted by:	Brian Deitte <bdeitte@macromedia.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269488 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
aa4eb280ad
3 changed files with 27 additions and 6 deletions
  1. +4
    -2
      docs/manual/CoreTasks/javac.html
  2. +21
    -3
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  3. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java

+ 4
- 2
docs/manual/CoreTasks/javac.html View File

@@ -31,8 +31,10 @@ inclusion/exclusion of files works, and how to write patterns.</p>
<p>It is possible to use different compilers. This can be selected with the <p>It is possible to use different compilers. This can be selected with the
&quot;build.compiler&quot; property. There are four choices:</p> &quot;build.compiler&quot; property. There are four choices:</p>
<ul> <ul>
<li>classic (the standard compiler of JDK 1.1/1.2)</li>
<li>modern (the new compiler of JDK 1.3)</li>
<li>classic (the standard compiler of JDK 1.1/1.2) - javac1.1 and
javac1.2 can be used as aliases</li>
<li>modern (the standard compiler of JDK 1.3/1.4) - javac1.3 and
javac1.4 can be used as aliases</li>
<li>jikes (the <a <li>jikes (the <a
href="http://oss.software.ibm.com/developerworks/opensource/jikes/project" target="_top">Jikes</a> href="http://oss.software.ibm.com/developerworks/opensource/jikes/project" target="_top">Jikes</a>
compiler)</li> compiler)</li>


+ 21
- 3
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -450,9 +450,18 @@ public class Javac extends MatchingTask {
if (fork) { if (fork) {
if (compiler != null) { if (compiler != null) {
log("Since fork is true, ignoring build.compiler setting.", Project.MSG_WARN);
}
compiler = "extJavac";
if (isJdkCompiler(compiler)) {
log("Since fork is true, ignoring build.compiler setting.",
Project.MSG_WARN);
compiler = "extJavac";
}
else {
log("Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN);
}
}
else {
compiler = "extJavac";
}
} }


if (compiler == null) { if (compiler == null) {
@@ -522,4 +531,13 @@ public class Javac extends MatchingTask {
return compileList; return compileList;
} }


protected boolean isJdkCompiler(String compiler) {
return "modern".equals(compiler) ||
"classic".equals(compiler) ||
"javac1.1".equals(compiler) ||
"javac1.2".equals(compiler) ||
"javac1.3".equals(compiler) ||
"javac1.4".equals(compiler);
}

} }

+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java View File

@@ -109,7 +109,8 @@ public class CompilerAdapterFactory {
return new Javac12(); return new Javac12();
} }
if ( compilerType.equalsIgnoreCase("modern") || if ( compilerType.equalsIgnoreCase("modern") ||
compilerType.equalsIgnoreCase("javac1.3")) {
compilerType.equalsIgnoreCase("javac1.3") ||
compilerType.equalsIgnoreCase("javac1.4")) {
// does the modern compiler exist? // does the modern compiler exist?
try { try {
Class.forName("com.sun.tools.javac.Main"); Class.forName("com.sun.tools.javac.Main");


Loading…
Cancel
Save