Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JlinkOptions, JmodOptions and JpackageOptions File argument alt… #47

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion src/main/java/rife/bld/operations/JlinkOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
*/
package rife.bld.operations;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

Expand All @@ -23,7 +26,6 @@ public JlinkOperation() {
super("jlink");
}


/**
* Read options and/or mode from file(s).
*
Expand All @@ -35,6 +37,28 @@ public JlinkOperation cmdFiles(String... file) {
return this;
}

/**
* Read options and/or mode from file(s).
*
* @param file one or more file
* @return this operation instance
*/
public JlinkOperation cmdFiles(File... file) {
cmdFiles_.addAll(Arrays.stream(file).map(File::getAbsolutePath).toList());
return this;
}

/**
* Read options and/or mode from file(s).
*
* @param file one or more file
* @return this operation instance
*/
public JlinkOperation cmdFiles(Path... file) {
cmdFiles_.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
return this;
}

/**
* Retrieves the list of files containing options or mode.
*
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/rife/bld/operations/JlinkOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package rife.bld.operations;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -161,6 +163,34 @@ public JlinkOptions modulePath(String path) {
return this;
}

/**
* Module path.
* <p>
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
* java.base module, the JDKs jmods directory will be added, if it exists.
*
* @param path the module path
* @return this map of options
*/
public JlinkOptions modulePath(File path) {
put("--module-path", path.getAbsolutePath());
return this;
}

/**
* Module path.
* <p>
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
* java.base module, the JDKs jmods directory will be added, if it exists.
*
* @param path the module path
* @return this map of options
*/
public JlinkOptions modulePath(Path path) {
put("--module-path", path.toFile().getAbsolutePath());
return this;
}

/**
* Exclude include header files.
*
Expand Down Expand Up @@ -202,6 +232,28 @@ public JlinkOptions output(String path) {
return this;
}

/**
* Location of output path.
*
* @param path the output path
* @return this map of options
*/
public JlinkOptions output(File path) {
put("--output", path.getAbsolutePath());
return this;
}

/**
* Location of output path.
*
* @param path the output path
* @return this map of options
*/
public JlinkOptions output(Path path) {
put("--output", path.toFile().getAbsolutePath());
return this;
}

/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
Expand Down
51 changes: 51 additions & 0 deletions src/main/java/rife/bld/operations/JmodOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
*/
package rife.bld.operations;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -44,6 +47,28 @@ public JmodOperation cmdFiles(String... file) {
return this;
}

/**
* Read options and/or mode from file(s).
*
* @param file one or more file
* @return this operation instance
*/
public JmodOperation cmdFiles(File... file) {
cmdFiles.addAll(Arrays.stream(file).map(File::getAbsolutePath).toList());
return this;
}

/**
* Read options and/or mode from file(s).
*
* @param file one or more file
* @return this operation instance
*/
public JmodOperation cmdFiles(Path... file) {
cmdFiles.addAll(Arrays.stream(file).map(Path::toFile).map(File::getAbsolutePath).toList());
return this;
}

@Override
public void execute() throws Exception {
if (operationMode_ != null) {
Expand Down Expand Up @@ -82,6 +107,32 @@ public JmodOperation jmodFile(String file) {
return this;
}

/**
* Specifies name of the JMOD file to create or from which to retrieve information.
* <p>
* The JMOD file is <b>required</b>.
*
* @param file the JMOD file
* @return this operation instance
*/
public JmodOperation jmodFile(File file) {
jmodFile_ = file.getAbsolutePath();
return this;
}

/**
* Specifies name of the JMOD file to create or from which to retrieve information.
* <p>
* The JMOD file is <b>required</b>.
*
* @param file the JMOD file
* @return this operation instance
*/
public JmodOperation jmodFile(Path file) {
jmodFile_ = file.toFile().getAbsolutePath();
return this;
}

/**
* Retrieves the list of options for the jmod tool.
* <p>
Expand Down
Loading
Loading