From 6660819dc7f994ff93e19c0a9ad04f37354a41f5 Mon Sep 17 00:00:00 2001 From: Serban Iordache Date: Tue, 23 Oct 2018 16:09:52 +0200 Subject: [PATCH] fix issue #41 use the host platform's path-separator character to delimit the files passed to the --patch-module option --- .../java/com/zyxist/chainsaw/algorithms/ModulePatcher.java | 3 ++- src/main/java/com/zyxist/chainsaw/jigsaw/cli/PatchItem.java | 3 ++- .../groovy/com/zyxist/chainsaw/jigsaw/cli/PatchItemSpec.groovy | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zyxist/chainsaw/algorithms/ModulePatcher.java b/src/main/java/com/zyxist/chainsaw/algorithms/ModulePatcher.java index 1b866299..35ffcfeb 100644 --- a/src/main/java/com/zyxist/chainsaw/algorithms/ModulePatcher.java +++ b/src/main/java/com/zyxist/chainsaw/algorithms/ModulePatcher.java @@ -23,6 +23,7 @@ import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; +import java.io.File; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; @@ -74,7 +75,7 @@ private void toList(Map patchCommands, String patchedModule, } private String toGenericName(ResolvedArtifact artifact) { - return artifact.getModuleVersion().getId().getGroup()+":"+artifact.getModuleVersion().getId().getName(); + return artifact.getModuleVersion().getId().getGroup() + File.pathSeparator + artifact.getModuleVersion().getId().getName(); } diff --git a/src/main/java/com/zyxist/chainsaw/jigsaw/cli/PatchItem.java b/src/main/java/com/zyxist/chainsaw/jigsaw/cli/PatchItem.java index ab6ecb08..74f97085 100644 --- a/src/main/java/com/zyxist/chainsaw/jigsaw/cli/PatchItem.java +++ b/src/main/java/com/zyxist/chainsaw/jigsaw/cli/PatchItem.java @@ -17,6 +17,7 @@ import com.zyxist.chainsaw.jigsaw.JigsawFlags; +import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -38,7 +39,7 @@ public PatchItem with(String jarFile) { public void toArgs(List args) { if (!patchingJars.isEmpty()) { args.add(JigsawFlags.PATCH_MODULE); - args.add(patchedModule+"="+patchingJars.stream().collect(Collectors.joining(":"))); + args.add(patchedModule+"="+patchingJars.stream().collect(Collectors.joining(File.pathSeparator))); } } } diff --git a/src/test/groovy/com/zyxist/chainsaw/jigsaw/cli/PatchItemSpec.groovy b/src/test/groovy/com/zyxist/chainsaw/jigsaw/cli/PatchItemSpec.groovy index 68103f38..789d4646 100644 --- a/src/test/groovy/com/zyxist/chainsaw/jigsaw/cli/PatchItemSpec.groovy +++ b/src/test/groovy/com/zyxist/chainsaw/jigsaw/cli/PatchItemSpec.groovy @@ -43,7 +43,7 @@ class PatchItemSpec extends Specification { then: args.size() == 2 args.get(0) == '--patch-module' - args.get(1) == 'com.example.foo=/path/to/some.jar:/path/to/another.jar' + args.get(1) == "com.example.foo=/path/to/some.jar${File.pathSeparator}/path/to/another.jar" } }