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

Rename field in GeneratedResourceBuildItem #36032

Merged
merged 1 commit into from
Sep 21, 2023
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 @@ -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