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

Add properties to quarkusDev task to set add-module clause and open Java lang module #28410

Merged
merged 1 commit into from
Oct 6, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public class QuarkusDev extends QuarkusTask {
private final Property<Boolean> shouldPropagateJavaCompilerArgs;
private final ListProperty<String> args;
private final ListProperty<String> jvmArgs;

private final Property<Boolean> openJavaLang;
private final ListProperty<String> modules;
private final ListProperty<String> compilerArgs;

private final Set<File> filesIncludedInClasspath = new HashSet<>();
Expand Down Expand Up @@ -120,6 +123,9 @@ public QuarkusDev(
args = objectFactory.listProperty(String.class);
compilerArgs = objectFactory.listProperty(String.class);
jvmArgs = objectFactory.listProperty(String.class);
openJavaLang = objectFactory.property(Boolean.class);
openJavaLang.convention(false);
modules = objectFactory.listProperty(String.class);
}

/**
Expand Down Expand Up @@ -219,6 +225,26 @@ public ListProperty<String> getArguments() {
return args;
}

@Option(description = "Modules to add to the application", option = "modules")
public void setModules(List<String> modules) {
this.modules.set(modules);
}

@Input
public ListProperty<String> getModules() {
return modules;
}

@Option(description = "Open Java Lang module", option = "open-lang-package")
public void setOpenJavaLang(Boolean openJavaLang) {
this.openJavaLang.set(openJavaLang);
}

@Input
public Property<Boolean> getOpenJavaLang() {
return openJavaLang;
}

@SuppressWarnings("unused")
@Internal
public List<String> getArgs() {
Expand Down Expand Up @@ -355,6 +381,17 @@ private QuarkusDevModeLauncher newLauncher() throws Exception {
builder.jvmArgs(getJvmArgs());
}

if (getOpenJavaLang().isPresent() && getOpenJavaLang().get()) {
builder.jvmArgs("--add-opens");
builder.jvmArgs("java.base/java.lang=ALL-UNNAMED");
}

if (getModules().isPresent() && !getModules().get().isEmpty()) {
String mods = String.join(",", getModules().get());
builder.jvmArgs("--add-modules");
builder.jvmArgs(mods);
}

for (Map.Entry<String, ?> e : project.getProperties().entrySet()) {
if (e.getValue() instanceof String) {
builder.buildSystemProperty(e.getKey(), e.getValue().toString());
Expand Down