1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
34 import java.net.MalformedURLException; |
34 import java.net.MalformedURLException; |
35 import java.net.URL; |
35 import java.net.URL; |
36 import java.net.URLClassLoader; |
36 import java.net.URLClassLoader; |
37 import java.nio.charset.Charset; |
37 import java.nio.charset.Charset; |
38 import java.nio.charset.IllegalCharsetNameException; |
38 import java.nio.charset.IllegalCharsetNameException; |
|
39 import java.text.MessageFormat; |
39 import java.util.ArrayList; |
40 import java.util.ArrayList; |
40 import java.util.List; |
41 import java.util.List; |
41 import java.util.StringTokenizer; |
42 import java.util.StringTokenizer; |
42 |
43 |
43 /** |
44 /** |
178 |
185 |
179 public boolean isExtensionMode() { |
186 public boolean isExtensionMode() { |
180 return compatibilityMode == EXTENSION; |
187 return compatibilityMode == EXTENSION; |
181 } |
188 } |
182 |
189 |
183 /** |
|
184 * Target direcoty when producing files. |
|
185 */ |
|
186 public File targetDir = new File("."); |
|
187 |
|
188 |
|
189 |
|
190 public boolean debug = false; |
190 public boolean debug = false; |
191 |
191 |
192 /** |
192 /** |
193 * -Xdebug - gives complete stack trace |
193 * -Xdebug - gives complete stack trace |
194 */ |
194 */ |
211 * Remove generated files |
211 * Remove generated files |
212 */ |
212 */ |
213 public void removeGeneratedFiles(){ |
213 public void removeGeneratedFiles(){ |
214 for(File file : generatedFiles){ |
214 for(File file : generatedFiles){ |
215 if (file.getName().endsWith(".java")) { |
215 if (file.getName().endsWith(".java")) { |
216 file.delete(); |
216 boolean deleted = file.delete(); |
|
217 if (verbose && !deleted) { |
|
218 System.out.println(MessageFormat.format("{0} could not be deleted.", file)); |
|
219 } |
217 } |
220 } |
218 } |
221 } |
219 generatedFiles.clear(); |
222 generatedFiles.clear(); |
220 } |
223 } |
221 |
224 |
233 */ |
236 */ |
234 public void deleteGeneratedFiles() { |
237 public void deleteGeneratedFiles() { |
235 synchronized (generatedFiles) { |
238 synchronized (generatedFiles) { |
236 for (File file : generatedFiles) { |
239 for (File file : generatedFiles) { |
237 if (file.getName().endsWith(".java")) { |
240 if (file.getName().endsWith(".java")) { |
238 file.delete(); |
241 boolean deleted = file.delete(); |
|
242 if (verbose && !deleted) { |
|
243 System.out.println(MessageFormat.format("{0} could not be deleted.", file)); |
|
244 } |
239 } |
245 } |
240 } |
246 } |
241 generatedFiles.clear(); |
247 generatedFiles.clear(); |
242 } |
248 } |
243 } |
249 } |