-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
86 lines (72 loc) · 2.71 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
86 lines (72 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Load local.properties for local development (git-ignored, no hardcoded versions)
val localProperties = java.util.Properties()
val localFile = rootProject.file("local.properties")
if (localFile.exists()) {
localFile.inputStream().use { localProperties.load(it) }
}
allprojects {
localProperties.forEach { (key, value) ->
extra.set(key.toString(), value.toString())
}
}
plugins {
kotlin("multiplatform") version "2.4.0" apply false
id("com.android.application") version "9.2.1" apply false
id("org.jetbrains.compose") version "1.11.1" apply false
kotlin("plugin.compose") version "2.4.0" apply false
}
val processedModuleDir = layout.buildDirectory.dir("intermediates/module")
tasks.register<Copy>("prepareModule") {
group = "build"
description = "Process module templates injecting version properties"
from("module")
filesMatching(listOf("module.prop", "update.json")) {
filteringCharset = "UTF-8"
filter { line ->
val vName = project.property("VERSION_NAME")
val vCode = project.property("VERSION_CODE")
line
.replace("{{VERSION_NAME}}", vName.toString())
.replace("{{VERSION_CODE}}", vCode.toString())
}
}
into(processedModuleDir)
}
tasks.register<Zip>("buildModule") {
group = "build"
description = "Builds the Android APK and packs it into a flashable root module ZIP"
dependsOn("buildAndroid", "prepareModule")
from(processedModuleDir) {
into("/")
}
// Place renamed APK in common/ for the installer check
from("android-app/app/build/outputs/apk/release/") {
include("app-release.apk", "app-release-unsigned.apk")
rename { "InputBlocker.apk" }
into("common")
}
// NOTE: APK intentionally NOT placed in system/app/ — doing so makes it a system
// overlay (uninstallable by user). The service.sh script handles user-app install.
archiveFileName.set("InputBlockerModule.zip")
destinationDirectory.set(file("build/distributions"))
}
tasks.register("buildAll") {
group = "build"
description = "Builds the entire ecosystem: APK, PC Tool (EXE/MSI), and Module ZIP"
dependsOn("buildAndroid", "buildPC", "buildModule")
}
tasks.register("buildAndroid") {
group = "build"
description = "Builds the Android APK"
dependsOn(":android-app:app:assembleRelease")
}
tasks.register("buildPC") {
group = "build"
description = "Builds the PC Tool (Windows EXE/MSI, Linux DEB, macOS DMG)"
dependsOn(":pc-tool-kotlin:packageDistributionForCurrentOS")
}
tasks.register("buildShared") {
group = "build"
description = "Builds the Shared KMP library"
dependsOn(":shared:assemble")
}