Skip to content

Commit

Permalink
add --enable-preview option
Browse files Browse the repository at this point in the history
  • Loading branch information
forax committed Oct 9, 2018
1 parent e2c8212 commit 6a4cd35
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Java {
private final List<Path> modulePath;
private final String moduleName;

private boolean enablePreview;
private List<Path> upgradeModulePath;
private List<String> rootModules;
private List<String> rawArguments;
Expand All @@ -31,6 +32,12 @@ public String moduleName() {
return moduleName;
}

public boolean enablePreview() {
return enablePreview;
}
public void enablePreview(boolean enablePreview) {
this.enablePreview = enablePreview;
}
public Optional<List<Path>> upgradeModulePath() {
return Optional.ofNullable(upgradeModulePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public interface RunnerConf {
Path javaCommand();
void javaCommand(Path javaCommand);

Optional<Boolean> enablePreview();
void enablePreview(boolean enablePreview);

List<Path> modulePath();
void modulePath(List<Path> modulePath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.github.forax.pro.api.MutableConfig.derive;
import static com.github.forax.pro.api.helper.OptionAction.action;
import static com.github.forax.pro.api.helper.OptionAction.actionMaybe;
import static com.github.forax.pro.api.helper.OptionAction.exists;
import static com.github.forax.pro.api.helper.OptionAction.rawValues;
import static java.util.stream.Collectors.joining;

Expand Down Expand Up @@ -62,6 +63,7 @@ enum RunnerOption {
MODULE_PATH(action("--module-path", Java::modulePath, File.pathSeparator)),
UPGRADE_MODULE_PATH(actionMaybe("--upgrade-module-path", Java::upgradeModulePath, File.pathSeparator)),
ROOT_MODULES(actionMaybe("--add-modules", Java::rootModules, ",")),
ENABLE_PREVIEW(exists("--enable-preview", Java::enablePreview)),
RAW_ARGUMENTS(rawValues(Java::rawArguments)),
MODULE_NAME(action("--module", Java::moduleName)),
MAIN_ARGUMENTS(rawValues(Java::mainArguments)),
Expand Down Expand Up @@ -112,6 +114,7 @@ public int execute(Config config) throws IOException {
var java = new Java(runnerConf.javaCommand(), runnerConf.modulePath(), moduleNameOpt.get());
runnerConf.upgradeModulePath().ifPresent(java::upgradeModulePath);
runnerConf.rootModules().ifPresent(java::rootModules);
runnerConf.enablePreview().ifPresent(java::enablePreview);
runnerConf.rawArguments().ifPresent(java::rawArguments);
runnerConf.mainArguments().ifPresent(java::mainArguments);

Expand Down

0 comments on commit 6a4cd35

Please sign in to comment.