From 8bf8c11ac6a66ea448be50b4038d5b25685efe83 Mon Sep 17 00:00:00 2001 From: Tako Schotanus Date: Thu, 4 Jul 2024 01:11:18 +0200 Subject: [PATCH] fix: now taking into account --no-links when copying Before we wouldn't override existing artifacts if they existed, even if they were of the "wrong" type (e.g. a link when --no-links was specified). Now we do. --- src/main/java/org/codejive/jpm/Main.java | 4 +++- src/main/java/org/codejive/jpm/util/FileUtils.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codejive/jpm/Main.java b/src/main/java/org/codejive/jpm/Main.java index 678ed08..3bdc143 100644 --- a/src/main/java/org/codejive/jpm/Main.java +++ b/src/main/java/org/codejive/jpm/Main.java @@ -181,7 +181,9 @@ static class QuietMixin { } private static void printStats(SyncStats stats) { - System.err.printf("Artifacts copied: %d, deleted: %d%n", stats.copied, stats.deleted); + System.err.printf( + "Artifacts new: %d, updated: %d, deleted: %d%n", + stats.copied, stats.updated, stats.deleted); } public static void main(String... args) { diff --git a/src/main/java/org/codejive/jpm/util/FileUtils.java b/src/main/java/org/codejive/jpm/util/FileUtils.java index a35c44f..054082b 100644 --- a/src/main/java/org/codejive/jpm/util/FileUtils.java +++ b/src/main/java/org/codejive/jpm/util/FileUtils.java @@ -37,6 +37,9 @@ public static SyncStats syncArtifacts( copyDependency(artifact, directory, noLinks); artifactsToDelete.remove(artifactName); stats.copied++; + } else if (Files.isSymbolicLink(target) == noLinks) { + copyDependency(artifact, directory, noLinks); + stats.updated++; } }