Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ReVanced/revanced-patches-gradle-plugin

🐘 A Gradle plugin for ReVanced Patches projects
https://github.com/ReVanced/revanced-patches-gradle-plugin

gradle gradle-plugin kotlin patches

Last synced: 14 days ago
JSON representation

🐘 A Gradle plugin for ReVanced Patches projects

Awesome Lists containing this project

README

        













   





   





   





   





   





   










Continuing the legacy of Vanced

# 🐘 ReVanced Patches Gradle plugin

![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/ReVanced/revanced-patches-gradle-plugin/release.yml)
![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)

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](src/main/kotlin/app/revanced/patches/gradle/SettingsPlugin.kt):
Applied to the `settings.gradle.kts` file, configures the project repositories and subprojects
- The [patches plugin](src/main/kotlin/app/revanced/patches/gradle/PatchesPlugin.kt):
Applied to the patches subproject by the settings plugin
- The [extension plugin](src/main/kotlin/app/revanced/patches/gradle/ExtensionPlugin.kt):
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](https://github.com/revanced/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:

```kotlin
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 ""
}

// 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](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages).

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

```kotlin
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:

```kotlin
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](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages).
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](LICENSE) for more
information. [tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) 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.