Browse Source

<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>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274584 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
f0c61ad2f5
8 changed files with 97 additions and 14 deletions
  1. +10
    -0
      WHATSNEW
  2. +16
    -1
      docs/manual/CoreTasks/javac.html
  3. +36
    -1
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  4. +12
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  5. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java
  6. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java
  7. +15
    -5
      src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java
  8. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java

+ 10
- 0
WHATSNEW View File

@@ -331,6 +331,16 @@ Other changes:

* <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
===================================



+ 16
- 1
docs/manual/CoreTasks/javac.html View File

@@ -276,7 +276,9 @@ invoking the compiler.</p>
<td valign="top">Complete path to the <code>javac</code>
executable to use in case of <code>fork=&quot;yes&quot;</code>.
Defaults to the compiler of the Java version that is currently
running Ant. Ignored if <code>fork=&quot;no&quot;</code></td>
running Ant. Ignored if <code>fork=&quot;no&quot;</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 @@ invoking the compiler.</p>
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>
@@ -563,6 +572,12 @@ while all others are <code>false</code>.</p>
</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>&lt;javac&gt;</code>.</p>

<hr>
<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation.
All rights Reserved.</p>


+ 36
- 1
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -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 @@ public class Javac extends MatchingTask {

private String source;
private String debugLevel;
private File tmpDir;

/**
* Javac task for compilation of Java files.
@@ -595,6 +596,15 @@ public class Javac extends MatchingTask {
forkedExecutable = forkExec;
}

/**
* 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?
*/
@@ -604,6 +614,14 @@ public class Javac extends MatchingTask {

/**
* 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 @@ public class Javac extends MatchingTask {
}
}

/**
* 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.


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

@@ -152,6 +152,13 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
return attributes;
}

/**
* @since Ant 1.6
*/
protected Project getProject() {
return project;
}

/**
* Builds the compilation classpath.
*
@@ -432,8 +439,11 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
&& 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++) {


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

@@ -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 @@ public class Gcj extends DefaultCompilerAdapter {
classpath.append(src);
}

cmd.setExecutable("gcj");
String exec = getJavac().getExecutable();
cmd.setExecutable(exec == null ? "gcj" : exec);

if (destDir != null) {
cmd.createArgument().setValue("-d");


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

@@ -124,7 +124,8 @@ public class Jikes extends DefaultCompilerAdapter {
}
Commandline cmd = new Commandline();
cmd.setExecutable("jikes");
String exec = getJavac().getExecutable();
cmd.setExecutable(exec == null ? "jikes" : exec);

if (deprecation == true) {
cmd.createArgument().setValue("-deprecation");


+ 15
- 5
src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java View File

@@ -104,7 +104,8 @@ public class Jvc extends DefaultCompilerAdapter {
}

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 @@ public class Jvc extends DefaultCompilerAdapter {
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");



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

@@ -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 @@ public class Sj extends DefaultCompilerAdapter {
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;



Loading…
Cancel
Save