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

Fix resource registration for native compilation #40184

Merged
Merged
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 @@ -7,7 +7,11 @@
import io.quarkus.builder.item.MultiBuildItem;

/**
* A build item that indicates that a static resource should be included in the native image
* A build item that indicates that a static resource should be included in the native image.
* <p>
* A static resource is a file that is not processed by the build steps, but is included in the native image as-is.
mkouba marked this conversation as resolved.
Show resolved Hide resolved
* The resource path passed to the constructor is a {@code /}-separated path name (with the same semantics as the parameters
* passed to {@link java.lang.ClassLoader#getResources(String)}.
* <p>
* Related build items:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.regex.Pattern;

import io.quarkus.builder.Json;
import io.quarkus.builder.Json.JsonArrayBuilder;
Expand All @@ -16,7 +17,6 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.util.GlobUtil;

public class NativeImageResourceConfigStep {

Expand All @@ -35,14 +35,13 @@ void generateResourceConfig(BuildProducer<GeneratedResourceBuildItem> resourceCo
for (NativeImageResourceBuildItem i : resources) {
for (String path : i.getResources()) {
JsonObjectBuilder pat = Json.object();
pat.put("pattern", GlobUtil.toRegexPattern(path));
pat.put("pattern", Pattern.quote(path));
includes.add(pat);
}
addListToJsonArray(includes, i.getResources());
}

for (ServiceProviderBuildItem i : serviceProviderBuildItems) {
includes.add(Json.object().put("pattern", GlobUtil.toRegexPattern(i.serviceDescriptorFile())));
includes.add(Json.object().put("pattern", Pattern.quote(i.serviceDescriptorFile())));
}

for (NativeImageResourcePatternsBuildItem resourcePatternsItem : resourcePatterns) {
Expand Down
Loading