Skip to content

Commit

Permalink
Merge pull request #47 from ethauvin/main
Browse files Browse the repository at this point in the history
Added JlinkOptions, JmodOptions and JpackageOptions File argument alt…
  • Loading branch information
gbevin authored Aug 26, 2024
2 parents 2b827a9 + 0b9581c commit 22add23
Show file tree
Hide file tree
Showing 10 changed files with 1,211 additions and 65 deletions.
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

0 comments on commit 22add23

Please sign in to comment.