Create hello-platform for Android (#12)

Co-authored-by: Михаил Капелько <kornerr@gmail.com>
This commit is contained in:
kornerr authored and Михаил Капелько committed 2026-11-01 15:52:24 +01:00
1 parent cf79e89dc4
commit 45ca185094
45 files changed
+985 -25

No files matched your search

+15 -10
View File
@@ -1,22 +1,23 @@
# OGS applications (`mj`)
Native SwiftUI apps on the Dialect v4 declarative reactive engine (v2.0.0).
Native SwiftUI and Compose apps on the Dialect v4 declarative reactive engine.
Remote: `https://git.opengamestudio.org/mahjong/mahjong`.
## Apps
- `hello/hello-platform/` — macOS + iOS platform-support sample (Hello counter). Its
- `hello/hello-platform/` — macOS + iOS + Android platform-support sample (Hello counter). Its
structure, startup flow and dialect rules are in
[docs/hello-platform.md](docs/hello-platform.md); read that file whenever anything
from hello-platform is referenced.
## Layout
- `<app>/dialect.yml` → generates `<app>/ver-mac/src/dialect.swift`.
- `<app>/dialect.yml` → generates `<app>/ver-mac/src/dialect.swift` and
`<app>/ver-android/.../dialect.kt`.
- `components/` — shared source of truth; app `src/` entries are relative symlinks:
edit the real files and keep symlink parity.
- `hello-platform` uses `components/hp/` for its component, view model and shared
SwiftUI view, and `components/other/` for shared helpers.
- `hello-platform` uses `components/hp/` for its component, view models and views
(`mac/`, `ios/`, `android/`), and `components/other/` for shared helpers.
- `history/gitjs/` — historical JS reference, outside the build.
## Build
@@ -28,24 +29,28 @@ cd hello/hello-platform
util/build-mac
util/run-mac
util/prepare-ios # xcodegen; xcodebuild command is in docs/hello-platform.md
util/prepare-android # generate dialect.kt; gradlew command is in docs/hello-platform.md
```
`build-mac` regenerates Dialect, runs `swift build` in `ver-mac/`, then packages the
binary and `ver-mac/res/` into `ver-mac/.build/<App Name>.app`. `ver-ios/` mirrors
`ver-mac/` and shares `dialect.swift`, `HPView` and the app icon via symlinks.
`ver-android/` has its own generated `dialect.kt` and Compose view. Kotlin output is
LLM-transpiled: run `ollama serve` before generating (model `qwen2.5-coder:3b`).
Dangling-symlink audit:
`find components hello -type l ! -exec test -e {} \; -not -path '*/.build/*'`
iOS simulator: use **IVA** (`EB867790-F2C0-4392-9F99-C509D4487FDA`, iPhone 17,
iOS 26.5), not iPhone 15 Pro.
iOS 26.5), not iPhone 15 Pro. Android emulator: **Small_30** (`-gpu
swiftshader_indirect` avoids a headless crash).
## Dialect
- Edit `<app>/dialect.yml` / `components/`, then `util/build-mac`; manual edits to the
generated `dialect.swift` are overwritten.
- `struct F` (field names) exists only in `dialect.swift`: a new field needs
`static let <field> = "<field>"` hand-patched in ASCII order or `F.<field>`
will not build.
generated `dialect.swift` / `dialect.kt` are overwritten.
- `struct F` (field names) exists only in the generated files: a new field needs
`static let <field> = "<field>"` hand-patched in ASCII order in both
`dialect.swift` and `dialect.kt` or `F.<field>` will not build.
- Validate: `ruby -ryaml -e 'YAML.load_file("hello/hello-platform/dialect.yml")'`.
Every should-label (`1. Upon each ...`) MUST end with a colon —
`../dialect/components/yml/ymlFun.swift` blindly `dropLast()`s it. Complaints