File tree 3 files changed +10
-26
lines changed
src/main/kotlin/app/revanced/patch
3 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,9 @@ repositories {
22
22
}
23
23
}
24
24
25
- val patchesDependency = " app.revanced:revanced-patches:1.+"
26
-
27
25
dependencies {
28
26
implementation(kotlin(" stdlib" ))
29
27
implementation(" app.revanced:revanced-patcher:+" )
30
- implementation(patchesDependency)
31
28
implementation(" info.picocli:picocli:+" )
32
29
33
30
implementation(" me.tongfei:progressbar:+" )
@@ -45,9 +42,6 @@ tasks {
45
42
dependsOn(shadowJar)
46
43
}
47
44
shadowJar {
48
- dependencies {
49
- exclude(dependency(patchesDependency))
50
- }
51
45
manifest {
52
46
attributes(" Main-Class" to " app.revanced.cli.MainKt" )
53
47
attributes(" Implementation-Title" to project.name)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2,25 +2,25 @@ package app.revanced.patch
2
2
3
3
import app.revanced.patcher.data.base.Data
4
4
import app.revanced.patcher.patch.base.Patch
5
- import app.revanced.patches.Index
6
5
import java.io.File
7
6
import java.net.URLClassLoader
8
7
9
8
internal object Patches {
10
9
11
-
12
10
/* *
13
11
* This method loads patches from a given patch file
14
12
* @return the loaded patches represented as a list of functions returning instances of [Patch]
15
13
*/
16
- internal fun load (patchFile : File ): List <() -> Patch <Data >> {
17
- val url = patchFile .toURI().toURL()
14
+ internal fun load (patchesJar : File ): List <() -> Patch <Data >> {
15
+ val url = patchesJar .toURI().toURL()
18
16
val classLoader = URLClassLoader (arrayOf(url))
19
- return loadIndex(classLoader).patches
17
+
18
+ val indexClass = classLoader.loadClass(" app.revanced.patches.Index" )
19
+
20
+ val index = indexClass.declaredFields.last()
21
+ index.isAccessible = true
22
+
23
+ @Suppress(" UNCHECKED_CAST" )
24
+ return index.get(null ) as List < () -> Patch <Data >>
20
25
}
21
- private fun loadIndex (classLoader : ClassLoader ) = classLoader
22
- .loadClass(Index ::class .java.canonicalName)
23
- .fields
24
- .first()
25
- .get(null ) as Index
26
26
}
You can’t perform that action at this time.
0 commit comments