refactor: Move ReVanced Patcher to sub-project

This allows other sub-projects to exist.
This commit is contained in:
oSumAtrIX 2023-09-04 05:37:13 +02:00
parent 3b4db3ddb7
commit 4dd04975d9
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
75 changed files with 72 additions and 100 deletions

View file

@ -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"])
}
}
}

View file

@ -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"])
}
}
}

View file

@ -0,0 +1 @@
rootProject.name = "revanced-patcher"

View file

@ -1,7 +1,5 @@
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
@ -9,9 +7,7 @@ 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
@ -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) {

View file

@ -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

View file

@ -19,4 +19,4 @@ dependencyResolutionManagement {
}
}
rootProject.name = "revanced-patcher"
include("revanced-patcher")

View file

@ -1,13 +0,0 @@
package app.revanced.patcher.usage.bytecode
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.example.examplePackage", arrayOf("0.0.1", "0.0.2")
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class ExampleBytecodeCompatibility

View file

@ -1,13 +0,0 @@
package app.revanced.patcher.usage.resource.annotation
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.example.examplePackage", arrayOf("0.0.1", "0.0.2")
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class ExampleResourceCompatibility