@@ -47,21 +47,21 @@ dependencies {
4747 compileOnly(" com.github.MMRLApp.MMRL:webui:4a41e7bdd7" )
4848}
4949
50+ val isCI = System .getenv(" CI" ) == " true"
51+
52+ val osName = System .getProperty(" os.name" ).lowercase()
53+ val d8Suffix = if (osName.contains(" win" )) " .bat" else " "
54+ val adbSuffix = if (osName.contains(" win" )) " .exe" else " "
55+
5056val androidHome: String = System .getenv(" ANDROID_HOME" )
5157
52- val d8Bin: String = " $androidHome /build-tools/34.0.0/d8.bat "
53- val adbBin: String = " $androidHome /platform-tools/adb.exe "
58+ val d8Bin: String = " $androidHome /build-tools/34.0.0/d8$d8Suffix "
59+ val adbBin: String = " $androidHome /platform-tools/adb$adbSuffix "
5460val buildDir: File = project.layout.buildDirectory.get().asFile
5561
5662fun adbPush (vararg cmd : String ) {
5763 exec {
58- commandLine(android.adbExecutable.path, " push" , * cmd)
59- }
60- }
61-
62- fun adbRootShell (vararg cmd : String ) {
63- exec {
64- commandLine(android.adbExecutable.path, " shell" , " su" , " -c" , " \" ${cmd.joinToString(" " )} \" " )
64+ commandLine(adbBin, " push" , * cmd)
6565 }
6666}
6767
@@ -78,6 +78,10 @@ tasks.register("build-dex") {
7878
7979 doLast {
8080 d8(" --output=$buildDir " , classes.path)
81- adbPush(" $buildDir /classes.dex" , " /data/adb/modules/bindhosts/webroot/plugins/webui.dex" )
81+ if (! isCI) {
82+ adbPush(" $buildDir /classes.dex" , " /data/adb/modules/bindhosts/webroot/plugins/webui.dex" )
83+ } else {
84+ println (" Skipping adbPush in CI environment." )
85+ }
8286 }
8387}
0 commit comments