abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2026-02-24 22:50:16 +0100
committerGitHub2026-02-24 22:50:16 +0100
commit9863dcea9eaa197177552f8621091b3e0858cc76 (patch)
tree1453cfaa99be1bed02e46341b327b287ea5a5ffd
parenta80afa5fbebd023167394cdc3e31fc26790cffaa (diff)
downloadunexpected-keyboard-9863dcea9eaa197177552f8621091b3e0858cc76.tar.gz
unexpected-keyboard-9863dcea9eaa197177552f8621091b3e0858cc76.zip
gradle: Show an error when Git submodules are not initialized (#1188)
* CONTRIBUTING: Document Git submodules * build: Error during build if the submodules are not initialized
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--build.gradle.kts8
2 files changed, 14 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 89943a9..f2f37a6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -11,6 +11,12 @@ Android Studio is not required. The build dependencies are:
Python 3 is required to update generated files but not to build the app.
+Make sure the Git submodules are initialized and point to the right revision:
+
+```sh
+git submodule update --init
+```
+
For Android Studio users, no more setup is needed.
For Nix users, the right environment can be obtained with `nix-shell ./shell.nix`.
diff --git a/build.gradle.kts b/build.gradle.kts
index 782b8db..8c8b6d7 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -92,6 +92,14 @@ android {
}
}
+
+// This raises an error with an informative message instead of the confusing
+// ndk-build errors that occur when submodules are not initialized.
+gradle.projectsEvaluated {
+ if (!file("vendor/cdict/java").exists())
+ throw GradleException("Git submodules not initialized. Run 'git submodule update --init'")
+}
+
val buildKeyboardFont by tasks.registering(Exec::class) {
val `in` = projectDir.resolve("srcs/special_font")
val out = layout.projectDirectory.file("assets/special_font.ttf")