/** * Shall we assume JDK 1.4 command line switches? * @return true if jdk 1.4 * @since Ant 1.6.3 */ protected boolean assumeJava14() { return assumeJavaXY("javac1.4", JavaEnvUtils.JAVA_1_4); }
/** * Do the compile with the specified arguments. * @param args - arguments to pass to process on command line * @param firstFileName - index of the first source file in args, * if the index is negative, no temporary file will ever be * created, but this may hit the command line length limit on your * system. * @return the exit code of the compilation */ protected int executeExternalCompile(final String[] args, final int firstFileName) { return executeExternalCompile(args, firstFileName, true); }
/** * Get the command line arguments for the switches. * @param cmd the command line * @return the command line */ protected Commandline setupJavacCommandlineSwitches(final Commandline cmd) { return setupJavacCommandlineSwitches(cmd, false); }
/** * A string that describes the default value for -source of the * selected JDK's javac. */ private String getDefaultSource() { if (assumeJava15() || assumeJava16()) { return "1.5 in JDK 1.5 and 1.6"; } if (assumeJava17()) { return "1.7 in JDK 1.7"; } if (assumeJava18()) { return "1.8 in JDK 1.8"; } if (assumeJava9Plus()) { return "9 in JDK 9"; } return ""; }
/** * Does the command line argument processing for modern and adds * the files to compile as well. * @return the command line */ protected Commandline setupModernJavacCommand() { final Commandline cmd = new Commandline(); setupModernJavacCommandlineSwitches(cmd); logAndAddFilesToCompile(cmd); return cmd; }
/** * Does the command line argument processing for classic and adds * the files to compile as well. * @param debugLevelCheck if true set the debug level with the -g switch * @return the command line */ protected Commandline setupJavacCommand(final boolean debugLevelCheck) { final Commandline cmd = new Commandline(); setupJavacCommandlineSwitches(cmd, debugLevelCheck); logAndAddFilesToCompile(cmd); return cmd; }
private String[] findSupportedFileExtensions() { final String compilerImpl = getCompiler(); final CompilerAdapter adapter = nestedAdapter != null ? nestedAdapter : CompilerAdapterFactory.getCompiler(compilerImpl, this, createCompilerClasspath()); String[] extensions = null; if (adapter instanceof CompilerAdapterExtension) { extensions = ((CompilerAdapterExtension) adapter).getSupportedFileExtensions(); } if (extensions == null) { extensions = new String[] {"java"}; } // now process the extensions to ensure that they are the // right format for (int i = 0; i < extensions.length; i++) { if (!extensions[i].startsWith("*.")) { extensions[i] = "*." + extensions[i]; } } return extensions; }
/** * Set up the command line. * @return the command line */ protected Commandline setupJavacCommand() { return setupJavacCommand(false); }
/** * The argument the compiler wants to see if the debug attribute * has been set to false. * * <p>A return value of <code>null</code> means no argument at all.</p> * * @return "-g:none" unless we expect to invoke a JDK 1.1 compiler. * * @since Ant 1.6.3 */ protected String getNoDebugArgument() { return assumeJava11() ? null : "-g:none"; }
/** * Based on the parameter passed in, this method creates the necessary * factory desired. * * The current mapping for compiler names are as follows: * <ul><li>jikes = jikes compiler * <li>classic, javac1.1, javac1.2 = the standard compiler from JDK * 1.1/1.2 * <li>modern, javac1.3, javac1.4, javac1.5 = the compiler of JDK 1.3+ * <li>jvc, microsoft = the command line compiler from Microsoft's SDK * for Java / Visual J++ * <li>kjc = the kopi compiler</li> * <li>gcj = the gcj compiler from gcc</li> * <li>sj, symantec = the Symantec Java compiler</li> * <li><i>a fully qualified classname</i> = the name of a compiler * adapter * </ul> * * @param compilerType either the name of the desired compiler, or the * full classname of the compiler's adapter. * @param task a task to log through. * @return the compiler adapter * @throws BuildException if the compiler type could not be resolved into * a compiler adapter. */ public static CompilerAdapter getCompiler(String compilerType, Task task) throws BuildException { return getCompiler(compilerType, task, null); }
/** * Adds the command line arguments specific to the current implementation. * @param cmd the command line to use */ protected void addCurrentCompilerArgs(final Commandline cmd) { cmd.addArguments(getJavac().getCurrentCompilerArgs()); }
/** * Builds the modulesourcepath for multi module compilation. * @return the modulesourcepath * @since 1.9.7 */ protected Path getModulesourcepath() { final Path msp = new Path(getProject()); if (moduleSourcepath != null) { msp.add(moduleSourcepath); } return msp; }
/** * Shall we assume JDK 9 command line switches? * @return true if JDK 9 * @since Ant 1.9.8 */ protected boolean assumeJava9() { return assumeJava19(); }
/** * Shall we assume JDK 1.5 command line switches? * @return true if JDK 1.5 * @since Ant 1.6.3 */ protected boolean assumeJava15() { return assumeJavaXY("javac1.5", JavaEnvUtils.JAVA_1_5); }
/** * Builds the upgrademodulepath. * @return the upgrademodulepath * @since 1.9.7 */ protected Path getUpgrademodulepath() { final Path ump = new Path(getProject()); if (upgrademodulepath != null) { ump.addExisting(upgrademodulepath); } return ump; }
/** * Shall we assume JDK 1.8 command line switches? * @return true if JDK 1.8 * @since Ant 1.8.3 */ protected boolean assumeJava18() { return assumeJavaXY("javac1.8", JavaEnvUtils.JAVA_1_8); }
/** * Builds the modulepath. * @return the modulepath * @since 1.9.7 */ protected Path getModulepath() { final Path mp = new Path(getProject()); if (modulepath != null) { mp.addExisting(modulepath); } return mp; }
/** * Shall we assume JDK 1.6 command line switches? * @return true if JDK 1.6 * @since Ant 1.7 */ protected boolean assumeJava16() { return assumeJavaXY("javac1.6", JavaEnvUtils.JAVA_1_6); }
/** * Shall we assume JDK 1.7 command line switches? * @return true if JDK 1.7 * @since Ant 1.8.2 */ protected boolean assumeJava17() { return assumeJavaXY("javac1.7", JavaEnvUtils.JAVA_1_7); }
/** * Shall we assume JDK 9 command line switches? * @return true if JDK 9 * @since Ant 1.9.4 * @deprecated use #assumeJava9 instead */ @Deprecated protected boolean assumeJava19() { return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9) || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9); }