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 flat to skip configuration files inside jars #3149

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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 @@ -96,6 +96,9 @@ public static final class Options {

@Option(help = "Comma-separated list of file names with declarative substitutions", type = OptionType.User)//
public static final HostedOptionKey<String[]> SubstitutionFiles = new HostedOptionKey<>(null);

@Option(help = "Skip processing configuration files", type = OptionType.Expert)
public static final HostedOptionKey<Boolean> SkipConfigurationFiles = new HostedOptionKey<>(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HostedOptions are only used for option processing in the image-builder and not the driver executable. If you want some driver specific option you have to add to com.oracle.svm.driver.DefaultOptionHandler#consume.

Also what is the usecase of this option? cc @christianwimmer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HostedOptions are only used for option processing in the image-builder and not the driver executable. If you want some driver specific option you have to add to com.oracle.svm.driver.DefaultOptionHandler#consume.

+1

Also what is the usecase of this option? cc @christianwimmer

Spelled out in linked issue #2535

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this patch is a all-or-nothing approach and does not allow to exclude native image properties processing on a finer granular scale as suggested in #2535 (comment)
Instead there could be an option that takes a regex and uses that to decide if a given native image properties resource location should be excluded or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am OK to add this as an non-API option, but then one needs to be able to specify the jars that are ignored. I don't believe there is much general value if one skips all jars on the classpath.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that skipping all configuration files is not really useful. It does not solve the "compositing" problem.

According to quarkusio/quarkus#1658 (comment) the reason for this PR is the Oracle JDBC driver containing --initialize-at-run-time=oracle.jdbc.OracleDriver,java.sql.DriverManager. Since class initialization at run time is now the default, it should not be necessary at all.

Copy link
Contributor Author

@galderz galderz Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @christianwimmer @vjovanov @olpaw for the feedback. I've started a discussion thread in the GraalVM slack channel, where we can hash out an improved solution.

}

public static List<Path> findConfigurationFiles(String fileName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ private static <T> String oR(OptionKey<T> option) {
final String oHJNIConfigurationFiles = oH(ConfigurationFiles.Options.JNIConfigurationFiles);
final String oHSerializationConfigurationFiles = oH(ConfigurationFiles.Options.SerializationConfigurationFiles);
final String oHSerializationDenyConfigurationFiles = oH(ConfigurationFiles.Options.SerializationDenyConfigurationFiles);
final String oHSkipConfigurationFilesFlag = oH + "+" + ConfigurationFiles.Options.SkipConfigurationFiles.getName();

final String oHInspectServerContentPath = oH(PointstoOptions.InspectServerContentPath);
final String oHDeadlockWatchdogInterval = oH(SubstrateOptions.DeadlockWatchdogInterval);
Expand Down Expand Up @@ -928,7 +929,8 @@ private void processClasspathNativeImageMetaInf(Path classpathEntry, NativeImage
}

private void processNativeImageMetaInf(Path classpathEntry, Path nativeImageMetaInfBase, NativeImageMetaInfResourceProcessor metaInfProcessor) throws IOException {
if (Files.isDirectory(nativeImageMetaInfBase)) {
boolean skipConfigurationFiles = config.getBuildArgs().contains(oHSkipConfigurationFilesFlag);
if (!skipConfigurationFiles && Files.isDirectory(nativeImageMetaInfBase)) {
for (MetaInfFileType fileType : MetaInfFileType.values()) {
List<Path> nativeImageMetaInfFiles = Files.walk(nativeImageMetaInfBase)
.filter(p -> p.endsWith(fileType.fileName))
Expand Down