Lines 41-47
Link Here
|
41 |
* @since 2.0 |
41 |
* @since 2.0 |
42 |
*/ |
42 |
*/ |
43 |
public class JDTCompilerAdapter extends DefaultCompilerAdapter { |
43 |
public class JDTCompilerAdapter extends DefaultCompilerAdapter { |
44 |
private static String compilerClass = "org.eclipse.jdt.internal.compiler.batch.Main"; //$NON-NLS-1$ |
44 |
private static String compilerClass = "org.eclipse.jdt.internal.compiler.batch.Main"; String logFileName; |
|
|
45 |
//$NON-NLS-1$ |
45 |
/** |
46 |
/** |
46 |
* Performs a compile using the JDT batch compiler |
47 |
* Performs a compile using the JDT batch compiler |
47 |
*/ |
48 |
*/ |
Lines 55-61
Link Here
|
55 |
Object batchCompilerInstance = batchCompilerConstructor.newInstance(new Object[] {new PrintWriter(System.out), new PrintWriter(System.err), new Boolean(true)}); |
56 |
Object batchCompilerInstance = batchCompilerConstructor.newInstance(new Object[] {new PrintWriter(System.out), new PrintWriter(System.err), new Boolean(true)}); |
56 |
Method compile = c.getMethod("compile", new Class[] {String[].class}); //$NON-NLS-1$ |
57 |
Method compile = c.getMethod("compile", new Class[] {String[].class}); //$NON-NLS-1$ |
57 |
Object result = compile.invoke(batchCompilerInstance, new Object[] { cmd.getArguments()}); |
58 |
Object result = compile.invoke(batchCompilerInstance, new Object[] { cmd.getArguments()}); |
58 |
return ((Boolean) result).booleanValue(); |
59 |
final boolean resultValue = ((Boolean) result).booleanValue(); |
|
|
60 |
if (!resultValue && verbose) { |
61 |
System.out.println(Util.bind("ant.jdtadapter.error.compilationFailed", this.logFileName)); |
62 |
} |
63 |
return resultValue; |
59 |
} catch (ClassNotFoundException cnfe) { |
64 |
} catch (ClassNotFoundException cnfe) { |
60 |
throw new BuildException(Util.bind("ant.jdtadapter.error.missingJDTCompiler")); //$NON-NLS-1$ |
65 |
throw new BuildException(Util.bind("ant.jdtadapter.error.missingJDTCompiler")); //$NON-NLS-1$ |
61 |
} catch (Exception ex) { |
66 |
} catch (Exception ex) { |
Lines 232-238
Link Here
|
232 |
* extra option allowed by the Eclipse compiler |
237 |
* extra option allowed by the Eclipse compiler |
233 |
*/ |
238 |
*/ |
234 |
cmd.createArgument().setValue("-log"); //$NON-NLS-1$ |
239 |
cmd.createArgument().setValue("-log"); //$NON-NLS-1$ |
235 |
cmd.createArgument().setValue(destDir.getAbsolutePath() + ".log"); //$NON-NLS-1$ |
240 |
logFileName = destDir.getAbsolutePath() + ".log"; |
|
|
241 |
cmd.createArgument().setValue(logFileName); //$NON-NLS-1$ |
236 |
} |
242 |
} |
237 |
|
243 |
|
238 |
/* |
244 |
/* |