@@ -46,37 +46,31 @@ dependencies {
4646 compileOnly(" com.github.MMRLApp.MMRL:platform:v33773" )
4747}
4848
49- /* val androidHome: String = System.getenv("ANDROID_HOME")
49+ val androidHome: String? = System .getenv(" ANDROID_HOME" )
50+ ? : System .getenv(" ANDROID_SDK_ROOT" )
5051
51- val d8Bin: String = "$androidHome/build-tools/34.0.0/d8.bat"
52- val adbBin: String = "$androidHome/platform-tools/adb.exe"
52+ val d8Bin = " $androidHome /build-tools/34.0.0/d8"
5353val buildDir: File = project.layout.buildDirectory.get().asFile
5454
55- fun adbPush(vararg cmd: String) {
56- exec {
57- commandLine(android.adbExecutable.path, "push", *cmd)
58- }
59- }
60-
61- fun adbRootShell(vararg cmd: String) {
62- exec {
63- commandLine(android.adbExecutable.path, "shell", "su", "-c", "\"${cmd.joinToString(" ")}\"")
64- }
65- }
55+ val classesJar = buildDir.resolve(" intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar" )
56+ val dexOutput = buildDir.resolve(" classes.dex" )
6657
67- fun d8(vararg cmd : String) {
58+ fun d8 (vararg args : String ) {
6859 exec {
69- commandLine(d8Bin, *cmd )
60+ commandLine(d8Bin, * args )
7061 }
7162}
7263
73- val classes = buildDir.resolve("intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar")
74-
7564tasks.register(" build-dex" ) {
7665 dependsOn(" build" )
7766
7867 doLast {
79- d8("--output=$buildDir", classes.path)
80- adbPush("$buildDir/classes.dex", "/data/adb/modules/bindhosts/webroot/plugins/webui-plugin.dex")
68+ if (! File (d8Bin).canExecute()) {
69+ file(d8Bin).setExecutable(true )
70+ }
71+
72+ d8(" --output=${buildDir.absolutePath} " , classesJar.absolutePath)
73+
74+ println (" DEX file created at: $dexOutput " )
8175 }
82- }*/
76+ }
0 commit comments