/GradleDecompiler

A Gradle plugin to decompile dependencies without sources.

Primary LanguageGroovyGNU Affero General Public License v3.0AGPL-3.0

Gradle Decompiler Plugin

This is a small and simple Gradle plugin meant to allow users to decompile dependencies using VineFlower (or a hosted tool of your choice) and be able to view the sources in their IDE.

Warning

This project is still early in development.

Caution

USE THIS AT YOUR OWN RISK. I take no liability or responsibility for your actions using this tool to decompile any software to which you do not have permission to. This tool is intended for the decompilation of software that is either a) already open-source or b) you have permission to decompile. If you are unsure, DO NOT use this tool.

Usage

In your settings.gradle file, add the Modding Legacy maven repository to the plugin management repositories.

pluginManagement {
    repositories {
        gradlePluginPortal()
        maven { url = 'https://maven.moddinglegacy.com/maven' }
    }
}

In your build.gradle file, apply the plugin and configure it.

plugins {
    id 'java'
    id 'me.jonathing.gradle.decompiler' version '0.1.5'
}

decompiler {
    // optional: change which decompiler to use
    decompiler = 'org.vineflower:vineflower:1.11.1' // default: latest vineflower

    // optional: disable the comment banner at the top of decompiled sources
    useCommentBanner = false // default: true

    // optional: keep non-class files from decompiled source JARs
    strip = false // default: true
}

In your dependencies {} block, wrap the dependency notation in decompiler.dep() for dependencies you want to decompile.

dependencies {
    implementation decompiler.dep('com.example:example:1.0.0')
}

Note

Due to how dependencies are resolved in Gradle, this plugin does not attach sources to the dependencies but rather places a sources.jar file next to the original artifact. Most IDEs will automatically detect the presence of this jar and attach it as the sources for that library. If an artifact already has a sources jar, your IDE will likely select that over the decompiled sources generated by this plugin.