You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/05/15 14:44:01 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/compilers DefaultCompilerAdapter.java Gcj.java Jikes.java Jvc.java Sj.java
bodewig 2003/05/15 05:44:01
Modified: . WHATSNEW
docs/manual/CoreTasks javac.html
src/main/org/apache/tools/ant/taskdefs Javac.java
src/main/org/apache/tools/ant/taskdefs/compilers
DefaultCompilerAdapter.java Gcj.java Jikes.java
Jvc.java Sj.java
Log:
<javac>'s executable attribute can now also be used to specify the
executable for jikes, jvc, sj or gcj.
PR: 13814
<javac> has a new attribute tempdir that can control the placement of
temporary files.
PR: 19765
A new magic property build.compiler.jvc.extensions has been added that
can be used to turn of Microsoft extensions while using the jvc
compiler.
PR: 19826
Submitted by: Joseph Walton <joe at kafsemo dot org>
Revision Changes Path
1.419 +10 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.418
retrieving revision 1.419
diff -u -r1.418 -r1.419
--- WHATSNEW 14 May 2003 15:01:12 -0000 1.418
+++ WHATSNEW 15 May 2003 12:44:00 -0000 1.419
@@ -331,6 +331,16 @@
* <javadoc> now supports the -noqualifier switch. Bugzilla Report 19288.
+* <javac>'s executable attribute can now also be used to specify the
+ executable for jikes, jvc, sj or gcj. Bugzilla Report 13814.
+
+* <javac> has a new attribute tempdir that can control the placement
+ of temporary files. Bugzilla Report 19765.
+
+* A new magic property build.compiler.jvc.extensions has been added
+ that can be used to turn of Microsoft extensions while using the jvc
+ compiler. Bugzilla Report 19826.
+
Changes from Ant 1.5.2 to Ant 1.5.3
===================================
1.40 +16 -1 ant/docs/manual/CoreTasks/javac.html
Index: javac.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/javac.html,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- javac.html 19 Mar 2003 08:26:58 -0000 1.39
+++ javac.html 15 May 2003 12:44:00 -0000 1.40
@@ -276,7 +276,9 @@
<td valign="top">Complete path to the <code>javac</code>
executable to use in case of <code>fork="yes"</code>.
Defaults to the compiler of the Java version that is currently
- running Ant. Ignored if <code>fork="no"</code></td>
+ running Ant. Ignored if <code>fork="no"</code>.<br>
+ Since Ant 1.6 this attribute can also be used to specify the
+ path to the executable when using jikes, jvc, gcj or sj.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
@@ -334,6 +336,13 @@
be listed; defaults to <code>no</code>.</td>
<td align="center" valign="top">No</td>
</tr>
+ <tr>
+ <td valign="top">tempdir</td>
+ <td valign="top">Where Ant should place temporary files.
+ <em>Since Ant 1.6</em>.</td>
+ <td align="center" valign="top">No; default is the current working
+ directory.</td>
+ </tr>
</table>
<h3>Parameters specified as nested elements</h3>
@@ -562,6 +571,12 @@
</td>
</tr>
</table>
+
+<h3>Jvc Notes</h3>
+
+<p>Jvc will enable Microsoft extensions unless you set the property
+<code>build.compiler.jvc.extensions</code> to false before invoking
+<code><javac></code>.</p>
<hr>
<p align="center">Copyright © 2000-2003 Apache Software Foundation.
1.111 +37 -2 ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
Index: Javac.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- Javac.java 7 Mar 2003 11:23:01 -0000 1.110
+++ Javac.java 15 May 2003 12:44:01 -0000 1.111
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -141,6 +141,7 @@
private String source;
private String debugLevel;
+ private File tmpDir;
/**
* Javac task for compilation of Java files.
@@ -596,6 +597,15 @@
}
/**
+ * The value of the executable attribute, if any.
+ *
+ * @since Ant 1.6
+ */
+ public String getExecutable() {
+ return forkedExecutable;
+ }
+
+ /**
* Is this a forked invocation of JDK's javac?
*/
public boolean isForkedJavac() {
@@ -604,6 +614,14 @@
/**
* The name of the javac executable to use in fork-mode.
+ *
+ * <p>This is either the name specified with the executable
+ * attribute or the full path of the javac compiler of the VM Ant
+ * is currently running in - guessed by Ant.</p>
+ *
+ * <p>You should <strong>not</strong> invoke this method if you
+ * want to get the value of the executable command - use {@link
+ * #getExecutable getExecutable} for this.</p>
*/
public String getJavacExecutable() {
if (forkedExecutable == null && isForkedJavac()) {
@@ -653,6 +671,23 @@
}
}
+ /**
+ * Where Ant should place temporary files.
+ *
+ * @since Ant 1.6
+ */
+ public void setTempdir(File tmpDir) {
+ this.tmpDir = tmpDir;
+ }
+
+ /**
+ * Where Ant should place temporary files.
+ *
+ * @since Ant 1.6
+ */
+ public File getTempdir() {
+ return tmpDir;
+ }
/**
* Executes the task.
1.36 +12 -2 ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
Index: DefaultCompilerAdapter.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- DefaultCompilerAdapter.java 29 Apr 2003 13:16:22 -0000 1.35
+++ DefaultCompilerAdapter.java 15 May 2003 12:44:01 -0000 1.36
@@ -153,6 +153,13 @@
}
/**
+ * @since Ant 1.6
+ */
+ protected Project getProject() {
+ return project;
+ }
+
+ /**
* Builds the compilation classpath.
*
*/
@@ -432,8 +439,11 @@
&& firstFileName >= 0) {
PrintWriter out = null;
try {
- String userDirName = System.getProperty("user.dir");
- File userDir = new File(userDirName);
+ File userDir = getJavac().getTempdir();
+ if (userDir == null) {
+ String userDirName = System.getProperty("user.dir");
+ userDir = new File(userDirName);
+ }
tmpFile = fileUtils.createTempFile("files", "", userDir);
out = new PrintWriter(new FileWriter(tmpFile));
for (int i = firstFileName; i < args.length; i++) {
1.13 +3 -2 ant/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java
Index: Gcj.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Gcj.java 10 Feb 2003 14:13:42 -0000 1.12
+++ Gcj.java 15 May 2003 12:44:01 -0000 1.13
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -112,7 +112,8 @@
classpath.append(src);
}
- cmd.setExecutable("gcj");
+ String exec = getJavac().getExecutable();
+ cmd.setExecutable(exec == null ? "gcj" : exec);
if (destDir != null) {
cmd.createArgument().setValue("-d");
1.19 +2 -1 ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java
Index: Jikes.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Jikes.java 14 Apr 2003 11:47:42 -0000 1.18
+++ Jikes.java 15 May 2003 12:44:01 -0000 1.19
@@ -124,7 +124,8 @@
}
Commandline cmd = new Commandline();
- cmd.setExecutable("jikes");
+ String exec = getJavac().getExecutable();
+ cmd.setExecutable(exec == null ? "jikes" : exec);
if (deprecation == true) {
cmd.createArgument().setValue("-deprecation");
1.15 +15 -5 ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java
Index: Jvc.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Jvc.java 20 Mar 2003 09:10:54 -0000 1.14
+++ Jvc.java 15 May 2003 12:44:01 -0000 1.15
@@ -104,7 +104,8 @@
}
Commandline cmd = new Commandline();
- cmd.setExecutable("jvc");
+ String exec = getJavac().getExecutable();
+ cmd.setExecutable(exec == null ? "jvc" : exec);
if (destDir != null) {
cmd.createArgument().setValue("/d");
@@ -115,10 +116,19 @@
cmd.createArgument().setValue("/cp:p");
cmd.createArgument().setPath(classpath);
- // Enable MS-Extensions and ...
- cmd.createArgument().setValue("/x-");
- // ... do not display a Message about this.
- cmd.createArgument().setValue("/nomessage");
+ boolean msExtensions = true;
+ String mse = getProject().getProperty("build.compiler.jvc.extensions");
+ if (mse != null) {
+ msExtensions = Project.toBoolean(mse);
+ }
+
+ if (msExtensions) {
+ // Enable MS-Extensions and ...
+ cmd.createArgument().setValue("/x-");
+ // ... do not display a Message about this.
+ cmd.createArgument().setValue("/nomessage");
+ }
+
// Do not display Logo
cmd.createArgument().setValue("/nologo");
1.7 +3 -2 ant/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java
Index: Sj.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Sj.java 10 Feb 2003 14:13:42 -0000 1.6
+++ Sj.java 15 May 2003 12:44:01 -0000 1.7
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,7 +74,8 @@
attributes.log("Using symantec java compiler", Project.MSG_VERBOSE);
Commandline cmd = setupJavacCommand();
- cmd.setExecutable("sj");
+ String exec = getJavac().getExecutable();
+ cmd.setExecutable(exec == null ? "sj" : exec);
int firstFileName = cmd.size() - compileList.length;