]> source.dussan.org Git - aspectj.git/commitdiff
Make sure to clean up temp-dirs in 'weaver' module
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Fri, 9 Apr 2021 11:16:28 +0000 (18:16 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Fri, 9 Apr 2021 11:16:28 +0000 (18:16 +0700)
Maven Clean now deletes '' directories if it finds any. Furthermore,
AsynchronousFileCacheBackingTestSupport now not just deletes directory
contents but also removes the empty corresponding directories
afterwards.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
pom.xml
weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java

diff --git a/pom.xml b/pom.xml
index 48fd940604b178a622697822e57faef2874807fe..5b3104d9876dd68a7fb7c2e317f3d269b80fd8c3 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                                                <fileset>
                                                        <directory>.</directory>
                                                        <includes>
+                                                               <!-- AspectJ core dumps -->
                                                                <include>**/ajcore.*.txt</include>
+                                                               <!-- Test temp-dirs in 'weaver' module, see AsynchronousFileCacheBackingTestSupport.getCacheDir -->
+                                                               <include>**/dir-0.*/**</include>
                                                        </includes>
                                                        <followSymlinks>false</followSymlinks>
                                                </fileset>
index a6445057b5cd66b95e161ba7cf27e38acb207937..e8b0b4ecdb13d785a2afa42043827fc1b78c5f27 100644 (file)
@@ -59,14 +59,17 @@ public abstract class AsynchronousFileCacheBackingTestSupport
     protected void cleanupCache() {
        if (indexFile != null) {
                if (FileUtil.deleteContents(indexFile) > 0) {
-                       System.out.println("Deleted " + indexFile);
+                       System.out.println("Deleted index file: " + indexFile);
                }
                indexFile = null;
        }
 
        if (cacheDir != null) {
                if (FileUtil.deleteContents(cacheDir) > 0) {
-                       System.out.println("Deleted " + cacheDir);
+                       System.out.println("Deleted cache directory content: " + cacheDir);
+               }
+        if (cacheDir.delete()) {
+                       System.out.println("Deleted cache directory: " + cacheDir);
                }
                cacheDir = null;
        }