(String path)
| 119 | } |
| 120 | |
| 121 | boolean compile(String path) { |
| 122 | IJ.showStatus("compiling "+path); |
| 123 | String classpath = getClassPath(path); |
| 124 | Vector options = new Vector(); |
| 125 | if (generateDebuggingInfo) |
| 126 | options.addElement("-g"); |
| 127 | validateTarget(); |
| 128 | options.addElement("-source"); |
| 129 | options.addElement(getTargetAsString()); |
| 130 | options.addElement("-target"); |
| 131 | options.addElement(getTargetAsString()); |
| 132 | options.addElement("-Xlint:unchecked"); |
| 133 | options.addElement("-deprecation"); |
| 134 | options.addElement("-classpath"); |
| 135 | options.addElement(classpath); |
| 136 | |
| 137 | Vector sources = new Vector(); |
| 138 | sources.add(path); |
| 139 | |
| 140 | if (IJ.debugMode) { |
| 141 | StringBuilder builder = new StringBuilder(); |
| 142 | builder.append("javac"); |
| 143 | for (int i=0; i< options.size(); i++){ |
| 144 | builder.append(" "); |
| 145 | builder.append(options.get(i)); |
| 146 | } |
| 147 | for (int i=0; i< sources.size(); i++){ |
| 148 | builder.append(" "); |
| 149 | builder.append(sources.get(i)); |
| 150 | } |
| 151 | IJ.log(builder.toString()); |
| 152 | } |
| 153 | |
| 154 | boolean errors = true; |
| 155 | String s = "not compiled"; |
| 156 | if (compilerTool != null) { |
| 157 | final StringWriter outputWriter = new StringWriter(); |
| 158 | errors = !compilerTool.compile(sources, options, outputWriter); |
| 159 | s = outputWriter.toString(); |
| 160 | } else { |
| 161 | errors = true; |
| 162 | } |
| 163 | |
| 164 | if (errors) |
| 165 | showErrors(s); |
| 166 | else |
| 167 | IJ.showStatus("done"); |
| 168 | return !errors; |
| 169 | } |
| 170 | |
| 171 | // Returns a string containing the Java classpath, |
| 172 | // the path to the directory containing the plugin, |
no test coverage detected