Skip to content

Commit

Permalink
Merge pull request #36032 from geoand/GeneratedResourceBuildItem-field
Browse files Browse the repository at this point in the history
Rename field in GeneratedResourceBuildItem
  • Loading branch information
gsmet authored Sep 21, 2023
2 parents 5ac4f50 + c76362a commit 2956cf7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,39 @@

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;
}

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path, Set<TransformedClassesBuildItem.TransformedClass>> entry : buildResult
.consume(TransformedClassesBuildItem.class).getTransformedClassesByJar().entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -1192,10 +1192,10 @@ private void copyCommonContent(FileSystem runnerZipFs, Map<String, List<byte[]>>
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());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ private static Map<String, byte[]> extractGeneratedResources(BuildResult buildRe
if (i.isExcludeFromDevCL()) {
continue;
}
data.put(i.getName(), i.getClassData());
data.put(i.getName(), i.getData());
}
}
return data;
Expand Down

0 comments on commit 2956cf7

Please sign in to comment.