mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-24 15:57:11 -07:00
More cleanups to jlink, jmod & jpackage operations, options and tests
This commit is contained in:
parent
c7ca0e263d
commit
5da9e4b3a5
9 changed files with 216 additions and 195 deletions
|
@ -97,10 +97,8 @@ public abstract class AbstractToolProviderOperation<T extends AbstractToolProvid
|
|||
* @param files one or more files
|
||||
* @return this operation instance
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public T cmdFilesPaths(List<Path> 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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -207,7 +207,7 @@ public class JlinkOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JlinkOptions modulePath(Path path) {
|
||||
return modulePath(path.toFile());
|
||||
return modulePath(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,7 +268,7 @@ public class JlinkOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JlinkOptions output(Path path) {
|
||||
return output(path.toFile());
|
||||
return output(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,8 +70,7 @@ public class JmodOperation extends AbstractToolProviderOperation<JmodOperation>
|
|||
* @return this operation instance
|
||||
*/
|
||||
public JmodOperation jmodFile(File file) {
|
||||
jmodFile_ = file.getAbsolutePath();
|
||||
return this;
|
||||
return jmodFile(file.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +82,7 @@ public class JmodOperation extends AbstractToolProviderOperation<JmodOperation>
|
|||
* @return this operation instance
|
||||
*/
|
||||
public JmodOperation jmodFile(Path file) {
|
||||
return jmodFile(file.toFile());
|
||||
return jmodFile(file.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions cmds(Path path) {
|
||||
return cmds(path.toFile());
|
||||
return cmds(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions config(Path path) {
|
||||
return config(path.toFile());
|
||||
return config(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,7 +152,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions dir(Path path) {
|
||||
return dir(path.toFile());
|
||||
return dir(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +256,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions headerFiles(Path path) {
|
||||
return headerFiles(path.toFile());
|
||||
return headerFiles(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -288,7 +288,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions legalNotices(Path path) {
|
||||
return legalNotices(path.toFile());
|
||||
return legalNotices(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -320,7 +320,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions libs(Path path) {
|
||||
return libs(path.toFile());
|
||||
return libs(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -363,7 +363,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions manPages(Path path) {
|
||||
return manPages(path.toFile());
|
||||
return manPages(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,7 +394,7 @@ public class JmodOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JmodOptions modulePath(Path path) {
|
||||
return modulePath(path.toFile());
|
||||
return modulePath(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -118,7 +118,7 @@ public class JpackageOperation extends AbstractToolProviderOperation<JpackageOpe
|
|||
}
|
||||
|
||||
public Launcher(String name, Path path) {
|
||||
this(name, path.toFile());
|
||||
this(name, path.toFile().getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions appImage(Path path) {
|
||||
return appImage(path.toFile());
|
||||
return appImage(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,7 +204,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions dest(Path path) {
|
||||
return dest(path.toFile());
|
||||
return dest(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,7 +271,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions fileAssociationsPaths(List<Path> 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 class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions icon(Path path) {
|
||||
return icon(path.toFile());
|
||||
return icon(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -354,7 +354,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions input(Path path) {
|
||||
return input(path.toFile());
|
||||
return input(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,7 +386,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions installDir(Path path) {
|
||||
return installDir(path.toFile());
|
||||
return installDir(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -472,7 +472,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions licenseFile(Path path) {
|
||||
return licenseFile(path.toFile());
|
||||
return licenseFile(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -634,8 +634,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public JpackageOptions macDmgContent(List<File> 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 class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions macDmgContentPaths(List<Path> 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 class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions macEntitlements(Path path) {
|
||||
return macEntitlements(path.toFile());
|
||||
return macEntitlements(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -969,7 +966,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions modulePathPaths(List<Path> 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 class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions resourceDir(Path path) {
|
||||
return resourceDir(path.toFile());
|
||||
return resourceDir(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1084,7 +1081,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions runtimeImage(Path path) {
|
||||
return runtimeImage(path.toFile());
|
||||
return runtimeImage(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1143,7 +1140,7 @@ public class JpackageOptions extends LinkedHashMap<String, String> {
|
|||
* @return this map of options
|
||||
*/
|
||||
public JpackageOptions temp(Path path) {
|
||||
return temp(path.toFile());
|
||||
return temp(path.toFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,13 +161,13 @@ public class TestJlinkOperation {
|
|||
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 @@ public class TestJlinkOperation {
|
|||
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
|
||||
|
|
|
@ -122,13 +122,13 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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 @@ public class TestJmodOperation {
|
|||
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
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.io.PrintStream;
|
|||
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 class TestJpackageOperation {
|
|||
@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("bar-name", barLauncher.name());
|
||||
assertEquals(barPath.toFile().getAbsolutePath(), barLauncher.path());
|
||||
assertEquals("foo-name", fooLauncher.name());
|
||||
assertEquals("foo-path", fooLauncher.path());
|
||||
|
||||
var fooFile = new File("foo/bar");
|
||||
var foobarLauncher = new Launcher("foobar", fooFile);
|
||||
var barLauncher = new Launcher("bar-name", bar);
|
||||
assertEquals("bar-name", barLauncher.name());
|
||||
assertEquals(bar.toFile().getAbsolutePath(), barLauncher.path());
|
||||
|
||||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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"));
|
||||
assertEquals("foo,bar", options.get("--file-associations"), "String...");
|
||||
|
||||
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 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...");
|
||||
|
||||
var fooFile = new File("foo");
|
||||
var barFile = new File("bar");
|
||||
options.fileAssociations(fooFile, barFile);
|
||||
assertEquals(fooFile.getAbsolutePath() + ',' + barFile.getAbsolutePath(), options.get("--file-associations"));
|
||||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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 barPath = Path.of("bar");
|
||||
var fooPath = Path.of("foo");
|
||||
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(barPath, fooPath);
|
||||
assertEquals(barPath.toFile().getAbsolutePath() + ',' + fooPath.toFile().getAbsolutePath(),
|
||||
options.get("--mac-dmg-content"));
|
||||
options = options.macDmgContent(foo.toPath(), bar.toPath());
|
||||
assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"),
|
||||
"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.macDmgContent(List.of(foo, bar));
|
||||
assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"),
|
||||
"List(File...)");
|
||||
|
||||
options.macDmgContentPaths(List.of(foo.toPath(), bar.toPath()));
|
||||
assertEquals(foo.getAbsolutePath() + ',' + bar.getAbsolutePath(), options.get("--mac-dmg-content"),
|
||||
"List(Path...)");
|
||||
|
||||
options.macDmgContentStrings(List.of("foo", "bar"));
|
||||
assertEquals("foo,bar", options.get("--mac-dmg-content"), "List(String...)");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -378,13 +405,13 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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 @@ public class TestJpackageOperation {
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue