diff options
author | Colin Cross <ccross@android.com> | 2017-02-23 20:24:14 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-02-23 20:24:14 +0000 |
commit | 3954db0299733628edd13eafffa4223b7e12a832 (patch) | |
tree | 79b706b5b1b93d291a6dc197a1320cf67cb63629 | |
parent | c338dade31c1451e1c4c08bbc5a879027b9197b3 (diff) | |
parent | bd661c10019d76defefbf03fb7d22ed9aacfc513 (diff) | |
download | desugar-3954db0299733628edd13eafffa4223b7e12a832.tar.gz |
Revert "Delete temporary directory on exit" am: 9b81ac3526 am: 61cc45c282
am: bd661c1001
Change-Id: I5038efd1a5ec394760b35b03ca43b3f5e291f8ad
-rw-r--r-- | java/com/google/devtools/build/android/desugar/Desugar.java | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/java/com/google/devtools/build/android/desugar/Desugar.java b/java/com/google/devtools/build/android/desugar/Desugar.java index 36c2041..3ea8a8b 100644 --- a/java/com/google/devtools/build/android/desugar/Desugar.java +++ b/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; @@ -128,8 +125,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]); } @@ -301,42 +296,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; - } - }); - } - } } |