diff --git a/.github/workflows/generate-diff.yml b/.github/workflows/generate-diff.yml index 65ba01d38e..75c8ac12bf 100644 --- a/.github/workflows/generate-diff.yml +++ b/.github/workflows/generate-diff.yml @@ -17,7 +17,7 @@ jobs: java-version: ${{ matrix.java }} distribution: temurin - uses: gradle/wrapper-validation-action@v1 - - run: ./gradlew decompileQuiltflower decompileTargetQuiltflower --stacktrace + - run: ./gradlew decompileVineflower decompileTargetVineflower --stacktrace if: ${{ matrix.java == 17 }} - name: Check Target Decompiled id: can-create-diff diff --git a/README.md b/README.md index c2576e86d7..9742ac021e 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Build a GZip'd archive containing a tiny mapping between official (obfuscated), ### `mapNamedJar` Builds a deobfuscated jar with Quilt mappings and automapped fields (enums, etc.). Unmapped names will be filled with [hashed-mojmap](https://github.com/QuiltMC/mappings-hasher) names. -### `decompileQuiltflower` +### `decompileVineflower` Decompile the mapped source code. **Note:** This is not designed to be recompiled. ### `downloadMinecraftJars` diff --git a/build.gradle b/build.gradle index 829b9641d1..fd7a828da6 100644 --- a/build.gradle +++ b/build.gradle @@ -61,6 +61,10 @@ repositories { name "Quilt Snapshot Repository" url "https://maven.quiltmc.org/repository/snapshot" } + maven { + // Vineflower snapshots + url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + } mavenLocal() } @@ -245,7 +249,7 @@ def fakeSourceDir = file(".gradle/temp/fakeSource") task genFakeSource(type: DecompileTask, dependsOn: [mergeTinyV2, eraseBytecode]) { input = eraseBytecode.output.asFile.get() output = fakeSourceDir - decompiler = Decompilers.QUILTFLOWER + decompiler = Decompilers.VINEFLOWER libraries = files(mappings.fileConstants.libraries) decompilerOptions = [ "rsy": "1", // remove synthetics @@ -280,10 +284,10 @@ task decompileCFR(type: DecompileTask, dependsOn: [mapNamedJar]) { } } -task decompileQuiltflower(type: DecompileTask, dependsOn: [mapNamedJar]) { +task decompileVineflower(type: DecompileTask, dependsOn: [mapNamedJar]) { input.set mappings.fileConstants.namedJar output.set file("namedSrc") - decompiler = Decompilers.QUILTFLOWER + decompiler = Decompilers.VINEFLOWER libraries = configurations.decompileClasspath doFirst { @@ -320,10 +324,10 @@ task unpickTargetJar(type: UnpickJarTask) { } } -task decompileTargetQuiltflower(type: DecompileTask, dependsOn: [remapTargetMinecraftJar]) { +task decompileTargetVineflower(type: DecompileTask, dependsOn: [remapTargetMinecraftJar]) { input.set remapTargetMinecraftJar.outputJar output.set file("namedTargetSrc") - decompiler = Decompilers.QUILTFLOWER + decompiler = Decompilers.VINEFLOWER libraries = configurations.decompileClasspath doFirst { diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 8fa2589bf1..3df8204969 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -21,6 +21,10 @@ repositories { name "Mojang" url 'https://libraries.minecraft.net/' } + maven { + // Vineflower snapshots + url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + } mavenLocal() } @@ -44,7 +48,7 @@ dependencies { // Decompilers implementation(libs.cfr) - implementation(libs.quiltflower) + implementation(libs.vineflower) // Testing testImplementation(libs.junit) diff --git a/buildSrc/src/main/java/quilt/internal/decompile/Decompilers.java b/buildSrc/src/main/java/quilt/internal/decompile/Decompilers.java index 4079684484..ad782b34b3 100644 --- a/buildSrc/src/main/java/quilt/internal/decompile/Decompilers.java +++ b/buildSrc/src/main/java/quilt/internal/decompile/Decompilers.java @@ -1,11 +1,11 @@ package quilt.internal.decompile; import quilt.internal.decompile.cfr.CfrDecompiler; -import quilt.internal.decompile.quiltflower.QuiltflowerDecompiler; +import quilt.internal.decompile.vineflower.VineflowerDecompiler; public enum Decompilers { CFR(CfrDecompiler::new), - QUILTFLOWER(QuiltflowerDecompiler::new); + VINEFLOWER(VineflowerDecompiler::new); private final DecompilerProvider provider; diff --git a/buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerDecompiler.java b/buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerDecompiler.java similarity index 68% rename from buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerDecompiler.java rename to buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerDecompiler.java index 59c3b63263..2c9af5502d 100644 --- a/buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerDecompiler.java +++ b/buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerDecompiler.java @@ -1,10 +1,9 @@ -package quilt.internal.decompile.quiltflower; +package quilt.internal.decompile.vineflower; import net.fabricmc.fernflower.api.IFabricJavadocProvider; import org.gradle.api.Project; import org.gradle.api.logging.LogLevel; import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler; -import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider; import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.main.extern.IResultSaver; @@ -14,23 +13,17 @@ import quilt.internal.decompile.javadoc.MethodJavadocProvider; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; import java.nio.file.Path; import java.util.Collection; import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -public class QuiltflowerDecompiler extends AbstractDecompiler implements IBytecodeProvider { +public class VineflowerDecompiler extends AbstractDecompiler { private IFabricJavadocProvider javadocProvider; private ClassJavadocProvider classJavadocProvider; private FieldJavadocProvider fieldJavadocProvider; private MethodJavadocProvider methodJavadocProvider; - public QuiltflowerDecompiler(Project project) { + public VineflowerDecompiler(Project project) { super(project); } @@ -45,16 +38,16 @@ public void decompile(File file, File outputDir, Map options, Co if (this.javadocProvider != null) { javadocProvider = this.javadocProvider; } else if (hasMemberJavadocProvider()) { - javadocProvider = new QuiltflowerJavadocProvider(this.classJavadocProvider, this.fieldJavadocProvider, this.methodJavadocProvider); + javadocProvider = new VineflowerJavadocProvider(this.classJavadocProvider, this.fieldJavadocProvider, this.methodJavadocProvider); } if (javadocProvider != null) { options.put(IFabricJavadocProvider.PROPERTY_NAME, javadocProvider); } - IResultSaver resultSaver = new QuiltflowerResultSaver(outputPath); + IResultSaver resultSaver = new VineflowerResultSaver(outputPath); - BaseDecompiler decompiler = new BaseDecompiler(this, resultSaver, options, new LoggerImpl()); + BaseDecompiler decompiler = new BaseDecompiler(resultSaver, options, new LoggerImpl()); decompiler.addSource(file); for (File library : libraries) { @@ -64,27 +57,6 @@ public void decompile(File file, File outputDir, Map options, Co decompiler.decompileContext(); } - @Override - public byte[] getBytecode(String externalPath, String internalPath) throws IOException { - File file = new File(externalPath); - if (internalPath == null) { - try (InputStream stream = new FileInputStream(file)) { - return stream.readAllBytes(); - } - } else { - try (ZipFile zipFile = new ZipFile(file)) { - ZipEntry entry = zipFile.getEntry(internalPath); - if (entry == null) { - throw new FileNotFoundException("Entry " + internalPath + " not found in " + file); - } - - try (InputStream stream = zipFile.getInputStream(entry)) { - return stream.readAllBytes(); - } - } - } - } - private boolean hasMemberJavadocProvider() { return this.classJavadocProvider != null || this.fieldJavadocProvider != null || this.methodJavadocProvider != null; } diff --git a/buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerJavadocProvider.java b/buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerJavadocProvider.java similarity index 85% rename from buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerJavadocProvider.java rename to buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerJavadocProvider.java index c5e12d99f9..3ee3579e61 100644 --- a/buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerJavadocProvider.java +++ b/buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerJavadocProvider.java @@ -1,4 +1,4 @@ -package quilt.internal.decompile.quiltflower; +package quilt.internal.decompile.vineflower; import net.fabricmc.fernflower.api.IFabricJavadocProvider; import org.jetbrains.java.decompiler.struct.StructClass; @@ -8,12 +8,12 @@ import quilt.internal.decompile.javadoc.FieldJavadocProvider; import quilt.internal.decompile.javadoc.MethodJavadocProvider; -public class QuiltflowerJavadocProvider implements IFabricJavadocProvider { +public class VineflowerJavadocProvider implements IFabricJavadocProvider { private final ClassJavadocProvider classJavadocProvider; private final FieldJavadocProvider fieldJavadocProvider; private final MethodJavadocProvider methodJavadocProvider; - public QuiltflowerJavadocProvider(ClassJavadocProvider classJavadocProvider, FieldJavadocProvider fieldJavadocProvider, MethodJavadocProvider methodJavadocProvider) { + public VineflowerJavadocProvider(ClassJavadocProvider classJavadocProvider, FieldJavadocProvider fieldJavadocProvider, MethodJavadocProvider methodJavadocProvider) { this.classJavadocProvider = classJavadocProvider != null ? classJavadocProvider : ClassJavadocProvider.EMPTY; this.fieldJavadocProvider = fieldJavadocProvider != null ? fieldJavadocProvider : FieldJavadocProvider.EMPTY; this.methodJavadocProvider = methodJavadocProvider != null ? methodJavadocProvider : MethodJavadocProvider.EMPTY; diff --git a/buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerResultSaver.java b/buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerResultSaver.java similarity index 91% rename from buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerResultSaver.java rename to buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerResultSaver.java index 659060140f..8e6d2a9488 100644 --- a/buildSrc/src/main/java/quilt/internal/decompile/quiltflower/QuiltflowerResultSaver.java +++ b/buildSrc/src/main/java/quilt/internal/decompile/vineflower/VineflowerResultSaver.java @@ -1,17 +1,16 @@ -package quilt.internal.decompile.quiltflower; +package quilt.internal.decompile.vineflower; import org.jetbrains.java.decompiler.main.extern.IResultSaver; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Objects; import java.util.jar.Manifest; -public class QuiltflowerResultSaver implements IResultSaver { +public class VineflowerResultSaver implements IResultSaver { private final Path outputPath; - public QuiltflowerResultSaver(Path outputPath) { + public VineflowerResultSaver(Path outputPath) { this.outputPath = outputPath; } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 374f97544d..5cdd333071 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,7 +18,7 @@ jsr305 = "3.0.2" gson = "2.9.1" netty = "4.1" -quiltflower = "1.10.0-20230120.185555-31" +vineflower = "1.10.0-20230713.053900-2" cfr = "0.2.0" junit = "5.9.1" @@ -49,7 +49,7 @@ jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "jsr305" } # Decompilers cfr = { module = "net.fabricmc:cfr", version.ref = "cfr" } -quiltflower = { module = "org.quiltmc:quiltflower", version.ref = "quiltflower" } +vineflower = { module = "org.vineflower:vineflower", version.ref = "vineflower" } # Testing junit = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }