Skip to content

ReVanced/revanced-patches-gradle-plugin

Repository files navigation


Β Β Β  Β Β Β  Β Β Β  Β Β Β  Β Β Β  Β Β Β 

Continuing the legacy of Vanced

🐘 ReVanced Patches Gradle plugin

GitHub Workflow Status (with event) GPLv3 License

A Gradle plugin for ReVanced Patches projects.

❓ About

ReVanced Patches Gradle plugin configures a project to develop ReVanced Patches.

For that, the plugin provides:

  • The settings plugin: Applied to the settings.gradle.kts file, configures the project repositories and subprojects
  • The patches plugin: Applied to the patches subproject by the settings plugin
  • The extension plugin: Applied to extension subprojects by the settings plugin

Caution

This plugin is not stable yet and likely to change due to lacking experience with Gradle plugins.
If you have experience with Gradle plugins and can help improve this plugin, consider reaching out to us at [email protected] or by opening an issue.

πŸš€ How to get started

Tip

The ReVanced Patches template repository uses this plugin and is a good starting point to create a new ReVanced Patches project.

Add the following to the settings.gradle.kts file:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/revanced/registry")
            credentials {
                username = providers.gradleProperty("gpr.user")
                password = providers.gradleProperty("gpr.key")
            }
        }
    }
}

plugins {
    id("app.revanced.patches") version "<version>"
}

// This block is optional and can be used to configure the patches and extension projects.
settings {
    // "patches" is the default.
    patchesProjectPath = "patches"

    extensions {
        // The path containing the extension projects. "extensions" is the default.
        projectsPath = "extensions"

        // A default namespace for extension projects. null is the default.
        defaultNamespace = "app.revanced.extension"

        // Proguard files relative to the extension project.
        // By default, isMinifyEnabled is false, unless a ProGuard file is added.
        proguardFiles("../proguard-rules.pro")
    }
}

Note

The plugin is published to the GitHub Package Registry, so you need to authenticate with GitHub.
More information here.

Create the patches project and configure the build.gradle.kts file:

patches {
    about {
        name = "ReVanced Patches"
        description = "Patches for ReVanced"
        // ...   
    }
}

Note

By default, the plugin expects the patches project to be in the patches directory.

Create the extension project and add an empty build.gradle.kts file. Unless the build.gradle.kts file is empty, the plugin will not recognize the extension project. By default, the extension name will be inferred from the relative path to the extension project. For example, the extension name for the extensions/extension project will be extensions/extension.rve. To set an extension name explicitly, add the following to the build.gradle.kts file:

extension {
    name = "extensions/extension.rve"
}

Note

By default, the plugin expects extension projects to be under the extensions directory.

πŸ“š Everything else

πŸ› οΈ Building

To build ReVanced Patches Gradle plugin, follow these steps:

  1. Clone the repository and navigate to the project directory.
  2. Authenticate with GitHub. More information here.
  3. Run ./gradlew build to build the plugin.
  4. Optionally, run ./gradlew publishToMavenLocal to publish the plugin to your local Maven repository for development.

πŸ“œ Licence

ReVanced Patches Gradle plugin is licensed under the GPLv3 license. Please see the license file for more information. tl;dr you may copy, distribute and modify ReVanced Patches Gradle plugin as long as you track changes/dates in source files. Any modifications to ReVanced Patches Gradle plugin must also be made available under the GPL, along with build & install instructions.