Skip to content

Commit 7e9edf8

Browse files
committed
cv
1 parent 6fe66c6 commit 7e9edf8

File tree

2 files changed

+50
-21
lines changed

2 files changed

+50
-21
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build Dex
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
ANDROID_SDK_ROOT: ${{ github.workspace }}/android-sdk
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v3
21+
with:
22+
distribution: 'temurin'
23+
java-version: 17
24+
25+
- name: Set up Android SDK
26+
uses: android-actions/setup-android@v3
27+
28+
- name: Accept Licenses
29+
run: yes | sdkmanager --licenses
30+
31+
- name: Install Build Tools
32+
run: sdkmanager "build-tools;34.0.0" "platforms;android-35"
33+
34+
- name: Build Dex
35+
run: ./gradlew build-dex

plugin/build.gradle.kts

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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"
5353
val 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-
7564
tasks.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

Comments
 (0)