aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Irina Iancu <elenairina@google.com>2017-02-20 11:23:39 +0000
committerGravatar Irina Iancu <elenairina@google.com>2017-02-20 11:33:56 +0000
commit4d3bd44559b5267aca5305b2aa4b9fcd63c4c2aa (patch)
tree8db0c7906a9d9f5fc570e34f7ca7f52657465299
parent0145a3b81bb7077ac4a2daffedf4bf9d115df189 (diff)
Revert "Delete temporary directory on exit"
This reverts commit 9a05f3bc58f9845bf41f9f8031e97b09e5348855. This change breaks Bazel: http://ci.bazel.io/job/bazel-tests/555/BAZEL_VERSION=HEAD,PLATFORM_NAME=windows-x86_64/console Fixes #2552 -- Change-Id: Ib177c7bddaeec98af60d44f030782589f38e8923 Reviewed-on: https://cr.bazel.build/9010 PiperOrigin-RevId: 148007731 MOS_MIGRATED_REVID=148007731
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java b/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java
index beae3f5a60..687e513937 100644
--- a/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java
+++ b/src/tools/android/java/com/google/devtools/build/android/desugar/Desugar.java
@@ -27,12 +27,9 @@ import com.google.devtools.common.options.OptionsParser;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
@@ -121,8 +118,6 @@ class Desugar {
System.setProperty(
LambdaClassMaker.LAMBDA_METAFACTORY_DUMPER_PROPERTY, dumpDirectory.toString());
- deleteTreeOnExit(dumpDirectory);
-
if (args.length == 1 && args[0].startsWith("@")) {
args = Files.readAllLines(Paths.get(args[0].substring(1)), ISO_8859_1).toArray(new String[0]);
}
@@ -269,42 +264,4 @@ class Desugar {
throw new ClassNotFoundException();
}
}
-
- private static void deleteTreeOnExit(Path directory) {
- Thread shutdownHook =
- new Thread() {
- @Override
- public void run() {
- try {
- deleteTree(directory);
- } catch (IOException e) {
- throw new RuntimeException("Failed to delete " + directory, e);
- }
- }
- };
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- }
-
- /** Recursively delete a directory. */
- private static void deleteTree(Path directory) throws IOException {
- if (directory.toFile().exists()) {
- Files.walkFileTree(
- directory,
- new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
- throws IOException {
- Files.delete(file);
- return FileVisitResult.CONTINUE;
- }
-
- @Override
- public FileVisitResult postVisitDirectory(Path dir, IOException exc)
- throws IOException {
- Files.delete(dir);
- return FileVisitResult.CONTINUE;
- }
- });
- }
- }
}