-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
351 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[*.{kt,kts}] | ||
ktlint_code_style = intellij_idea | ||
ktlint_standard_no-wildcard-imports = disabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public final class app/revanced/patches/example/ExamplePatch : app/revanced/patcher/patch/BytecodePatch { | ||
public static final field INSTANCE Lapp/revanced/patches/example/ExamplePatch; | ||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V | ||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,104 @@ | ||
import org.gradle.kotlin.dsl.support.listFilesOrdered | ||
|
||
plugins { | ||
kotlin("jvm") version "1.9.10" | ||
alias(libs.plugins.kotlin) | ||
alias(libs.plugins.binary.compatibility.validator) | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
group = "your.org" | ||
group = "app.revanced" | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
google() | ||
maven { url = uri("https://jitpack.io") } | ||
maven { | ||
// A repository must be speficied for some reason. "registry" is a dummy. | ||
url = uri("https://maven.pkg.github.com/revanced/registry") | ||
credentials { | ||
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") | ||
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.revanced.patcher) | ||
implementation(libs.smali) | ||
// TODO: Required because build fails without it. Find a way to remove this dependency. | ||
implementation(libs.guava) | ||
// Used in JsonGenerator. | ||
implementation(libs.gson) | ||
|
||
// A dependency to the Android library unfortunately fails the build, which is why this is required. | ||
compileOnly(project("dummy")) | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
} | ||
|
||
tasks.withType(Jar::class) { | ||
manifest { | ||
attributes["Name"] = "Your Patches" | ||
attributes["Description"] = "Patches for ReVanced." | ||
attributes["Version"] = version | ||
attributes["Timestamp"] = System.currentTimeMillis().toString() | ||
attributes["Source"] = "[email protected]:you/revanced-patches.git" | ||
attributes["Author"] = "You" | ||
attributes["Contact"] = "[email protected]" | ||
attributes["Origin"] = "https://your.homepage" | ||
attributes["License"] = "GNU General Public License v3.0" | ||
tasks { | ||
withType(Jar::class) { | ||
manifest { | ||
attributes["Name"] = "ReVanced Patches template" | ||
attributes["Description"] = "Patches template for ReVanced." | ||
attributes["Version"] = version | ||
attributes["Timestamp"] = System.currentTimeMillis().toString() | ||
attributes["Source"] = "[email protected]:revanced/revanced-patches-template.git" | ||
attributes["Author"] = "ReVanced" | ||
attributes["Contact"] = "[email protected]" | ||
attributes["Origin"] = "https://revanced.app" | ||
attributes["License"] = "GNU General Public License v3.0" | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
register<DefaultTask>("generateBundle") { | ||
description = "Generate DEX files and add them in the JAR file" | ||
register("buildDexJar") { | ||
description = "Build and add a DEX to the JAR file" | ||
group = "build" | ||
|
||
dependsOn(build) | ||
|
||
doLast { | ||
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools") | ||
.listFilesOrdered().last().resolve("d8").absolutePath | ||
|
||
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath | ||
val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath | ||
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile | ||
|
||
exec { | ||
workingDir = workingDirectory | ||
commandLine = listOf(d8, artifacts) | ||
commandLine = listOf(d8, "--release", patchesJar) | ||
} | ||
|
||
exec { | ||
workingDir = workingDirectory | ||
commandLine = listOf("zip", "-u", artifacts, "classes.dex") | ||
commandLine = listOf("zip", "-u", patchesJar, "classes.dex") | ||
} | ||
} | ||
} | ||
|
||
// Required to run tasks because Gradle semantic-release plugin runs the publish task. | ||
// Needed by gradle-semantic-release-plugin. | ||
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 | ||
named("publish") { | ||
dependsOn("generateBundle") | ||
publish { | ||
dependsOn("buildDexJar") | ||
} | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/revanced/revanced-patches-template") | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
|
||
publications { | ||
create<MavenPublication>("revanced-patches-publication") { | ||
from(components["java"]) | ||
|
||
pom { | ||
name = "Your Patches" | ||
description = "Patches for ReVanced." | ||
url = "https://your.homepage" | ||
name = "ReVanced Patches template" | ||
description = "Patches template for ReVanced." | ||
url = "https://revanced.app" | ||
|
||
licenses { | ||
license { | ||
|
@@ -94,17 +108,23 @@ publishing { | |
} | ||
developers { | ||
developer { | ||
id = "Your ID" | ||
name = "Your Name" | ||
email = "contact@your.homepage" | ||
id = "ReVanced" | ||
name = "ReVanced" | ||
email = "contact@revanced.app" | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:git://github.com/you/revanced-patches.git" | ||
developerConnection = "scm:git:[email protected]:you/revanced-patches.git" | ||
url = "https://github.com/you/revanced-patches" | ||
connection = "scm:git:git://github.com/revanced/revanced-patches-template.git" | ||
developerConnection = "scm:git:[email protected]:revanced/revanced-patches-template.git" | ||
url = "https://github.com/revanced/revanced-patches-template" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useGpgCmd() | ||
|
||
sign(publishing.publications["revanced-patches-publication"]) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
org.gradle.parallel = true | ||
org.gradle.caching = true | ||
kotlin.code.style = official | ||
version = 1.0.0 | ||
version = 1.0.1-dev.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
[versions] | ||
revanced-patcher = "19.0.0" | ||
smali = "3.0.3" | ||
guava = "32.1.2-jre" | ||
gson = "2.10.1" | ||
revanced-patcher = "19.3.1" | ||
smali = "3.0.4" | ||
binary-compatibility-validator = "0.14.0" | ||
kotlin = "1.9.22" | ||
|
||
[libraries] | ||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" } | ||
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" } | ||
guava = { module = "com.google.guava:guava", version.ref = "guava" } | ||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" } | ||
|
||
[plugins] | ||
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" } | ||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dist |
Oops, something went wrong.