Skip to content

Commit

Permalink
Change decompiler from quiltflower to vineflower
Browse files Browse the repository at this point in the history
  • Loading branch information
manofthepeace committed Aug 29, 2023
1 parent 1347a17 commit aa7425b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ public static BuiltInType fromString(String value) {
public boolean includeDependencyList;

/**
* Quiltflower Decompiler configuration
* Vineflower Decompiler configuration
*/
@ConfigItem
public QuiltFlowerConfig quiltflower;
public VineFlowerConfig vineflower;

/**
* If set to {@code true}, it will result in the Quarkus writing the transformed application bytecode
Expand Down Expand Up @@ -302,7 +302,7 @@ public String getRunnerSuffix() {
}

@ConfigGroup
public static class QuiltFlowerConfig {
public static class VineFlowerConfig {
/**
* An advanced option that will decompile generated and transformed bytecode into the 'decompiled' directory.
* This is only taken into account when fast-jar is used.
Expand All @@ -311,13 +311,13 @@ public static class QuiltFlowerConfig {
public boolean enabled;

/**
* The version of Quiltflower to use
* The version of Vineflower to use
*/
@ConfigItem(defaultValue = "1.8.1")
@ConfigItem(defaultValue = "1.9.2")
public String version;

/**
* The directory into which to save the Quiltflower tool if it doesn't exist
* The directory into which to save the Vineflower tool if it doesn't exist
*/
@ConfigItem(defaultValue = "${user.home}/.quarkus")
public String jarDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,17 +603,17 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
Path decompiledOutputDir = null;
boolean wasDecompiledSuccessfully = true;
Decompiler decompiler = null;
if (packageConfig.quiltflower.enabled) {
if (packageConfig.vineflower.enabled) {
decompiledOutputDir = buildDir.getParent().resolve("decompiled");
FileUtil.deleteDirectory(decompiledOutputDir);
Files.createDirectory(decompiledOutputDir);
if (packageConfig.quiltflower.enabled) {
decompiler = new Decompiler.QuiltflowerDecompiler();
Path jarDirectory = Paths.get(packageConfig.quiltflower.jarDirectory);
if (packageConfig.vineflower.enabled) {
decompiler = new Decompiler.VineflowerDecompiler();
Path jarDirectory = Paths.get(packageConfig.vineflower.jarDirectory);
if (!Files.exists(jarDirectory)) {
Files.createDirectory(jarDirectory);
}
decompiler.init(new Decompiler.Context(packageConfig.quiltflower.version, jarDirectory, decompiledOutputDir));
decompiler.init(new Decompiler.Context(packageConfig.vineflower.version, jarDirectory, decompiledOutputDir));
decompiler.downloadIfNecessary();
}
}
Expand Down Expand Up @@ -1572,15 +1572,15 @@ public Context(String versionStr, Path jarLocation, Path decompiledOutputDir) {

}

class QuiltflowerDecompiler implements Decompiler {
class VineflowerDecompiler implements Decompiler {

private Context context;
private Path decompilerJar;

@Override
public void init(Context context) {
this.context = context;
this.decompilerJar = context.jarLocation.resolve(String.format("quiltflower-%s.jar", context.versionStr));
this.decompilerJar = context.jarLocation.resolve(String.format("vineflower-%s.jar", context.versionStr));
}

@Override
Expand All @@ -1589,7 +1589,7 @@ public boolean downloadIfNecessary() {
return true;
}
String downloadURL = String.format(
"https://github.com/QuiltMC/quiltflower/releases/download/%s/quiltflower-%s.jar",
"https://repo.maven.apache.org/maven2/org/vineflower/vineflower/%s/vineflower-%s.jar",
context.versionStr, context.versionStr);
try (BufferedInputStream in = new BufferedInputStream(new URL(downloadURL).openStream());
FileOutputStream fileOutputStream = new FileOutputStream(decompilerJar.toFile())) {
Expand All @@ -1600,7 +1600,7 @@ public boolean downloadIfNecessary() {
}
return true;
} catch (IOException e) {
log.error("Unable to download Quiltflower from " + downloadURL, e);
log.error("Unable to download Vineflower from " + downloadURL, e);
return false;
}
}
Expand Down Expand Up @@ -1633,7 +1633,7 @@ public boolean decompile(Path jarToDecompile) {
}

if (exitCode != 0) {
log.errorf("Quiltflower decompiler exited with error code: %d.", exitCode);
log.errorf("Vineflower decompiler exited with error code: %d.", exitCode);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion docs/.vale/fixtures/Quarkus/Headings/testvalid.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
== Proof Key for Code Exchange
== Kogito updates
== IBM Cloud is a valid product name
== Spotify, GraphQL, and Quiltflower are proper nouns so uppercase in headings is OK.
== Spotify, GraphQL, and Vineflower are proper nouns so uppercase in headings is OK.
== Use xDS gRPC
== Use JBoss Logging for application logging
== JBoss Logging API
Expand Down
2 changes: 1 addition & 1 deletion docs/.vale/fixtures/Quarkus/Spelling/testvalid.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ Pytorch
qeth
Quarkiverse
Quarkus
Quiltflower
Qute
Readonly
Rebalance
Expand Down Expand Up @@ -376,6 +375,7 @@ Valgrind
validator
Velero
Vert.x
Vineflower
vsix
WebAuthn
WebSocket
Expand Down
2 changes: 1 addition & 1 deletion docs/.vale/styles/Quarkus/Headings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ exceptions:
- Qt
- Quarkiverse
- Quarkus
- Quiltflower
- Qute
- RESTEasy
- Red Hat
Expand Down Expand Up @@ -233,6 +232,7 @@ exceptions:
- Valgrind
- Velero
- Vert.x
- Vineflower
- WebAuthn
- WebSocket
- Webview
Expand Down
2 changes: 1 addition & 1 deletion docs/.vale/styles/Quarkus/Spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ filters:
- QLogic
- Quarkiverse
- Quarkus
- Quiltflower
- Qute
- Realtime
- Redis
Expand Down Expand Up @@ -425,6 +424,7 @@ filters:
- Velero
- Vert.x
- vHost
- Vineflower
- VMs
- VMware
- vsix
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ The only particular aspect of writing Quarkus extensions in Eclipse is that APT
Quarkus generates a lot of classes during the build phase and in many cases also transforms existing classes.
It is often extremely useful to see the generated bytecode and transformed classes during the development of an extension.

If you set the `quarkus.package.quiltflower.enabled` property to `true` then Quarkus will download and invoke the https://github.com/QuiltMC/quiltflower[Quiltflower decompiler] and dump the result in the `decompiled` directory of the build tool output (`target/decompiled` for Maven for example).
If you set the `quarkus.package.vineflower.enabled` property to `true` then Quarkus will download and invoke the https://github.com/Vineflower/vineflower[Vineflower decompiler] and dump the result in the `decompiled` directory of the build tool output (`target/decompiled` for Maven for example).

NOTE: This property only works during a normal production build (i.e. not for dev mode/tests) and when `fast-jar` packaging type is used (the default behavior).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.statistics=true
quarkus.hibernate-orm.metrics.enabled=true

quarkus.package.quiltflower.enabled=true
quarkus.package.vineflower.enabled=true
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ mp.messaging.incoming.countries-t2-in.connector=smallrye-kafka
mp.messaging.incoming.countries-t2-in.topic=countries-t2
mp.messaging.incoming.countries-t2-in.auto.offset.reset=earliest

quarkus.package.quiltflower.enabled=true
quarkus.package.vineflower.enabled=true

test.prop=test

0 comments on commit aa7425b

Please sign in to comment.