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

No longer force uber-jar when building native images on Windows #26289

Merged
merged 1 commit into from
Jun 28, 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 @@ -49,7 +49,6 @@
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;

import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;

import io.quarkus.bootstrap.model.MutableJarApplicationModel;
Expand Down Expand Up @@ -929,10 +928,7 @@ public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem
List<GeneratedNativeImageClassBuildItem> nativeImageResources,
List<GeneratedResourceBuildItem> generatedResources,
MainClassBuildItem mainClassBuildItem,
List<UberJarRequiredBuildItem> uberJarRequired,
List<UberJarMergedResourceBuildItem> mergeResources,
ClassLoadingConfig classLoadingConfig,
List<UberJarIgnoredResourceBuildItem> ignoreResources) throws Exception {
ClassLoadingConfig classLoadingConfig) throws Exception {
Path targetDirectory = outputTargetBuildItem.getOutputDirectory()
.resolve(outputTargetBuildItem.getBaseName() + "-native-image-source-jar");
IoUtils.createOrEmptyDir(targetDirectory);
Expand All @@ -942,28 +938,10 @@ public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem
.map((s) -> new GeneratedClassBuildItem(true, s.getName(), s.getClassData()))
.collect(Collectors.toList()));

if (SystemUtils.IS_OS_WINDOWS) {
log.warn("Uber JAR strategy is used for native image source JAR generation on Windows. This is done " +
"for the time being to work around a current GraalVM limitation on Windows concerning the " +
"maximum command length (see https://github.com/oracle/graal/issues/2387).");
// Native image source jar generation with the uber jar strategy is provided as a workaround for Windows and
// will be removed once https://github.com/oracle/graal/issues/2387 is fixed.
final NativeImageSourceJarBuildItem nativeImageSourceJarBuildItem = buildNativeImageUberJar(curateOutcomeBuildItem,
outputTargetBuildItem, transformedClasses,
applicationArchivesBuildItem,
packageConfig, applicationInfo, allClasses, generatedResources, mergeResources,
ignoreResources, mainClassBuildItem,
targetDirectory, classLoadingConfig);
// additionally copy any json config files to a location accessible by native-image tool during
// native-image generation
copyJsonConfigFiles(applicationArchivesBuildItem, targetDirectory);
return nativeImageSourceJarBuildItem;
} else {
return buildNativeImageThinJar(curateOutcomeBuildItem, outputTargetBuildItem, transformedClasses,
applicationArchivesBuildItem,
applicationInfo, packageConfig, allClasses, generatedResources, mainClassBuildItem, targetDirectory,
classLoadingConfig);
}
return buildNativeImageThinJar(curateOutcomeBuildItem, outputTargetBuildItem, transformedClasses,
applicationArchivesBuildItem,
applicationInfo, packageConfig, allClasses, generatedResources, mainClassBuildItem, targetDirectory,
classLoadingConfig);
}

private NativeImageSourceJarBuildItem buildNativeImageThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
Expand Down Expand Up @@ -996,40 +974,6 @@ private NativeImageSourceJarBuildItem buildNativeImageThinJar(CurateOutcomeBuild
return new NativeImageSourceJarBuildItem(runnerJar, libDir);
}

private NativeImageSourceJarBuildItem buildNativeImageUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
OutputTargetBuildItem outputTargetBuildItem,
TransformedClassesBuildItem transformedClasses,
ApplicationArchivesBuildItem applicationArchivesBuildItem,
PackageConfig packageConfig,
ApplicationInfoBuildItem applicationInfo,
List<GeneratedClassBuildItem> generatedClasses,
List<GeneratedResourceBuildItem> generatedResources,
List<UberJarMergedResourceBuildItem> mergeResources,
List<UberJarIgnoredResourceBuildItem> ignoreResources,
MainClassBuildItem mainClassBuildItem,
Path targetDirectory,
ClassLoadingConfig classLoadingConfig) throws Exception {
//we use the -runner jar name, unless we are building both types
Path runnerJar = targetDirectory
.resolve(outputTargetBuildItem.getBaseName() + packageConfig.runnerSuffix + ".jar");

buildUberJar0(curateOutcomeBuildItem,
outputTargetBuildItem,
transformedClasses,
applicationArchivesBuildItem,
packageConfig,
applicationInfo,
generatedClasses,
generatedResources,
mergeResources,
ignoreResources,
mainClassBuildItem,
classLoadingConfig,
runnerJar);

return new NativeImageSourceJarBuildItem(runnerJar, null);
}

/**
* This is done in order to make application specific native image configuration files available to the native-image tool
* without the user needing to know any specific paths.
Expand Down