2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 00:07:12 -07:00

Made paths specifications absolute

This commit is contained in:
Erik C. Thauvin 2024-08-25 18:46:15 -07:00
parent 5821022fee
commit 0b9581cf12
Signed by: erik
GPG key ID: 776702A6A2DA330E
9 changed files with 217 additions and 165 deletions

View file

@ -26,7 +26,6 @@ public class JlinkOperation extends AbstractToolProviderOperation<JlinkOperation
super("jlink");
}
/**
* Read options and/or mode from file(s).
*
@ -56,7 +55,7 @@ public class JlinkOperation extends AbstractToolProviderOperation<JlinkOperation
* @return this operation instance
*/
public JlinkOperation cmdFiles(Path... file) {
cmdFiles_.addAll(Arrays.stream(file).map(Path::toString).toList());
cmdFiles_.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
return this;
}

View file

@ -187,7 +187,7 @@ public class JlinkOptions extends HashMap<String, String> {
* @return this map of options
*/
public JlinkOptions modulePath(Path path) {
put("--module-path", path.toString());
put("--module-path", path.toFile().getAbsolutePath());
return this;
}
@ -250,7 +250,7 @@ public class JlinkOptions extends HashMap<String, String> {
* @return this map of options
*/
public JlinkOptions output(Path path) {
put("--output", path.toString());
put("--output", path.toFile().getAbsolutePath());
return this;
}

View file

@ -65,7 +65,7 @@ public class JmodOperation extends AbstractToolProviderOperation<JmodOperation>
* @return this operation instance
*/
public JmodOperation cmdFiles(Path... file) {
cmdFiles.addAll(Arrays.stream(file).map(Path::toString).toList());
cmdFiles.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
return this;
}
@ -129,7 +129,7 @@ public class JmodOperation extends AbstractToolProviderOperation<JmodOperation>
* @return this operation instance
*/
public JmodOperation jmodFile(Path file) {
jmodFile_ = file.toString();
jmodFile_ = file.toFile().getAbsolutePath();
return this;
}

View file

@ -60,7 +60,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions cmds(Path path) {
put("--cmds", path.toString());
put("--cmds", path.toFile().getAbsolutePath());
return this;
}
@ -112,7 +112,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions config(Path path) {
put("--config", path.toString());
put("--config", path.toFile().getAbsolutePath());
return this;
}
@ -156,7 +156,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions dir(Path path) {
put("--dir", path.toString());
put("--dir", path.toFile().getAbsolutePath());
return this;
}
@ -252,7 +252,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions headerFiles(Path path) {
put("--header-files", path.toString());
put("--header-files", path.toFile().getAbsolutePath());
return this;
}
@ -286,7 +286,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions legalNotices(Path path) {
put("--legal-notices", path.toString());
put("--legal-notices", path.toFile().getAbsolutePath());
return this;
}
@ -320,7 +320,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions libs(Path path) {
put("--libs", path.toString());
put("--libs", path.toFile().getAbsolutePath());
return this;
}
@ -365,7 +365,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions manPages(Path path) {
put("--man-pages", path.toString());
put("--man-pages", path.toFile().getAbsolutePath());
return this;
}
@ -398,7 +398,7 @@ public class JmodOptions extends HashMap<String, String> {
* @return this map of options
*/
public JmodOptions modulePath(Path path) {
put("--module-path", path.toString());
put("--module-path", path.toFile().getAbsolutePath());
return this;
}

View file

@ -60,7 +60,7 @@ public class JpackageOperation extends AbstractToolProviderOperation<JpackageOpe
* @return this operation instance
*/
public JpackageOperation cmdFiles(Path... file) {
cmdFiles_.addAll(Arrays.stream(file).map(Path::toString).toList());
cmdFiles_.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
return this;
}
@ -147,7 +147,7 @@ public class JpackageOperation extends AbstractToolProviderOperation<JpackageOpe
}
public Launcher(String name, Path path) {
this(name, path.toString());
this(name, path.toFile().getAbsolutePath());
}
}
}

View file

@ -86,7 +86,7 @@ public class JpackageOptions extends HashMap<String, String> {
*/
@SuppressWarnings("UnusedReturnValue")
public JpackageOptions appImage(Path path) {
put("--app-image", path.toString());
put("--app-image", path.toFile().getAbsolutePath());
return this;
}
@ -170,7 +170,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions dest(Path path) {
put("--dest", path.toString());
put("--dest", path.toFile().getAbsolutePath());
return this;
}
@ -213,7 +213,8 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions fileAssociations(Path... path) {
put("--file-associations", String.join(",", Arrays.stream(path).map(Path::toString).toList()));
put("--file-associations", String.join(",",
Arrays.stream(path).map(Path::toFile).map(File::getAbsolutePath).toList()));
return this;
}
@ -247,7 +248,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions icon(Path path) {
put("--icon", path.toString());
put("--icon", path.toFile().getAbsolutePath());
return this;
}
@ -286,7 +287,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions input(Path path) {
put("--input", path.toString());
put("--input", path.toFile().getAbsolutePath());
return this;
}
@ -320,7 +321,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions installDir(Path path) {
put("--install-dir", path.toString());
put("--install-dir", path.toFile().getAbsolutePath());
return this;
}
@ -398,7 +399,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions licenseFile(Path path) {
put("--license-file", path.toString());
put("--license-file", path.toFile().getAbsolutePath());
return this;
}
@ -573,7 +574,8 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions macDmgContent(Path... additionalContent) {
put("--mac-dmg-content", String.join(",", Arrays.stream(additionalContent).map(Path::toString).toList()));
put("--mac-dmg-content", String.join(",",
Arrays.stream(additionalContent).map(Path::toFile).map(File::getAbsolutePath).toList()));
return this;
}
@ -607,7 +609,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions macEntitlements(Path path) {
put("--mac-entitlements", path.toString());
put("--mac-entitlements", path.toFile().getAbsolutePath());
return this;
}
@ -824,7 +826,8 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions modulePath(Path... path) {
put("--module-path", String.join(":", Arrays.stream(path).map(Path::toString).toList()));
put("--module-path", String.join(":",
Arrays.stream(path).map(Path::toFile).map(File::getAbsolutePath).toList()));
return this;
}
@ -888,7 +891,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions resourceDir(Path path) {
put("--resource-dir", path.toString());
put("--resource-dir", path.toFile().getAbsolutePath());
return this;
}
@ -943,7 +946,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions runtimeImage(Path path) {
put("--runtime-image", path.toString());
put("--runtime-image", path.toFile().getAbsolutePath());
return this;
}
@ -1004,7 +1007,7 @@ public class JpackageOptions extends HashMap<String, String> {
* @return this map of options
*/
public JpackageOptions temp(Path path) {
put("--temp", path.toString());
put("--temp", path.toFile().getAbsolutePath());
return this;
}

View file

@ -158,15 +158,16 @@ public class TestJlinkOperation {
@Test
void testModulePath() {
var options = new JlinkOptions();
options.modulePath("foo");
assertEquals("foo", options.get("--module-path"));
options.modulePath(Path.of("bar"));
assertEquals("bar", options.get("--module-path"));
var foo = new File("foo");
options.modulePath(foo);
assertEquals(foo.getAbsolutePath(), options.get("--module-path"));
var barPath = Path.of("bar");
options.modulePath(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--module-path"));
var fooFile = new File("foo");
options.modulePath(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--module-path"));
}
@Test
@ -180,15 +181,16 @@ public class TestJlinkOperation {
@Test
void testOutput() {
var options = new JlinkOptions();
options.output("foo");
assertEquals("foo", options.get("--output"));
options.output(Path.of("bar"));
assertEquals("bar", options.get("--output"));
var foo = new File("foo");
options.output(foo);
assertEquals(foo.getAbsolutePath(), options.get("--output"));
var barPath = Path.of("bar");
options.output(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--output"));
var fooFile = new File("foo");
options.output(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--output"));
}
@Test

View file

@ -121,24 +121,28 @@ public class TestJmodOperation {
void testCmds() {
var options = new JmodOptions().cmds("foo");
assertEquals("foo", options.get("--cmds"));
options = options.cmds(Path.of("bar"));
assertEquals("bar", options.get("--cmds"));
var foo = new File("foo");
options.cmds(foo);
assertEquals(foo.getAbsolutePath(), options.get("--cmds"));
var barPath = Path.of("bar");
options = options.cmds(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--cmds"));
var fooFile = new File("foo");
options.cmds(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--cmds"));
}
@Test
void testConfig() {
var options = new JmodOptions().config("foo");
assertEquals("foo", options.get("--config"));
options = options.config(Path.of("bar"));
assertEquals("bar", options.get("--config"));
var foo = new File("foo");
options.config(foo);
assertEquals(foo.getAbsolutePath(), options.get("--config"));
var barPath = Path.of("bar");
options = options.config(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--config"));
var fooFile = new File("foo");
options.config(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--config"));
}
@Test
@ -167,12 +171,14 @@ public class TestJmodOperation {
void testDir() {
var options = new JmodOptions().dir("foo");
assertEquals("foo", options.get("--dir"));
options = options.dir(Path.of("bar"));
assertEquals("bar", options.get("--dir"));
var foo = new File("foo");
options.dir(foo);
assertEquals(foo.getAbsolutePath(), options.get("--dir"));
var barPath = Path.of("bar");
options = options.dir(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--dir"));
var fooFile = new File("foo");
options.dir(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--dir"));
}
@Test
@ -215,12 +221,14 @@ public class TestJmodOperation {
void testHeaderFiles() {
var options = new JmodOptions().headerFiles("foo");
assertEquals("foo", options.get("--header-files"));
options = options.headerFiles(Path.of("bar"));
assertEquals("bar", options.get("--header-files"));
var foo = new File("foo");
options.headerFiles(foo);
assertEquals(foo.getAbsolutePath(), options.get("--header-files"));
var barPath = Path.of("bar");
options = options.headerFiles(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--header-files"));
var fooFile = new File("foo");
options.headerFiles(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--header-files"));
}
@Test
@ -234,60 +242,70 @@ public class TestJmodOperation {
void testJmodFile() {
var op = new JmodOperation().jmodFile("foo");
assertEquals("foo", op.jmodFile());
op = op.jmodFile(Path.of("bar"));
assertEquals("bar", op.jmodFile());
var foo = new File("foo");
op.jmodFile(foo);
assertEquals(foo.getAbsolutePath(), op.jmodFile());
var barPath = Path.of("bar");
op = op.jmodFile(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), op.jmodFile());
var fooFile = new File("foo");
op.jmodFile(fooFile);
assertEquals(fooFile.getAbsolutePath(), op.jmodFile());
}
@Test
void testLegalNotices() {
var options = new JmodOptions().legalNotices("foo");
assertEquals("foo", options.get("--legal-notices"));
options = options.legalNotices(Path.of("bar"));
assertEquals("bar", options.get("--legal-notices"));
var foo = new File("foo");
options.legalNotices(foo);
assertEquals(foo.getAbsolutePath(), options.get("--legal-notices"));
var barPath = Path.of("bar");
options = options.legalNotices(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--legal-notices"));
var fooFile = new File("foo");
options.legalNotices(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--legal-notices"));
}
@Test
void testLibs() {
var options = new JmodOptions().libs("foo");
assertEquals("foo", options.get("--libs"));
options = options.libs(Path.of("bar"));
assertEquals("bar", options.get("--libs"));
var foo = new File("foo");
options.libs(foo);
assertEquals(foo.getAbsolutePath(), options.get("--libs"));
var barPath = Path.of("bar");
options = options.libs(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--libs"));
var fooFile = new File("foo");
options.libs(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--libs"));
}
@Test
void testManPages() {
var options = new JmodOptions().manPages("foo");
assertEquals("foo", options.get("--man-pages"));
options = options.manPages(Path.of("bar"));
assertEquals("bar", options.get("--man-pages"));
var foo = new File("foo");
options.manPages(foo);
assertEquals(foo.getAbsolutePath(), options.get("--man-pages"));
var barPath = Path.of("bar");
options = options.manPages(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--man-pages"));
var fooFile = new File("foo");
options.manPages(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--man-pages"));
}
@Test
void testModulePath() {
var options = new JmodOptions().modulePath("foo");
assertEquals("foo", options.get("--module-path"));
options = options.modulePath(Path.of("bar"));
assertEquals("bar", options.get("--module-path"));
var foo = new File("foo");
options.modulePath(foo);
assertEquals(foo.getAbsolutePath(), options.get("--module-path"));
var barPath = Path.of("bar");
options = options.modulePath(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--module-path"));
var fooFile = new File("foo");
options.modulePath(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--module-path"));
}
@Test

View file

@ -33,32 +33,35 @@ public class TestJpackageOperation {
void testAddLauncher() {
var op = new JpackageOperation();
var foo = new Launcher("foo-name", "foo-path");
var bar = new Launcher("bar-name", Path.of("bar-path"));
assertEquals(bar.name(), "bar-name");
assertEquals(bar.path(), "bar-path");
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());
var f = new File("foo/bar");
var foobar = new Launcher("foobar", f);
assertEquals(foobar.name(), "foobar");
assertEquals(foobar.path(), f.getAbsolutePath());
var fooFile = new File("foo/bar");
var foobarLauncher = new Launcher("foobar", fooFile);
assertEquals("foobar", foobarLauncher.name());
assertEquals(fooFile.getAbsolutePath(), foobarLauncher.path());
op = op.addLauncher(foo);
assertTrue(op.launchers().contains(foo), "foo not found");
op.addLauncher(bar);
assertTrue(op.launchers().contains(bar), "bar not found");
op = op.addLauncher(fooLauncher);
assertTrue(op.launchers().contains(fooLauncher), "foo not found");
op.addLauncher(barLauncher);
assertTrue(op.launchers().contains(barLauncher), "bar not found");
}
@Test
void testAppImage() {
var options = new JpackageOptions().appImage("foo");
assertEquals("foo", options.get("--app-image"));
options.appImage(Path.of("bar"));
assertEquals("bar", options.get("--app-image"));
var foo = new File("foo");
options = options.appImage(foo);
assertEquals(foo.getAbsolutePath(), options.get("--app-image"));
var barPath = Path.of("bar");
options.appImage(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--app-image"));
var fooFile = new File("foo");
options = options.appImage(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--app-image"));
}
@Test
@ -260,12 +263,14 @@ public class TestJpackageOperation {
void testDest() {
var options = new JpackageOptions().dest("foo");
assertEquals("foo", options.get("--dest"));
options = options.dest(Path.of("bar"));
assertEquals("bar", options.get("--dest"));
var foo = new File("foo");
options.dest(foo);
assertEquals(foo.getAbsolutePath(), options.get("--dest"));
var barPath = Path.of("bar");
options = options.dest(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--dest"));
var fooFile = new File("foo");
options.dest(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--dest"));
}
@Test
@ -273,13 +278,16 @@ public class TestJpackageOperation {
var options = new JpackageOptions().fileAssociations("foo", "bar");
assertEquals("foo,bar", options.get("--file-associations"));
options = options.fileAssociations(Path.of("bar"), Path.of("foo"));
assertEquals("bar,foo", 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 foo = new File("foo");
var bar = new File("bar");
options.fileAssociations(foo, bar);
assertEquals(foo.getAbsolutePath() + ',' + bar.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"));
}
@Test
@ -293,12 +301,14 @@ public class TestJpackageOperation {
void testIcon() {
var options = new JpackageOptions().icon("foo");
assertEquals("foo", options.get("--icon"));
options = options.icon(Path.of("bar"));
assertEquals("bar", options.get("--icon"));
var foo = new File("foo");
options.icon(foo);
assertEquals(foo.getAbsolutePath(), options.get("--icon"));
var barPath = Path.of("bar");
options = options.icon(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--icon"));
var fooFile = new File("foo");
options.icon(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--icon"));
}
@Test
@ -307,36 +317,42 @@ public class TestJpackageOperation {
options.input("foo");
assertEquals("foo", options.get("--input"));
options.input(Path.of("bar"));
assertEquals("bar", options.get("--input"));
var foo = new File("foo");
options.input(foo);
assertEquals(foo.getAbsolutePath(), options.get("--input"));
var barPath = Path.of("bar");
options.input(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--input"));
var fooFile = new File("foo");
options.input(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--input"));
}
@Test
void testInstallDir() {
var options = new JpackageOptions().installDir("foo");
assertEquals("foo", options.get("--install-dir"));
options = options.installDir(Path.of("bar"));
assertEquals("bar", options.get("--install-dir"));
var foo = new File("foo");
options.installDir(foo);
assertEquals(foo.getAbsolutePath(), options.get("--install-dir"));
var barPath = Path.of("bar");
options = options.installDir(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--install-dir"));
var fooFile = new File("foo");
options.installDir(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--install-dir"));
}
@Test
void testLicenseFile() {
var options = new JpackageOptions().licenseFile("foo");
assertEquals("foo", options.get("--license-file"));
options = options.licenseFile(Path.of("bar"));
assertEquals("bar", options.get("--license-file"));
var foo = new File("foo");
options.licenseFile(foo);
assertEquals(foo.getAbsolutePath(), options.get("--license-file"));
var barPath = Path.of("bar");
options = options.licenseFile(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--license-file"));
var fooFile = new File("foo");
options.licenseFile(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--license-file"));
}
@Test
@ -344,25 +360,31 @@ public class TestJpackageOperation {
var options = new JpackageOptions().macDmgContent("foo", "bar");
assertEquals("foo,bar", options.get("--mac-dmg-content"));
options = options.macDmgContent(Path.of("bar"), Path.of("foo"));
assertEquals("bar,foo", options.get("--mac-dmg-content"));
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"));
options = options.macDmgContent(barPath, fooPath);
assertEquals(barPath.toFile().getAbsolutePath() + ',' + fooPath.toFile().getAbsolutePath(),
options.get("--mac-dmg-content"));
var fooFile = new File("foo");
var barFile = new File("bar");
options.macDmgContent(fooFile, barFile);
assertEquals(fooFile.getAbsolutePath() + ',' + barFile.getAbsolutePath(), options.get("--mac-dmg-content"));
}
@Test
void testMacEntitlements() {
var options = new JpackageOptions().macEntitlements("foo");
assertEquals("foo", options.get("--mac-entitlements"));
options = options.macEntitlements(Path.of("bar"));
assertEquals("bar", options.get("--mac-entitlements"));
var foo = new File("foo");
options.macEntitlements(foo);
assertEquals(foo.getAbsolutePath(), options.get("--mac-entitlements"));
var barPath = Path.of("bar");
options = options.macEntitlements(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--mac-entitlements"));
var fooFile = new File("foo");
options.macEntitlements(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--mac-entitlements"));
}
@Test
@ -378,12 +400,14 @@ public class TestJpackageOperation {
void testModulePath() {
var options = new JpackageOptions().modulePath("foo");
assertEquals("foo", options.get("--module-path"));
options = options.modulePath(Path.of("bar"));
assertEquals("bar", options.get("--module-path"));
var foo = new File("foo");
options.modulePath(foo);
assertEquals(foo.getAbsolutePath(), options.get("--module-path"));
var barPath = Path.of("bar");
options = options.modulePath(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--module-path"));
var fooFile = new File("foo");
options.modulePath(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--module-path"));
}
@Test
@ -398,36 +422,42 @@ public class TestJpackageOperation {
void testResourceDir() {
var options = new JpackageOptions().resourceDir("foo");
assertEquals("foo", options.get("--resource-dir"));
options = options.resourceDir(Path.of("bar"));
assertEquals("bar", options.get("--resource-dir"));
var foo = new File("foo");
options.resourceDir(foo);
assertEquals(foo.getAbsolutePath(), options.get("--resource-dir"));
var barPath = Path.of("bar");
options = options.resourceDir(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--resource-dir"));
var fooFile = new File("foo");
options.resourceDir(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--resource-dir"));
}
@Test
void testRuntimeImage() {
var options = new JpackageOptions().runtimeImage("foo");
assertEquals("foo", options.get("--runtime-image"));
options = options.runtimeImage(Path.of("bar"));
assertEquals("bar", options.get("--runtime-image"));
var foo = new File("foo");
options.runtimeImage(foo);
assertEquals(foo.getAbsolutePath(), options.get("--runtime-image"));
var barPath = Path.of("bar");
options = options.runtimeImage(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--runtime-image"));
var fooFile = new File("foo");
options.runtimeImage(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--runtime-image"));
}
@Test
void testTemp() {
var options = new JpackageOptions().temp("foo");
assertEquals("foo", options.get("--temp"));
options = options.temp(Path.of("bar"));
assertEquals("bar", options.get("--temp"));
var foo = new File("foo");
options.temp(foo);
assertEquals(foo.getAbsolutePath(), options.get("--temp"));
var barPath = Path.of("bar");
options = options.temp(barPath);
assertEquals(barPath.toFile().getAbsolutePath(), options.get("--temp"));
var fooFile = new File("foo");
options.temp(fooFile);
assertEquals(fooFile.getAbsolutePath(), options.get("--temp"));
}
@Test