Skip to content

Commit

Permalink
adding include-locales flag
Browse files Browse the repository at this point in the history
  • Loading branch information
denismakogon committed Oct 13, 2023
1 parent d84c377 commit 81a2a1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 81a2a1b

Please sign in to comment.