Call Git cmd_main directly
This commit is contained in:
21
README.md
21
README.md
@@ -47,6 +47,7 @@ Available commands:
|
||||
| --- | --- | --- |
|
||||
| `bash ./AndroidProjectTooling.sh` | Provision or refresh the local Android/JDK toolchain only. | Toolchain under `./jdk` and `./android-sdk` |
|
||||
| `bash ./AndroidProjectTooling.sh --test` | Compile host Git, set `GITHUG_TEST_GIT_BINARY`, and run JVM unit tests. | Test reports under `app/build/reports/` |
|
||||
| `bash ./AndroidProjectTooling.sh --test-emulator` | Install emulator packages if needed, create/start the project test AVD, compile Android Git, and run debug instrumentation tests. | Instrumentation reports under `app/build/reports/androidTests/` |
|
||||
| `bash ./AndroidProjectTooling.sh --build` | Build the debug APK. | `app/build/outputs/apk/debug/githug-android-debug-v<versionCode>.apk` |
|
||||
| `bash ./AndroidProjectTooling.sh --build-release-aab` | Build the release Android App Bundle. | `app/build/outputs/bundle/release/githug-android-release-v<versionCode>.aab` |
|
||||
| `bash ./AndroidProjectTooling.sh --compile-git` | Compile Git for the development host and all Android target ABIs. | Host and Android `libgit.so` binaries |
|
||||
@@ -57,6 +58,12 @@ To run the JVM unit test suite after ensuring the local toolchain is ready:
|
||||
bash ./AndroidProjectTooling.sh --test
|
||||
```
|
||||
|
||||
To run instrumentation tests on an Android emulator:
|
||||
|
||||
```bash
|
||||
bash ./AndroidProjectTooling.sh --test-emulator
|
||||
```
|
||||
|
||||
To build installable/debuggable artifacts:
|
||||
|
||||
```bash
|
||||
@@ -81,6 +88,7 @@ When `--build` or `--build-release-aab` is used, the script also:
|
||||
|
||||
- increments `versionCode` by 1
|
||||
- increments the patch component of `versionName`, for example `0.1.0` to `0.1.1`
|
||||
- compiles the generated Android `libgit.so` binaries when they are missing or stale
|
||||
- bundles full Git manpage source files from Git's `Documentation/` directory into app assets
|
||||
- renames the generated artifact to a `githug-android-*` filename that includes the post-bump `versionCode`
|
||||
- uploads the renamed APK/AAB with local `./upload2DL.sh` when that script exists
|
||||
@@ -104,9 +112,10 @@ Options:
|
||||
| Command | Purpose | Output |
|
||||
| --- | --- | --- |
|
||||
| `bash ./AndroidProjectTooling.sh --test` | Ensure the host Git binary is current, then run tests with it. | `build/host-git/libgit.so` and test reports |
|
||||
| `bash ./AndroidProjectTooling.sh --test-emulator` | Ensure Android ABI Git binaries are current, then run instrumentation tests on the project AVD. | Android `libgit.so` binaries and instrumentation reports |
|
||||
| `bash ./AndroidProjectTooling.sh --compile-git` | Ensure host Git and Android ABI Git binaries are current. | Host and Android outputs |
|
||||
|
||||
Android ABI outputs:
|
||||
Android ABI outputs are generated files and are ignored by git:
|
||||
|
||||
- `app/src/main/jniLibs/arm64-v8a/libgit.so`
|
||||
- `app/src/main/jniLibs/armeabi-v7a/libgit.so`
|
||||
@@ -119,15 +128,17 @@ Git build outputs are stamped with a Git source fingerprint. Re-running `--test`
|
||||
|
||||
Git manpage assets are also refreshed from the checked-out Git source whenever Git is compiled or an app artifact is built.
|
||||
|
||||
Git source patches can live under `patches/git/` and are applied by `AndroidProjectTooling.sh` after the Git source checkout is cloned or reused. These patches are part of the source fingerprint, so changing a patch forces the host and Android Git binaries to rebuild. The current runtime does not require a Git source patch: it resolves Git's existing exported `init_git` and `cmd_main` symbols through JNI and calls them with Git-style `argc`/`argv`.
|
||||
|
||||
## Runtime Architecture
|
||||
|
||||
The command engine has one app-facing runtime:
|
||||
|
||||
- **Native Git path**: the packaged executable for the device ABI runs Git commands in a real per-level repository sandbox in app-private storage.
|
||||
- **Native Git path**: the packaged Git binary for the device ABI is loaded by the JNI bridge and every `git ...` command invokes Git's existing `init_git(argv)` and `cmd_main(argc, argv)` path in a real per-level repository sandbox in app-private storage.
|
||||
|
||||
The runtime exposes a `RepoState` surface to validators. In addition to files, commits, branches, tags, remotes, and config, the model tracks learning-relevant effects such as stashes, fetched remote refs, pushed branches/tags, submodules, and repository maintenance actions.
|
||||
|
||||
Helper shell-like commands (`ls`, `pwd`, `cat`, `sh <script>`, `./<script>`, `touch`, `mkdir`, `rm`, `echo`, `cd`) remain implemented in Kotlin so the mobile terminal behaves consistently across devices.
|
||||
Helper shell-like commands (`ls`, `pwd`, `cat`, `sh <script>`, `./<script>`, `touch`, `mkdir`, `rm`, `echo`, `cd`) remain implemented in Kotlin so the mobile terminal behaves consistently across devices. Git command behavior, option parsing, and command dispatch are not modeled in Kotlin; they are delegated to Git's own entry path.
|
||||
|
||||
Source files should stay comfortably reviewable. Treat files approaching roughly 700 lines as refactor candidates, and prefer extracting cohesive runtime helpers, command handlers, or focused test classes over letting orchestration classes absorb unrelated responsibilities.
|
||||
|
||||
@@ -141,7 +152,9 @@ The Android port keeps the upstream GitHug exercise order through `submodule`. T
|
||||
| `clone` / `clone_to_folder` | Clones `https://github.com/Gazler/cloneme` and checks the cloned repository content. | Accepts the intended clone command and models the resulting folder. | The app must remain playable offline and avoid relying on GitHub network access from a phone. |
|
||||
| `pull`, `fetch`, `push`, `push_branch`, `push_tags` | Use remote-style workflows from upstream fixtures. | Use local synthetic remotes created inside the sandbox and validate fetched/pushed refs through `RepoState`. | This preserves Git behavior without external network dependencies. |
|
||||
| `stage_lines` | Requires partial hunk staging: one feature line staged and another left unstaged. | Currently validates that `feature.rb` is staged. | Android does not yet expose enough index-vs-working-tree hunk detail in `RepoState` to validate partial staging precisely. |
|
||||
| `rebase_onto`, `merge_squash`, `repack` | Upstream validates detailed object graph, merge-parent, or object database details. | Android validates the relevant user-facing action or resulting state, but with less object-level detail in some cases. | The current `RepoState` projection does not expose every low-level Git object fact. These should be tightened when the state surface grows. |
|
||||
| `rebase_onto`, `merge_squash` | Upstream validates detailed object graph, merge-parent, or squash-content details. | Android validates the relevant user-facing action or resulting state, but with less object-level detail in some cases. | The current `RepoState` projection does not expose every low-level Git object fact. These should be tightened when the state surface grows. |
|
||||
| `repack` | Upstream validates object database packing details. | Android now validates that Git produced a pack file under `.git/objects/pack`. | Equivalent user-facing repository outcome. |
|
||||
| `submodule` | Uses `git submodule add` against the upstream GitHub repository. | Uses an offline local source repository and validates tracked `.gitmodules` metadata for `githug-include-me`. | Android must remain playable offline, and the packaged Git build currently lacks the `git submodule` porcelain. |
|
||||
| `conflict` | Copies the upstream conflicting poem fixture and validates that the merge commit has two parents, conflict markers are removed, and the correct poem line remains. | Recreates the conflicting poem history natively and validates the latest commit has two parents, no conflict markers remain, and the correct `Sat on a wall` line is present. | Equivalent. |
|
||||
|
||||
## Level Authoring
|
||||
|
||||
Reference in New Issue
Block a user