public static void deleteRecursive(File file) { if (!file.exists()) { return; } if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteRecursive(files[i]); } file.delete(); } } }
} finally { try { if (tmpDir != null) deleteRecursive(tmpDir); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + tmpDir.getPath());
protected void compile() { if (compileList.length == 0) return; try { log.info("Compiling " + compileList.length + " source file" + (compileList.length == 1 ? "" : "s") + (destDir != null ? " to " + destDir : "")); listFiles(); Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject()); List<String> jointOptions = extractJointOptions(classpath); String separator = System.getProperty("file.separator"); List<String> commandLineList = new ArrayList<String>(); doForkCommandLineList(commandLineList, classpath, separator); doNormalCommandLineList(commandLineList, jointOptions, classpath); addSourceFiles(commandLineList); String[] commandLine = makeCommandLine(commandLineList); if (fork) { runForked(commandLine); } else { runCompiler(commandLine); } } finally { for (File temporaryFile : temporaryFiles) { try { FileSystemCompiler.deleteRecursive(temporaryFile); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + temporaryFile.getPath()); } } } }
public static void deleteRecursive(File file) { if (!file.exists()) { return; } if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteRecursive(files[i]); } file.delete(); } } }
public static void deleteRecursive(File file) { if (!file.exists()) { return; } if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteRecursive(files[i]); } file.delete(); } } }
public static void deleteRecursive(File file) { if (!file.exists()) { return; } if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteRecursive(files[i]); } file.delete(); } } }
private void compile(File dir, Collection<File> files) throws Exception { File tmpDir = null; try { tmpDir = DefaultGroovyStaticMethods.createTempDir(null, "groovy-generated-", "-java-source"); compilerConfiguration.getJointCompilationOptions().put("stubDir", tmpDir); compile(dir, toArray(files)); } finally { try { if (tmpDir != null) FileSystemCompiler.deleteRecursive(tmpDir); } catch (Throwable t) { LogUtils.severe("error: could not delete temp files - " + tmpDir.getPath()); } } }
public static void doCompilation(CompilerConfiguration configuration, CompilationUnit unit, String[] filenames) throws Exception { File tmpDir = null; // if there are any joint compilation options set stubDir if not set try { if ((configuration.getJointCompilationOptions() != null) && !configuration.getJointCompilationOptions().containsKey("stubDir")) { tmpDir = createTempDir(); configuration.getJointCompilationOptions().put("stubDir", tmpDir); } FileSystemCompiler compiler = new FileSystemCompiler(configuration, unit); compiler.compile(filenames); } finally { try { if (tmpDir != null) deleteRecursive(tmpDir); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + tmpDir.getPath()); } } }
public static void doCompilation(CompilerConfiguration configuration, CompilationUnit unit, String[] filenames) throws Exception { File tmpDir = null; // if there are any joint compilation options set stub dir if not set try { if ((configuration.getJointCompilationOptions() != null) && !configuration.getJointCompilationOptions().containsKey("stubDir")) { tmpDir = createTempDir(); configuration.getJointCompilationOptions().put("stubDir", tmpDir); } FileSystemCompiler compiler = new FileSystemCompiler(configuration, unit); compiler.compile(filenames); } finally { try { if (tmpDir != null) deleteRecursive(tmpDir); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + tmpDir.getPath()); } } }
} finally { try { if (tmpDir != null) deleteRecursive(tmpDir); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + tmpDir.getPath());
for (File temporaryFile : temporaryFiles) { try { FileSystemCompiler.deleteRecursive(temporaryFile); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + temporaryFile.getPath());
File tmpFile = files.next(); try { FileSystemCompiler.deleteRecursive(tmpFile); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + tmpFile.getPath());
for (File temporaryFile : temporaryFiles) { try { FileSystemCompiler.deleteRecursive(temporaryFile); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + temporaryFile.getPath());
protected void compile() { if (compileList.length == 0) return; try { log.info("Compiling " + compileList.length + " source file" + (compileList.length == 1 ? "" : "s") + (destDir != null ? " to " + destDir : "")); listFiles(); Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject()); List<String> jointOptions = extractJointOptions(classpath); String separator = System.getProperty("file.separator"); List<String> commandLineList = new ArrayList<String>(); doForkCommandLineList(commandLineList, classpath, separator); doNormalCommandLineList(commandLineList, jointOptions, classpath); addSourceFiles(commandLineList); String[] commandLine = makeCommandLine(commandLineList); if (fork) { runForked(commandLine); } else { runCompiler(commandLine); } } finally { for (File temporaryFile : temporaryFiles) { try { FileSystemCompiler.deleteRecursive(temporaryFile); } catch (Throwable t) { System.err.println("error: could not delete temp files - " + temporaryFile.getPath()); } } } }