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

adding include-locales flag #214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -57,11 +57,13 @@ public class CreateRuntimeImage {
private final List<String> excludeResourcesPatterns;
private final boolean bindServices;

private final String includeLocale;

public CreateRuntimeImage(Set<Path> modulePath, List<String> modules, JarInclusionPolicy jarInclusionPolicy,
Set<Path> dependencies, Path projectJar, String launcherName, String launcherModule,
Path outputDirectory, Integer compression, boolean stripDebug,
boolean ignoreSigningInformation, List<String> excludeResourcesPatterns, Log log,
boolean noHeaderFiles, boolean noManPages, boolean bindServices) {
boolean noHeaderFiles, boolean noManPages, boolean bindServices, String includeLocale) {
this.modulePath = (modulePath != null ? modulePath : Collections.emptySet());
this.modules = getModules(modules);
this.jarInclusionPolicy = jarInclusionPolicy;
Expand All @@ -77,6 +79,7 @@ public CreateRuntimeImage(Set<Path> modulePath, List<String> modules, JarInclusi
this.noHeaderFiles = noHeaderFiles;
this.noManPages = noManPages;
this.bindServices = bindServices;
this.includeLocale = includeLocale;
}

private static List<String> getModules(List<String> modules) {
Expand Down Expand Up @@ -202,6 +205,11 @@ private void runJlink() throws AssertionError {
command.add("--bind-services");
}

if(!includeLocale.isEmpty()) {
command.add("--include-locales");
command.add(includeLocale);
}

log.debug("Running jlink: " + String.join(" ", command));

ProcessExecutor.run("jlink", command, log);
Expand Down
Expand Up @@ -108,6 +108,9 @@ public class CreateRuntimeImageMojo extends AbstractMojo {
@Parameter(defaultValue = "false")
private boolean bindServices;

@Parameter(property = "includeLocales", defaultValue = "en")
private String includeLocales;

@Override
public void execute() throws MojoExecutionException {
Path jmodsDir = getJModsDir();
Expand All @@ -134,7 +137,8 @@ public void execute() throws MojoExecutionException {
new MojoLog(getLog()),
noHeaderFiles,
noManPages,
bindServices);
bindServices,
includeLocales);
try {
createRuntimeImage.run();
}
Expand Down