From 367fa644962bbaba0e6fab51d5465ed1b2acfdfb Mon Sep 17 00:00:00 2001 From: Petar Dekanovic Date: Sun, 16 Jun 2024 10:01:30 +0200 Subject: [PATCH] Outline the check for collecting embedded resources information. --- .../src/com/oracle/svm/hosted/EmbeddedResourcesInfo.java | 2 +- .../src/com/oracle/svm/hosted/ResourcesFeature.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/EmbeddedResourcesInfo.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/EmbeddedResourcesInfo.java index 3e2078fafc0c..4dd8ddadccdf 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/EmbeddedResourcesInfo.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/EmbeddedResourcesInfo.java @@ -48,7 +48,7 @@ public static EmbeddedResourcesInfo singleton() { } public void declareResourceAsRegistered(Module module, String resource, String source) { - if (!ResourcesFeature.Options.GenerateEmbeddedResourcesFile.getValue()) { + if (!ImageSingletons.lookup(ResourcesFeature.class).collectEmbeddedResourcesInfo()) { return; } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ResourcesFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ResourcesFeature.java index 43def391c34b..5759eb2c8605 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ResourcesFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ResourcesFeature.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package com.oracle.svm.hosted; import static com.oracle.svm.core.jdk.Resources.RESOURCES_INTERNAL_PATH_SEPARATOR; @@ -141,7 +140,7 @@ * @see NativeImageResourceFileAttributesView */ @AutomaticallyRegisteredFeature -public final class ResourcesFeature implements InternalFeature { +public class ResourcesFeature implements InternalFeature { static final String MODULE_NAME_ALL_UNNAMED = "ALL-UNNAMED"; @@ -389,6 +388,10 @@ private static ResourcesRegistryImpl resourceRegistryImpl() { return (ResourcesRegistryImpl) ImageSingletons.lookup(ResourcesRegistry.class); } + protected boolean collectEmbeddedResourcesInfo() { + return Options.GenerateEmbeddedResourcesFile.getValue(); + } + @Override public void beforeAnalysis(BeforeAnalysisAccess access) { /* load and parse resource configuration files */