File tree Expand file tree Collapse file tree
src/main/assets/server_bundle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,3 +18,6 @@ Android-APP/.gradle/
1818Android-APP /.kotlin /
1919Android-APP /local.properties
2020Android-APP /gradlew.bat
21+ # Generated server bundle (esbuild output) — CI/local builds regenerate it via
22+ # "bun run build:android-bundle" + copy; see Android-APP/AGENTS.md BUILD section.
23+ Android-APP /app /src /main /assets /server_bundle /server.cjs
Original file line number Diff line number Diff line change @@ -77,3 +77,23 @@ dependencies {
7777 implementation(" androidx.browser:browser:1.8.0" )
7878 implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0" )
7979}
80+
81+ // server.cjs is build output (gitignored), generated from ../../src by
82+ // "bun run build:android-bundle" + copy — release CI regenerates it before
83+ // packaging; local builds must too. Fail at build time rather than shipping
84+ // an APK whose NodeRunner dies on first launch over a missing bundle.
85+ val serverBundleFile = file(" src/main/assets/server_bundle/server.cjs" )
86+ val checkServerBundle = tasks.register(" checkServerBundle" ) {
87+ doLast {
88+ val size = if (serverBundleFile.exists()) serverBundleFile.length() else 0L
89+ if (size < 1_000_000L ) {
90+ throw GradleException (
91+ " server_bundle/server.cjs is missing or implausible ($size bytes). " +
92+ " Generate it first:\n " +
93+ " bun run build:android-bundle\n " +
94+ " cp dist/android/server.cjs Android-APP/app/src/main/assets/server_bundle/server.cjs"
95+ )
96+ }
97+ }
98+ }
99+ tasks.named(" preBuild" ) { dependsOn(checkServerBundle) }
You can’t perform that action at this time.
0 commit comments