001: package jaxx.compiler;
002:
003: import java.io.*;
004:
005: /** Stores options which affect the jaxxc tool's operation. These options are generally specified by the
006: * user on the command line.
007: */
008: public class CompilerOptions {
009: private File targetDirectory;
010: private String classPath;
011: private String javacOpts;
012: private boolean runJavac = true;
013: private boolean keepJavaFiles;
014: private boolean optimize;
015:
016: /** Returns the target directory, generally specified with the "-d" option on the command line.
017: *
018: *@return the target directory
019: *@see #setTargetDirectory
020: */
021: public File getTargetDirectory() {
022: return targetDirectory;
023: }
024:
025: /** Sets the target directory into which compiled classes will be placed.
026: *
027: *@param targetDirectory the target directory
028: *@see #getTargetDirectory
029: */
030: public void setTargetDirectory(File targetDirectory) {
031: this .targetDirectory = targetDirectory;
032: }
033:
034: /** Returns the class path to be used during compilation.
035: *
036: *@return the class path to be used during compilation
037: *@see #setClassPath
038: */
039: public String getClassPath() {
040: return classPath;
041: }
042:
043: /** Sets the class path to be used during compilation.
044: *
045: *@param classPath the compilation class path
046: *@see #getClassPath
047: */
048: public void setClassPath(String classPath) {
049: this .classPath = classPath;
050: }
051:
052: /** Returns the options to be passed into <code>javac</code>.
053: *
054: *@return options to be passed into <code>javac</code>
055: *@see #setJavacOpts
056: */
057: public String getJavacOpts() {
058: return javacOpts;
059: }
060:
061: /** Sets options to be passed into <code>javac</code>.
062: *
063: *@param javacOpts options to be passed into <code>javac</code>
064: *@see #getJavacOpts
065: */
066: public void setJavacOpts(String javacOpts) {
067: this .javacOpts = javacOpts;
068: }
069:
070: /** Returns whether or not generated Java files should be preserved after compilation.
071: *
072: *@return <code>true</code> if generated Java files should be preserved, <code>false</code> to delete
073: *@see #setKeepJavaFiles
074: */
075: public boolean getKeepJavaFiles() {
076: return keepJavaFiles;
077: }
078:
079: /** Sets whether or not generated Java files should be preserved after compilation.
080: *
081: *@param keepJavaFiles <code>true</code> if generated Java files should be preserved, <code>false</code> to delete
082: *@see #getKeepJavaFiles
083: */
084: public void setKeepJavaFiles(boolean keepJavaFiles) {
085: this .keepJavaFiles = keepJavaFiles;
086: }
087:
088: /** Returns whether or not <code>javac</code> should be run against the generated Java files.
089: *
090: *@return <code>true</code> if generated Java files should be compiled using <code>javac</code>
091: *@see #setRunJavac
092: */
093: public boolean getRunJavac() {
094: return runJavac;
095: }
096:
097: /** Sets whether or not <code>javac</code> is run against the generated Java files. Setting
098: * runJavac to <code>false</code> implies a <code>true</code> value for keepJavaFiles.
099: *
100: *@param runJavac <code>true</code> to compile generated Java files using <code>javac</code>
101: *@see #getRunJavac
102: */
103: public void setRunJavac(boolean runJavac) {
104: this .runJavac = runJavac;
105: if (!runJavac)
106: setKeepJavaFiles(true);
107: }
108:
109: /** Returns whether or not optimization should be performed.
110: *
111: *@return whether or not optimizations should be performed
112: */
113: public boolean getOptimize() {
114: return optimize;
115: }
116:
117: /** Sets whether or not optimizations should be performed.
118: *
119: *@param optimize <code>true</code> to perform optimizations during compilation
120: *@see #getOptimize
121: */
122: public void setOptimize(boolean optimize) {
123: this.optimize = optimize;
124: }
125: }
|