Skip to content

perf(dev): reuse staged iOS simulator bundle and complete mobile dev fast reload - #2555

Open
houko wants to merge 1 commit into
mainfrom
perf/dev-mobile-fast-reload-661
Open

houko wants to merge 1 commit into
mainfrom
perf/dev-mobile-fast-reload-661

Conversation

@houko

@houko houko commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Completes the mobile nsgo dev fast-reload work for #661 (building on #1655 for iOS simulator executable replacement and #1685 for Android -android-host):

  • iOS simulator (cmd/nsgo/ios.go, cmd/nsgo/iosdev.go):
    • Reuses the staged .app bundle on Go-only rebuilds: compiles and ad-hoc signs only the main executable (signIOSSimulatorBundle) instead of wiping .nsgo/dev/ios_simulator and repackaging resources, icons (actool), StoreKit/widgets/share/asset-downloader extensions and frameworks on every save.
    • Falls back automatically to a full buildIOSApp + simctl install when non-Go packaging inputs or Go-linked native frameworks (GhosttyVT, nsgo-natives.yaml v2 frameworks, notices) change, or when the app has an App Clip; keeps the staged bundle intact across failed Go compiles.
    • Tracks p.resourceRoot(), launch_screen (light/dark images), mobile.asset_packs, YAML translation catalogs (p.I18n.Dir), and app identity fields in iosSimulatorInputs.
  • Android -android-host (cmd/nsgo/android_host.go):
    • Tracks icon.android.png, launch_screen (light/dark images), YAML translation catalogs, p.resourceRoot(), app identity fields, and SHA-256 of nsgo.yaml in androidHostInputs.
    • Validates the forwarded port before storing it, and if the installed Activity was dismissed on the device before a Go-only rebuild, relaunches only the Activity (am start) without repackaging or running adb install.
  • Tests (cmd/nsgo/iosdev_test.go, cmd/nsgo/android_host_test.go):
    • Added TestIOSSimulatorDevReusesStagedBundle verifying staged bundle reuse (including codesign --verify --strict on macOS), compile-error recovery, framework-change fallback, and input-change full reinstall.
    • Added TestAndroidHostSessionFastReloadOverADB driving androidHostDev.build, start, and close against a fake adb binary to verify Go-only reloads skip APK packaging, adb install, and am start, Activity dismissal recovers without reinstalling, and resource changes trigger reinstall.
    • Expanded packaging input tracking tests for both iOS simulator and Android host modes.
  • Docs & changelog:

Verification

  • gofmt -l on all changed Go files: clean
  • go tool nsgo test ./cmd/nsgo -- -run "TestAndroid|TestIOS|TestDev": passed
  • go tool nsgo test ./internal/platform/android ./internal/moduletest: passed (including TestSkills and TestLayering)
  • go tool nsgo test -run TestRepositoryFragments ./tools/changelog: passed
  • go tool nsgo check -target macos,ios_simulator,android_arm64 -jobs 3 ./cmd/nsgo/...: passed
  • No changes to classes.dex or classes.jar (Android Java runtime already includes AndroidHostDev).

Fixes #661.

🤖 Gemini 4 Neon

@github-actions github-actions Bot added size/L documentation Improvements or additions to documentation cli and removed size/L labels Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nsgo dev on Android and the iOS simulator: a Go change repackages, reinstalls and relaunches the whole app instead of replacing the Go binary

1 participant