Skip to content

Commit

Permalink
Merge pull request #35 from IBM/rename-lib-deps-folder
Browse files Browse the repository at this point in the history
Rename the .library-depenedencies to _library_dependencies
  • Loading branch information
sinha108 authored Jul 10, 2024
2 parents 4f0849b + e0c2724 commit 4b5dda9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/com/ibm/northstar/CodeAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG

}
}
// Cleanup library dependencies directory
BuildProject.cleanLibraryDependencies();

// Convert the JavaCompilationUnit to JSON and add to consolidated json object
String symbolTableJSONString = gson.toJson(symbolTable);
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/com/ibm/northstar/utils/BuildProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class BuildProject {

public static Path libDownloadPath;
private static final String LIB_DEPS_DOWNLOAD_DIR = ".library-dependencies";
private static final String LIB_DEPS_DOWNLOAD_DIR = "_library_dependencies";
private static final String MAVEN_CMD = System.getProperty("os.name").toLowerCase().contains("windows") ? "mvn.cmd" : "mvn";
private static final String GRADLE_CMD = System.getProperty("os.name").toLowerCase().contains("windows") ? "gradlew.bat" : "gradlew";

Expand Down Expand Up @@ -153,4 +153,19 @@ public static boolean downloadLibraryDependencies(String projectPath) {
return false;
}
}

public void cleanLibraryDependencies() {
if (libDownloadPath != null) {
Log.info("Cleaning up library dependency directory: " + libDownloadPath);
try {
Files.walk(libDownloadPath)
.filter(Files::isRegularFile)
.map(Path::toFile)
.forEach(File::delete);
Files.delete(libDownloadPath);
} catch (IOException e) {
Log.error("Error deleting library dependency directory: " + e.getMessage());
}
}
}
}

0 comments on commit 4b5dda9

Please sign in to comment.