From c76362abbbfcf23cb6e1466ea30be5ec1eb102a5 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 20 Sep 2023 13:09:48 +0300 Subject: [PATCH] Rename field in GeneratedResourceBuildItem The original name is legacy from when the build item was used only for class data. This is no longer the case --- .../builditem/GeneratedResourceBuildItem.java | 20 +++++++++++++------ .../deployment/jbang/JBangAugmentorImpl.java | 2 +- .../pkg/steps/JarResultBuildStep.java | 6 +++--- .../runner/bootstrap/StartupActionImpl.java | 2 +- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedResourceBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedResourceBuildItem.java index d9148560cfdaa..8cdfd9bd8526b 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedResourceBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedResourceBuildItem.java @@ -4,22 +4,22 @@ public final class GeneratedResourceBuildItem extends MultiBuildItem { final String name; - final byte[] classData; + final byte[] data; // This option is only meant to be set by extensions that also generated the resource on the file system // and must rely on Quarkus not getting in the way of loading that resource. // It is currently used by Kogito to get serving of static resources in Dev Mode by Vert.x final boolean excludeFromDevCL; - public GeneratedResourceBuildItem(String name, byte[] classData) { + public GeneratedResourceBuildItem(String name, byte[] data) { this.name = name; - this.classData = classData; + this.data = data; this.excludeFromDevCL = false; } - public GeneratedResourceBuildItem(String name, byte[] classData, boolean excludeFromDevCL) { + public GeneratedResourceBuildItem(String name, byte[] data, boolean excludeFromDevCL) { this.name = name; - this.classData = classData; + this.data = data; this.excludeFromDevCL = excludeFromDevCL; } @@ -27,8 +27,16 @@ public String getName() { return name; } + public byte[] getData() { + return data; + } + + /** + * @deprecated use {@link GeneratedResourceBuildItem#getData} instead + */ + @Deprecated(forRemoval = true) public byte[] getClassData() { - return classData; + return getData(); } public boolean isExcludeFromDevCL() { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java index 946699643f592..ed9c482e829c1 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java @@ -111,7 +111,7 @@ public void accept(BuildChainBuilder builder) { result.put(i.getName().replace(".", "/") + ".class", i.getClassData()); } for (GeneratedResourceBuildItem i : buildResult.consumeMulti(GeneratedResourceBuildItem.class)) { - result.put(i.getName(), i.getClassData()); + result.put(i.getName(), i.getData()); } for (Map.Entry> entry : buildResult .consume(TransformedClassesBuildItem.class).getTransformedClassesByJar().entrySet()) { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index 8695a9f052b7e..06dc22675293c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -661,7 +661,7 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, if (target.getParent() != null) { Files.createDirectories(target.getParent()); } - Files.write(target, i.getClassData()); + Files.write(target, i.getData()); } } if (decompiler != null) { @@ -1192,10 +1192,10 @@ private void copyCommonContent(FileSystem runnerZipFs, Map> continue; } if (i.getName().startsWith("META-INF/services/")) { - concatenatedEntries.computeIfAbsent(i.getName(), (u) -> new ArrayList<>()).add(i.getClassData()); + concatenatedEntries.computeIfAbsent(i.getName(), (u) -> new ArrayList<>()).add(i.getData()); } else { try (final OutputStream os = wrapForJDK8232879(Files.newOutputStream(target))) { - os.write(i.getClassData()); + os.write(i.getData()); } } } diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java index f8268e10d5b2a..b67e9d4b1852f 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java @@ -409,7 +409,7 @@ private static Map extractGeneratedResources(BuildResult buildRe if (i.isExcludeFromDevCL()) { continue; } - data.put(i.getName(), i.getClassData()); + data.put(i.getName(), i.getData()); } } return data;