Skip to content

Commit

Permalink
refactor: Move ReVanced Patcher to sub-project
Browse files Browse the repository at this point in the history
This allows other sub-projects to exist.
  • Loading branch information
oSumAtrIX committed Sep 4, 2023
1 parent 3b4db3d commit 4dd0497
Show file tree
Hide file tree
Showing 75 changed files with 72 additions and 100 deletions.
56 changes: 1 addition & 55 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,58 +1,4 @@
plugins {
kotlin("jvm") version "1.8.20"
`maven-publish`
kotlin("jvm") version "1.9.0" apply false
alias(libs.plugins.binary.compatibility.validator)
}

group = "app.revanced"

dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.xpp3)
implementation(libs.smali)
implementation(libs.multidexlib2)
implementation(libs.apktool.lib)
implementation(libs.kotlin.reflect)

compileOnly(libs.android)

testImplementation(libs.kotlin.test)
}

tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}

processResources {
expand("projectVersion" to project.version)
}
}

kotlin { jvmToolchain(11) }

java {
withSourcesJar()
}

publishing {
repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("gpr") {
from(components["java"])
}
}
}
File renamed without changes.
57 changes: 57 additions & 0 deletions revanced-patcher/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
plugins {
kotlin("jvm") version "1.9.0"
`maven-publish`
}

group = "app.revanced"

dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.xpp3)
implementation(libs.smali)
implementation(libs.multidexlib2)
implementation(libs.apktool.lib)
implementation(libs.kotlin.reflect)

compileOnly(libs.android)

testImplementation(libs.kotlin.test)
}

tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}

processResources {
expand("projectVersion" to project.version)
}
}

kotlin { jvmToolchain(11) }

java {
withSourcesJar()
}

publishing {
repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("gpr") {
from(components["java"])
}
}
}
1 change: 1 addition & 0 deletions revanced-patcher/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "revanced-patcher"
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package app.revanced.patcher.usage.bytecode

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.PatchOption
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.usage.resource.annotation.ExampleResourceCompatibility
import app.revanced.patcher.usage.resource.patch.ExampleResourcePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
Expand All @@ -32,11 +28,17 @@ import com.android.tools.smali.dexlib2.util.Preconditions
import com.google.common.collect.ImmutableList

@Patch
@Name("example-bytecode-patch")
@Description("Example demonstration of a bytecode patch.")
@ExampleResourceCompatibility
@DependsOn([ExampleResourcePatch::class])
class ExampleBytecodePatch : BytecodePatch(listOf(ExampleFingerprint)) {
class ExampleBytecodePatch : BytecodePatch(
Manifest(
"Example patch",
"Example demonstration of a bytecode patch.",
dependencies = setOf(ExampleResourcePatch::class),
compatiblePackages = setOf(
Manifest.CompatiblePackage("com.example.examplePackage", setOf("0.0.1", "0.0.2"))
)
),
ExampleFingerprint
) {
// This function will be executed by the patcher.
// You can treat it as a constructor
override fun execute(context: BytecodeContext) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
package app.revanced.patcher.usage.resource.patch

import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.usage.resource.annotation.ExampleResourceCompatibility
import org.w3c.dom.Element

@Patch
@Name("example-resource-patch")
@Description("Example demonstration of a resource patch.")
@ExampleResourceCompatibility
class ExampleResourcePatch : ResourcePatch {
class ExampleResourcePatch : ResourcePatch(Manifest("Example name", "Example description")) {
override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { editor ->
val element = editor // regular DomFileEditor
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ dependencyResolutionManagement {
}
}

rootProject.name = "revanced-patcher"
include("revanced-patcher")

This file was deleted.

This file was deleted.

0 comments on commit 4dd0497

Please sign in to comment.