diff --git a/src/main/java/rife/bld/operations/AbstractToolProviderOperation.java b/src/main/java/rife/bld/operations/AbstractToolProviderOperation.java index 6a6d40e..42e6b0c 100644 --- a/src/main/java/rife/bld/operations/AbstractToolProviderOperation.java +++ b/src/main/java/rife/bld/operations/AbstractToolProviderOperation.java @@ -97,10 +97,8 @@ public List cmdFiles() { * @param files one or more files * @return this operation instance */ - @SuppressWarnings({"unchecked"}) public T cmdFilesPaths(List files) { - cmdFiles_.addAll(files.stream().map(Path::toFile).map(File::getAbsolutePath).toList()); - return (T) this; + return cmdFilesStrings(files.stream().map(Path::toFile).map(File::getAbsolutePath).toList()); } /** diff --git a/src/main/java/rife/bld/operations/JlinkOptions.java b/src/main/java/rife/bld/operations/JlinkOptions.java index 1bdb19f..83dbb3b 100644 --- a/src/main/java/rife/bld/operations/JlinkOptions.java +++ b/src/main/java/rife/bld/operations/JlinkOptions.java @@ -207,7 +207,7 @@ public JlinkOptions modulePath(File path) { * @return this map of options */ public JlinkOptions modulePath(Path path) { - return modulePath(path.toFile()); + return modulePath(path.toFile().getAbsolutePath()); } /** @@ -268,7 +268,7 @@ public JlinkOptions output(File path) { * @return this map of options */ public JlinkOptions output(Path path) { - return output(path.toFile()); + return output(path.toFile().getAbsolutePath()); } /** diff --git a/src/main/java/rife/bld/operations/JmodOperation.java b/src/main/java/rife/bld/operations/JmodOperation.java index a2aa91e..bf044fc 100644 --- a/src/main/java/rife/bld/operations/JmodOperation.java +++ b/src/main/java/rife/bld/operations/JmodOperation.java @@ -70,8 +70,7 @@ public JmodOperation jmodFile(String file) { * @return this operation instance */ public JmodOperation jmodFile(File file) { - jmodFile_ = file.getAbsolutePath(); - return this; + return jmodFile(file.getAbsolutePath()); } /** @@ -83,7 +82,7 @@ public JmodOperation jmodFile(File file) { * @return this operation instance */ public JmodOperation jmodFile(Path file) { - return jmodFile(file.toFile()); + return jmodFile(file.toFile().getAbsolutePath()); } /** diff --git a/src/main/java/rife/bld/operations/JmodOptions.java b/src/main/java/rife/bld/operations/JmodOptions.java index d9e3128..cada561 100644 --- a/src/main/java/rife/bld/operations/JmodOptions.java +++ b/src/main/java/rife/bld/operations/JmodOptions.java @@ -60,7 +60,7 @@ public JmodOptions cmds(File path) { * @return this map of options */ public JmodOptions cmds(Path path) { - return cmds(path.toFile()); + return cmds(path.toFile().getAbsolutePath()); } /** @@ -110,7 +110,7 @@ public JmodOptions config(File path) { * @return this map of options */ public JmodOptions config(Path path) { - return config(path.toFile()); + return config(path.toFile().getAbsolutePath()); } /** @@ -152,7 +152,7 @@ public JmodOptions dir(File path) { * @return this map of options */ public JmodOptions dir(Path path) { - return dir(path.toFile()); + return dir(path.toFile().getAbsolutePath()); } /** @@ -256,7 +256,7 @@ public JmodOptions headerFiles(File path) { * @return this map of options */ public JmodOptions headerFiles(Path path) { - return headerFiles(path.toFile()); + return headerFiles(path.toFile().getAbsolutePath()); } /** @@ -288,7 +288,7 @@ public JmodOptions legalNotices(File path) { * @return this map of options */ public JmodOptions legalNotices(Path path) { - return legalNotices(path.toFile()); + return legalNotices(path.toFile().getAbsolutePath()); } /** @@ -320,7 +320,7 @@ public JmodOptions libs(File path) { * @return this map of options */ public JmodOptions libs(Path path) { - return libs(path.toFile()); + return libs(path.toFile().getAbsolutePath()); } /** @@ -363,7 +363,7 @@ public JmodOptions manPages(File path) { * @return this map of options */ public JmodOptions manPages(Path path) { - return manPages(path.toFile()); + return manPages(path.toFile().getAbsolutePath()); } /** @@ -394,7 +394,7 @@ public JmodOptions modulePath(File path) { * @return this map of options */ public JmodOptions modulePath(Path path) { - return modulePath(path.toFile()); + return modulePath(path.toFile().getAbsolutePath()); } /** diff --git a/src/main/java/rife/bld/operations/JpackageOperation.java b/src/main/java/rife/bld/operations/JpackageOperation.java index 07b87b8..5c40118 100644 --- a/src/main/java/rife/bld/operations/JpackageOperation.java +++ b/src/main/java/rife/bld/operations/JpackageOperation.java @@ -118,7 +118,7 @@ public Launcher(String name, File path) { } public Launcher(String name, Path path) { - this(name, path.toFile()); + this(name, path.toFile().getAbsolutePath()); } } } diff --git a/src/main/java/rife/bld/operations/JpackageOptions.java b/src/main/java/rife/bld/operations/JpackageOptions.java index feeb297..6dd5ef0 100644 --- a/src/main/java/rife/bld/operations/JpackageOptions.java +++ b/src/main/java/rife/bld/operations/JpackageOptions.java @@ -112,7 +112,7 @@ public JpackageOptions appImage(File path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions appImage(Path path) { - return appImage(path.toFile()); + return appImage(path.toFile().getAbsolutePath()); } /** @@ -204,7 +204,7 @@ public JpackageOptions dest(File path) { * @return this map of options */ public JpackageOptions dest(Path path) { - return dest(path.toFile()); + return dest(path.toFile().getAbsolutePath()); } /** @@ -271,7 +271,7 @@ public JpackageOptions fileAssociations(List paths) { * @return this map of options */ public JpackageOptions fileAssociationsPaths(List paths) { - return fileAssociations(paths.stream().map(Path::toFile).toList()); + return fileAssociationsStrings(paths.stream().map(Path::toFile).map(File::getAbsolutePath).toList()); } /** @@ -316,7 +316,7 @@ public JpackageOptions icon(File path) { * @return this map of options */ public JpackageOptions icon(Path path) { - return icon(path.toFile()); + return icon(path.toFile().getAbsolutePath()); } /** @@ -354,7 +354,7 @@ public JpackageOptions input(File path) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions input(Path path) { - return input(path.toFile()); + return input(path.toFile().getAbsolutePath()); } /** @@ -386,7 +386,7 @@ public JpackageOptions installDir(File path) { * @return this map of options */ public JpackageOptions installDir(Path path) { - return installDir(path.toFile()); + return installDir(path.toFile().getAbsolutePath()); } /** @@ -472,7 +472,7 @@ public JpackageOptions licenseFile(File path) { * @return this map of options */ public JpackageOptions licenseFile(Path path) { - return licenseFile(path.toFile()); + return licenseFile(path.toFile().getAbsolutePath()); } /** @@ -634,8 +634,7 @@ public JpackageOptions macDmgContent(String... additionalContents) { */ @SuppressWarnings("UnusedReturnValue") public JpackageOptions macDmgContent(List additionalContents) { - put("--mac-dmg-content", String.join(",", additionalContents.stream().map(File::getAbsolutePath).toList())); - return this; + return macDmgContentStrings(additionalContents.stream().map(File::getAbsolutePath).toList()); } /** @@ -656,9 +655,7 @@ public JpackageOptions macDmgContent(File... additionalContents) { * @return this map of options */ public JpackageOptions macDmgContentPaths(List additionalContents) { - put("--mac-dmg-content", String.join(",", - additionalContents.stream().map(Path::toFile).map(File::getAbsolutePath).toList())); - return this; + return macDmgContentStrings(additionalContents.stream().map(Path::toFile).map(File::getAbsolutePath).toList()); } /** @@ -711,7 +708,7 @@ public JpackageOptions macEntitlements(File path) { * @return this map of options */ public JpackageOptions macEntitlements(Path path) { - return macEntitlements(path.toFile()); + return macEntitlements(path.toFile().getAbsolutePath()); } /** @@ -969,7 +966,7 @@ public JpackageOptions modulePath(Path... paths) { * @return this map of options */ public JpackageOptions modulePathPaths(List paths) { - return modulePath(paths.stream().map(Path::toFile).toList()); + return modulePathStrings(paths.stream().map(Path::toFile).map(File::getAbsolutePath).toList()); } /** @@ -1031,7 +1028,7 @@ public JpackageOptions resourceDir(File path) { * @return this map of options */ public JpackageOptions resourceDir(Path path) { - return resourceDir(path.toFile()); + return resourceDir(path.toFile().getAbsolutePath()); } /** @@ -1084,7 +1081,7 @@ public JpackageOptions runtimeImage(File path) { * @return this map of options */ public JpackageOptions runtimeImage(Path path) { - return runtimeImage(path.toFile()); + return runtimeImage(path.toFile().getAbsolutePath()); } /** @@ -1143,7 +1140,7 @@ public JpackageOptions temp(File path) { * @return this map of options */ public JpackageOptions temp(Path path) { - return temp(path.toFile()); + return temp(path.toFile().getAbsolutePath()); } /** diff --git a/src/test/java/rife/bld/operations/TestJlinkOperation.java b/src/test/java/rife/bld/operations/TestJlinkOperation.java index a42d74f..afd8bf3 100644 --- a/src/test/java/rife/bld/operations/TestJlinkOperation.java +++ b/src/test/java/rife/bld/operations/TestJlinkOperation.java @@ -161,13 +161,13 @@ void testModulePath() { options.modulePath("foo"); assertEquals("foo", options.get("--module-path")); - var barPath = Path.of("bar"); - options.modulePath(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--module-path")); + var bar = Path.of("bar"); + options = options.modulePath(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--module-path")); - var fooFile = new File("foo"); - options.modulePath(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--module-path")); + var foo = new File("foo"); + options = options.modulePath(foo); + assertEquals(foo.getAbsolutePath(), options.get("--module-path")); } @Test @@ -184,13 +184,13 @@ void testOutput() { options.output("foo"); assertEquals("foo", options.get("--output")); - var barPath = Path.of("bar"); - options.output(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--output")); + var bar = Path.of("bar"); + options = options.output(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--output")); - var fooFile = new File("foo"); - options.output(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--output")); + var foo = new File("foo"); + options = options.output(foo); + assertEquals(foo.getAbsolutePath(), options.get("--output")); } @Test diff --git a/src/test/java/rife/bld/operations/TestJmodOperation.java b/src/test/java/rife/bld/operations/TestJmodOperation.java index 54d79f8..ec26b2c 100644 --- a/src/test/java/rife/bld/operations/TestJmodOperation.java +++ b/src/test/java/rife/bld/operations/TestJmodOperation.java @@ -122,13 +122,13 @@ void testCmds() { var options = new JmodOptions().cmds("foo"); assertEquals("foo", options.get("--cmds")); - var barPath = Path.of("bar"); - options = options.cmds(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--cmds")); + var bar = Path.of("bar"); + options = options.cmds(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--cmds")); - var fooFile = new File("foo"); - options.cmds(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--cmds")); + var foo = new File("foo"); + options.cmds(foo); + assertEquals(foo.getAbsolutePath(), options.get("--cmds")); } @Test @@ -136,13 +136,13 @@ void testConfig() { var options = new JmodOptions().config("foo"); assertEquals("foo", options.get("--config")); - var barPath = Path.of("bar"); - options = options.config(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--config")); + var bar = Path.of("bar"); + options = options.config(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--config")); - var fooFile = new File("foo"); - options.config(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--config")); + var foo = new File("foo"); + options = options.config(foo); + assertEquals(foo.getAbsolutePath(), options.get("--config")); } @Test @@ -172,13 +172,13 @@ void testDir() { var options = new JmodOptions().dir("foo"); assertEquals("foo", options.get("--dir")); - var barPath = Path.of("bar"); - options = options.dir(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--dir")); + var bar = Path.of("bar"); + options = options.dir(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--dir")); - var fooFile = new File("foo"); - options.dir(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--dir")); + var foo = new File("foo"); + options = options.dir(foo); + assertEquals(foo.getAbsolutePath(), options.get("--dir")); } @Test @@ -222,13 +222,13 @@ void testHeaderFiles() { var options = new JmodOptions().headerFiles("foo"); assertEquals("foo", options.get("--header-files")); - var barPath = Path.of("bar"); - options = options.headerFiles(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--header-files")); + var bar = Path.of("bar"); + options = options.headerFiles(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--header-files")); - var fooFile = new File("foo"); - options.headerFiles(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--header-files")); + var foo = new File("foo"); + options.headerFiles(foo); + assertEquals(foo.getAbsolutePath(), options.get("--header-files")); } @Test @@ -243,13 +243,13 @@ void testJmodFile() { var op = new JmodOperation().jmodFile("foo"); assertEquals("foo", op.jmodFile()); - var barPath = Path.of("bar"); - op = op.jmodFile(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), op.jmodFile()); + var bar = Path.of("bar"); + op = op.jmodFile(bar); + assertEquals(bar.toFile().getAbsolutePath(), op.jmodFile()); - var fooFile = new File("foo"); - op.jmodFile(fooFile); - assertEquals(fooFile.getAbsolutePath(), op.jmodFile()); + var foo = new File("foo"); + op.jmodFile(foo); + assertEquals(foo.getAbsolutePath(), op.jmodFile()); } @Test @@ -257,13 +257,13 @@ void testLegalNotices() { var options = new JmodOptions().legalNotices("foo"); assertEquals("foo", options.get("--legal-notices")); - var barPath = Path.of("bar"); - options = options.legalNotices(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--legal-notices")); + var bar = Path.of("bar"); + options = options.legalNotices(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--legal-notices")); - var fooFile = new File("foo"); - options.legalNotices(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--legal-notices")); + var foo = new File("foo"); + options.legalNotices(foo); + assertEquals(foo.getAbsolutePath(), options.get("--legal-notices")); } @Test @@ -271,13 +271,13 @@ void testLibs() { var options = new JmodOptions().libs("foo"); assertEquals("foo", options.get("--libs")); - var barPath = Path.of("bar"); - options = options.libs(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--libs")); + var bar = Path.of("bar"); + options = options.libs(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--libs")); - var fooFile = new File("foo"); - options.libs(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--libs")); + var foo = new File("foo"); + options.libs(foo); + assertEquals(foo.getAbsolutePath(), options.get("--libs")); } @Test @@ -285,13 +285,13 @@ void testManPages() { var options = new JmodOptions().manPages("foo"); assertEquals("foo", options.get("--man-pages")); - var barPath = Path.of("bar"); - options = options.manPages(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--man-pages")); + var bar = Path.of("bar"); + options = options.manPages(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--man-pages")); - var fooFile = new File("foo"); - options.manPages(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--man-pages")); + var foo = new File("foo"); + options.manPages(foo); + assertEquals(foo.getAbsolutePath(), options.get("--man-pages")); } @Test @@ -299,13 +299,13 @@ void testModulePath() { var options = new JmodOptions().modulePath("foo"); assertEquals("foo", options.get("--module-path")); - var barPath = Path.of("bar"); - options = options.modulePath(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--module-path")); + var bar = Path.of("bar"); + options = options.modulePath(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--module-path")); - var fooFile = new File("foo"); - options.modulePath(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--module-path")); + var foo = new File("foo"); + options = options.modulePath(foo); + assertEquals(foo.getAbsolutePath(), options.get("--module-path")); } @Test diff --git a/src/test/java/rife/bld/operations/TestJpackageOperation.java b/src/test/java/rife/bld/operations/TestJpackageOperation.java index f81a822..699a6d0 100644 --- a/src/test/java/rife/bld/operations/TestJpackageOperation.java +++ b/src/test/java/rife/bld/operations/TestJpackageOperation.java @@ -15,6 +15,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.HashMap; +import java.util.List; import static org.junit.jupiter.api.Assertions.*; import static rife.bld.operations.JpackageOperation.Launcher; @@ -32,22 +33,29 @@ public void tearDown() { @Test void testAddLauncher() { var op = new JpackageOperation(); + var bar = Path.of("bar-path"); + var foo = new File("foo/bar"); var fooLauncher = new Launcher("foo-name", "foo-path"); - var barPath = Path.of("bar-path"); - var barLauncher = new Launcher("bar-name", barPath); + assertEquals("foo-name", fooLauncher.name()); + assertEquals("foo-path", fooLauncher.path()); + + var barLauncher = new Launcher("bar-name", bar); assertEquals("bar-name", barLauncher.name()); - assertEquals(barPath.toFile().getAbsolutePath(), barLauncher.path()); + assertEquals(bar.toFile().getAbsolutePath(), barLauncher.path()); - var fooFile = new File("foo/bar"); - var foobarLauncher = new Launcher("foobar", fooFile); + var foobarLauncher = new Launcher("foobar", foo); assertEquals("foobar", foobarLauncher.name()); - assertEquals(fooFile.getAbsolutePath(), foobarLauncher.path()); + assertEquals(foo.getAbsolutePath(), foobarLauncher.path()); op = op.addLauncher(fooLauncher); - assertTrue(op.launchers().contains(fooLauncher), "foo not found"); + assertTrue(op.launchers().contains(fooLauncher), "foo launcher not found"); + op.addLauncher(barLauncher); - assertTrue(op.launchers().contains(barLauncher), "bar not found"); + assertTrue(op.launchers().contains(barLauncher), "bar launcher not found"); + + op.addLauncher(foobarLauncher); + assertTrue(op.launchers().contains(fooLauncher), "foobar launcher not found"); } @Test @@ -55,13 +63,13 @@ void testAppImage() { var options = new JpackageOptions().appImage("foo"); assertEquals("foo", options.get("--app-image")); - var barPath = Path.of("bar"); - options.appImage(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--app-image")); + var bar = Path.of("bar"); + options.appImage(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--app-image")); - var fooFile = new File("foo"); - options = options.appImage(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--app-image")); + var foo = new File("foo"); + options = options.appImage(foo); + assertEquals(foo.getAbsolutePath(), options.get("--app-image")); } @Test @@ -264,30 +272,40 @@ void testDest() { var options = new JpackageOptions().dest("foo"); assertEquals("foo", options.get("--dest")); - var barPath = Path.of("bar"); - options = options.dest(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--dest")); + var bar = Path.of("bar"); + options = options.dest(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--dest")); - var fooFile = new File("foo"); - options.dest(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--dest")); + var foo = new File("foo"); + options.dest(foo); + assertEquals(foo.getAbsolutePath(), options.get("--dest")); } @Test void testFileAssociations() { var options = new JpackageOptions().fileAssociations("foo", "bar"); - assertEquals("foo,bar", options.get("--file-associations")); - - var barPath = Path.of("bar"); - var fooPath = Path.of("foo"); - options = options.fileAssociations(barPath, fooPath); - assertEquals(barPath.toFile().getAbsolutePath() + ',' + fooPath.toFile().getAbsolutePath(), - options.get("--file-associations")); - - var fooFile = new File("foo"); - var barFile = new File("bar"); - options.fileAssociations(fooFile, barFile); - assertEquals(fooFile.getAbsolutePath() + ',' + barFile.getAbsolutePath(), options.get("--file-associations")); + assertEquals("foo,bar", options.get("--file-associations"), "String..."); + + var foo = new File("foo"); + var bar = new File("bar"); + options = options.fileAssociations(foo.toPath(), bar.toPath()); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--file-associations"), + "Path..."); + + options.fileAssociations(foo, bar); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--file-associations"), + "File..."); + + options.fileAssociations(List.of(foo, bar)); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--file-associations"), + "List(File...)"); + + options.fileAssociationsPaths(List.of(foo.toPath(), bar.toPath())); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--file-associations"), + "List(Path...)"); + + options.fileAssociationsStrings(List.of("foo", "bar")); + assertEquals("foo,bar", options.get("--file-associations"), "List(String...)"); } @Test @@ -302,13 +320,13 @@ void testIcon() { var options = new JpackageOptions().icon("foo"); assertEquals("foo", options.get("--icon")); - var barPath = Path.of("bar"); - options = options.icon(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--icon")); + var bar = Path.of("bar"); + options = options.icon(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--icon")); - var fooFile = new File("foo"); - options.icon(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--icon")); + var foo = new File("foo"); + options.icon(foo); + assertEquals(foo.getAbsolutePath(), options.get("--icon")); } @Test @@ -318,13 +336,13 @@ void testInput() { options.input("foo"); assertEquals("foo", options.get("--input")); - var barPath = Path.of("bar"); - options.input(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--input")); + var bar = Path.of("bar"); + options.input(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--input")); - var fooFile = new File("foo"); - options.input(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--input")); + var foo = new File("foo"); + options = options.input(foo); + assertEquals(foo.getAbsolutePath(), options.get("--input")); } @Test @@ -332,13 +350,13 @@ void testInstallDir() { var options = new JpackageOptions().installDir("foo"); assertEquals("foo", options.get("--install-dir")); - var barPath = Path.of("bar"); - options = options.installDir(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--install-dir")); + var bar = Path.of("bar"); + options = options.installDir(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--install-dir")); - var fooFile = new File("foo"); - options.installDir(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--install-dir")); + var foo = new File("foo"); + options.installDir(foo); + assertEquals(foo.getAbsolutePath(), options.get("--install-dir")); } @Test @@ -346,31 +364,40 @@ void testLicenseFile() { var options = new JpackageOptions().licenseFile("foo"); assertEquals("foo", options.get("--license-file")); - var barPath = Path.of("bar"); - options = options.licenseFile(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--license-file")); + var bar = Path.of("bar"); + options = options.licenseFile(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--license-file")); - var fooFile = new File("foo"); - options.licenseFile(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--license-file")); + var foo = new File("foo"); + options.licenseFile(foo); + assertEquals(foo.getAbsolutePath(), options.get("--license-file")); } @Test void testMacDmgContent() { var options = new JpackageOptions().macDmgContent("foo", "bar"); - assertEquals("foo,bar", options.get("--mac-dmg-content")); + assertEquals("foo,bar", options.get("--mac-dmg-content"), "String..."); + + var foo = new File("foo"); + var bar = new File("bar"); + options.macDmgContent(foo, bar); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"), + "File..."); + + options = options.macDmgContent(foo.toPath(), bar.toPath()); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"), + "Path..."); - var barPath = Path.of("bar"); - var fooPath = Path.of("foo"); + options.macDmgContent(List.of(foo, bar)); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"), + "List(File...)"); - options = options.macDmgContent(barPath, fooPath); - assertEquals(barPath.toFile().getAbsolutePath() + ',' + fooPath.toFile().getAbsolutePath(), - options.get("--mac-dmg-content")); + options.macDmgContentPaths(List.of(foo.toPath(), bar.toPath())); + assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"), + "List(Path...)"); - var fooFile = new File("foo"); - var barFile = new File("bar"); - options.macDmgContent(fooFile, barFile); - assertEquals(fooFile.getAbsolutePath() + ',' + barFile.getAbsolutePath(), options.get("--mac-dmg-content")); + options.macDmgContentStrings(List.of("foo", "bar")); + assertEquals("foo,bar", options.get("--mac-dmg-content"), "List(String...)"); } @Test @@ -378,13 +405,13 @@ void testMacEntitlements() { var options = new JpackageOptions().macEntitlements("foo"); assertEquals("foo", options.get("--mac-entitlements")); - var barPath = Path.of("bar"); - options = options.macEntitlements(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--mac-entitlements")); + var bar = Path.of("bar"); + options = options.macEntitlements(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--mac-entitlements")); - var fooFile = new File("foo"); - options.macEntitlements(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--mac-entitlements")); + var foo = new File("foo"); + options.macEntitlements(foo); + assertEquals(foo.getAbsolutePath(), options.get("--mac-entitlements")); } @Test @@ -401,13 +428,13 @@ void testModulePath() { var options = new JpackageOptions().modulePath("foo"); assertEquals("foo", options.get("--module-path")); - var barPath = Path.of("bar"); - options = options.modulePath(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--module-path")); + var bar = Path.of("bar"); + options = options.modulePath(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--module-path")); - var fooFile = new File("foo"); - options.modulePath(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--module-path")); + var foo = new File("foo"); + options.modulePath(foo); + assertEquals(foo.getAbsolutePath(), options.get("--module-path")); } @Test @@ -423,13 +450,13 @@ void testResourceDir() { var options = new JpackageOptions().resourceDir("foo"); assertEquals("foo", options.get("--resource-dir")); - var barPath = Path.of("bar"); - options = options.resourceDir(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--resource-dir")); + var bar = Path.of("bar"); + options = options.resourceDir(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--resource-dir")); - var fooFile = new File("foo"); - options.resourceDir(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--resource-dir")); + var foo = new File("foo"); + options.resourceDir(foo); + assertEquals(foo.getAbsolutePath(), options.get("--resource-dir")); } @Test @@ -437,13 +464,13 @@ void testRuntimeImage() { var options = new JpackageOptions().runtimeImage("foo"); assertEquals("foo", options.get("--runtime-image")); - var barPath = Path.of("bar"); - options = options.runtimeImage(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--runtime-image")); + var bar = Path.of("bar"); + options = options.runtimeImage(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--runtime-image")); - var fooFile = new File("foo"); - options.runtimeImage(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--runtime-image")); + var foo = new File("foo"); + options.runtimeImage(foo); + assertEquals(foo.getAbsolutePath(), options.get("--runtime-image")); } @Test @@ -451,13 +478,13 @@ void testTemp() { var options = new JpackageOptions().temp("foo"); assertEquals("foo", options.get("--temp")); - var barPath = Path.of("bar"); - options = options.temp(barPath); - assertEquals(barPath.toFile().getAbsolutePath(), options.get("--temp")); + var bar = Path.of("bar"); + options = options.temp(bar); + assertEquals(bar.toFile().getAbsolutePath(), options.get("--temp")); - var fooFile = new File("foo"); - options.temp(fooFile); - assertEquals(fooFile.getAbsolutePath(), options.get("--temp")); + var foo = new File("foo"); + options.temp(foo); + assertEquals(foo.getAbsolutePath(), options.get("--temp")); } @Test