/******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ package org.eclipse.pde.internal.build.ant; import org.eclipse.pde.internal.build.IXMLConstants; import org.eclipse.pde.internal.build.Utils; /** * Wrapper class for the Ant javac task. */ public class JavacTask implements ITask { protected String classpathId; protected String bootclasspath; protected String destdir; protected String failonerror; protected String[] srcdir; protected String verbose; protected String includeAntRuntime; protected String fork; protected String debug; protected String source; protected String target; protected String compileArgs; protected String specificCompileArgs; protected String compileArgsFile; protected String encoding; protected String logExtension; protected String errorProperty; protected String[] excludes; protected String compilerAdapter; protected String warningProperties; private boolean adapterUseLog = false; private boolean adapterUseArgFile = false; /** * Default constructor for the class. */ public JavacTask() { super(); } /** * @see ITask#print(AntScript) */ @Override public void print(AntScript script) { script.printTab(); script.print(""); //$NON-NLS-1$ script.indent++; if (compileArgs != null) { script.println(""); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } if (specificCompileArgs != null) { script.printTabs(); script.print(""); //$NON-NLS-1$ } script.println(""); //$NON-NLS-1$ //$NON-NLS-2$ for (int i = 0; i < srcdir.length; i++) { script.printTab(); script.print(""); //$NON-NLS-1$ } for (int i = 0; excludes != null && i < excludes.length; i++) { script.printTab(); script.print(""); //$NON-NLS-1$ } if (warningProperties != null) { script.printTab(); script.print(""); //$NON-NLS-1$ } if (compileArgsFile != null) { script.printTabs(); script.print(""); //$NON-NLS-1$ } if (destdir != null) { script.printTabs(); script.print(""); //$NON-NLS-1$ } script.indent--; script.printEndTag("javac"); //$NON-NLS-1$ } /** * Set the javac task classpath refid to be the given value. * @param classpathId */ public void setClasspathId(String classpathId) { this.classpathId = classpathId; } /** * Set the javac task boot classpath to be the given value. * * @param bootclasspath the boot classpath attribute */ public void setBootClasspath(String bootclasspath) { this.bootclasspath = bootclasspath; } /** * Set the javac task destination directory to be the given value. * * @param destdir the destination directory */ public void setDestdir(String destdir) { this.destdir = destdir; } /** * Set the javac task failOnError attribute to be the given value. Valid values * are "true" and "false". * * @param failonerror either "true" or "false" */ public void setFailOnError(String failonerror) { this.failonerror = failonerror; } /** * Set the javac task includeAntRuntime attribute to be the given value. Valid * values are "no" and "yes". * * @param include either "no" or "yes" */ public void setIncludeAntRuntime(String include) { this.includeAntRuntime = include; } /** * Set the javac task source directory attribute to be the given value. * * @param srcdir the source directory */ public void setSrcdir(String[] srcdir) { this.srcdir = srcdir; } /** * Set patterns to exclude from compilation * @param excludes */ public void setExcludes(String[] excludes) { this.excludes = excludes; } /** * Set the javac task verbose attribute to be the given value. Valid values * are "true" and "false". * * @param verbose either "true" or "false" */ public void setVerbose(String verbose) { this.verbose = verbose; } /** * Set the javac task fork attribute to be the given value. Valid values * are "true" and "false". * * @param fork either "true" or "false" */ public void setFork(String fork) { this.fork = fork; } /** * Set the javac task debug attribute to be the given value. Valid values * are "on" and "off". * * @param debug either "on" or "off" */ public void setDebug(String debug) { this.debug = debug; } /** * Set the javac task source attribute to be the given value. * * @param source either "1.3" or "1.4" */ public void setSource(String source) { this.source = source; } /** * Set the javac task target attribute to be the given value. * * @param target either "1.3" or "1.4" */ public void setTarget(String target) { this.target = target; } public void setCompileArgs(String args) { this.compileArgs = args; } public void setSpecificCompileArgs(String args) { this.specificCompileArgs = args; } public void setEncoding(String encoding) { this.encoding = encoding; } public void setLogExtension(String extension) { this.logExtension = extension; } public void setCompileArgsFile(String file) { this.compileArgsFile = file; } public void setErrorProperty(String errorProperty) { this.errorProperty = errorProperty; } public void setCompilerAdapter(String compilerAdapter) { this.compilerAdapter = compilerAdapter; } public void setAdapterUseLog(boolean useLog) { this.adapterUseLog = useLog; } public void setAdapterArgFile(boolean useFile) { this.adapterUseArgFile = useFile; } public void setWarningProperties(String warningProperties) { this.warningProperties = warningProperties; } }