Move native level setups into level files

- Delete NativeLevelFixtures.kt and make native repository setup an optional property of each Level.
- Move every existing native setup into its corresponding level file so setup, validation, and tests stay together.
- Add the missing Blame native setup with config.rb history and a Spider Man password commit.
- Add a native runtime regression that verifies `git blame config.rb` identifies Spider Man on the password line.
- Verify the full JVM test suite using the compiled host Git runtime.
This commit is contained in:
Joe Tretter
2026-05-07 18:53:18 -05:00
parent 7bfb761068
commit 64743ff4a9
30 changed files with 580 additions and 505 deletions

View File

@@ -39,16 +39,34 @@ It is designed to be idempotent and uses project-relative paths to:
- install required Android SDK packages
- write `local.properties`
Available commands:
| Command | Purpose | Output |
| --- | --- | --- |
| `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 --build` | Build the debug APK. | `app/build/outputs/apk/debug/githug-android-debug.apk` |
| `bash ./AndroidProjectTooling.sh --build-aab` | Build the debug Android App Bundle. | `app/build/outputs/bundle/debug/githug-android-debug.aab` |
| `bash ./AndroidProjectTooling.sh --build-release-aab` | Build the release Android App Bundle. | `app/build/outputs/bundle/release/githug-android-release.aab` |
| `bash ./AndroidProjectTooling.sh --compile-git` | Compile Git for the development host and all Android target ABIs. | Host and Android `libgit.so` binaries |
To run the JVM unit test suite after ensuring the local toolchain is ready:
```bash
bash ./AndroidProjectTooling.sh --test
```
To build the debug APK:
To build installable/debuggable artifacts:
```bash
bash ./AndroidProjectTooling.sh --build
bash ./AndroidProjectTooling.sh --build-aab
```
To build the release AAB intended for Play Store style distribution work:
```bash
bash ./AndroidProjectTooling.sh --build-release-aab
```
The script avoids depending on the system Java version by provisioning a project-local **JDK 17**, which is required by current Android SDK command-line tools.
@@ -59,13 +77,50 @@ To avoid repeated expensive SDK verification, the script writes a small state fi
If all required components were verified successfully, the script will skip SDK verification/reinstallation for the next **24 hours** unless required directories are missing.
When `--build` is used, the script also:
When `--build`, `--build-aab`, 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`
- renames the debug APK to `githug-android-debug.apk`
- renames the generated artifact to a stable `githug-android-*` filename
- attempts to create a git commit after a successful build if there are source changes
The build commands currently run these Gradle tasks:
- `--build`: `assembleDebug`
- `--build-aab`: `bundleDebug`
- `--build-release-aab`: `bundleRelease`
## Git Binary Compilation
Native Git is compiled with:
```bash
bash ./CompileGitForAllTargetPlatforms.sh [--host | --android | --all]
```
Options:
| Command | Purpose | Output |
| --- | --- | --- |
| `bash ./CompileGitForAllTargetPlatforms.sh --host` | Compile Git for the development machine. | `build/host-git/libgit.so` |
| `bash ./CompileGitForAllTargetPlatforms.sh --android` | Cross-compile Git for Android ABIs served by Google Play. | `app/src/main/jniLibs/<abi>/libgit.so` |
| `bash ./CompileGitForAllTargetPlatforms.sh --all` | Compile both host and Android targets. This is the default. | Host and Android outputs |
Android ABI outputs:
- `app/src/main/jniLibs/arm64-v8a/libgit.so`
- `app/src/main/jniLibs/armeabi-v7a/libgit.so`
- `app/src/main/jniLibs/x86/libgit.so`
- `app/src/main/jniLibs/x86_64/libgit.so`
The `--test` tooling command automatically runs `CompileGitForAllTargetPlatforms.sh --host` first and exports `GITHUG_TEST_GIT_BINARY=build/host-git/libgit.so`. This keeps JVM tests on the same `GitRepositoryRuntime` path as the app, including the packaged-runtime helper resolution behavior.
The `--compile-git` tooling command is a convenience wrapper for:
```bash
bash ./CompileGitForAllTargetPlatforms.sh --all
```
## Runtime Architecture
The command engine has two execution paths behind one app-facing runtime: