Skip to content

Commit 94ed382

Browse files
authored
Update build.gradle.kts
1 parent 9faf471 commit 94ed382

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

plugin/build.gradle.kts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
5056
val 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"
5460
val buildDir: File = project.layout.buildDirectory.get().asFile
5561

5662
fun 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

Comments
 (0)