chore: testkit API surface refactor + gomobile artefact regen#25
Merged
Conversation
…tatic The testkit had three places declaring the same ~20-parameter list: the constructor, a static `SimulatedBitboxPlatform.install()`, and the top-level `installSimulatedBitboxPlatform()`. Static and top-level did the same thing (build + assign to BitboxUsbPlatform.instance), so any new parameter had to land in three places. The static was unused (callers use the top-level function exclusively), so removed it. The remaining two-way duplication between constructor and top-level wrapper is structural in Dart — no way to forward named args generically without losing the IDE parameter hints that make the wrapper useful in the first place. Net: 66 lines deleted, one place to maintain per parameter is now two instead of three.
After the Go module rename to github.com/DFXswiss/bitbox_flutter (commit e81cf8c, v0.0.7), the checked-in gomobile artefacts still referenced the old konstantinullrich/... path in their generated header comments and JAR source files. The native binary code path itself was fine — Java package stays `api`, ObjC class names stay `Api*` — but the doc-strings drifted from the Go module statement. Regenerated both surfaces from go/api/ with the current toolchain: ios/Api.xcframework gomobile bind -target=ios,iossimulator -o ios/Api.xcframework ./api android/libs/api.aar + api-sources.jar gomobile bind -target=android -androidapi 24 -o android/libs/api.aar ./api All four iOS header files (Api.h + Api.objc.h × {arm64, simulator}) and the api-sources.jar now consistently reference github.com/DFXswiss/bitbox_flutter/api. JNI binaries refreshed for the same four Android architectures as before (armeabi-v7a, arm64-v8a, x86, x86_64); minor size delta from newer Go runtime + transitive dependencies. Verified post-regen: `grep -rln konstantinullrich .` returns nothing. Dart format / analyze --fatal-infos / flutter test / go vet + go test -race all green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two deferred follow-ups from the v0.5.0 / Go-module-rename work, both addressing consistency drift inside the testkit + native binding layer. Independent commits, related theme (post-rename housekeeping), bundled to share one CI run.
Commit 1 —
refactor(testing): drop redundant SimulatedBitboxPlatform.install() staticThe testkit had three places declaring the same ~20-parameter list:
the constructor, a static
SimulatedBitboxPlatform.install(), and the top-levelinstallSimulatedBitboxPlatform(). Static and top-level did the same thing (build + assign toBitboxUsbPlatform.instance), so any new parameter had to land in three places.Removed the static — callers use the top-level function exclusively. The remaining two-way duplication between constructor and top-level wrapper is structural in Dart (no way to forward named args generically without losing IDE parameter hints).
Net: 89 lines deleted, 38 inserted. From 3 maintenance points per parameter down to 2.
Commit 2 —
chore(bindings): regenerate gomobile artefacts with DFXswiss module pathAfter the Go module rename in v0.0.7, the checked-in iOS xcframework and Android
api-sources.jarstill referencedkonstantinullrich/...in their generated header comments. Binary code path was fine (Java package staysapi, ObjC class names stayApi*) but the docstrings drifted from thego/go.moddeclaration.Regenerated from
go/api/:ios/Api.xcframeworkviagomobile bind -target=ios,iossimulatorandroid/libs/api.aar+api-sources.jarviagomobile bind -target=android -androidapi 24All four iOS header files (
Api.{h,objc.h}× {arm64, simulator}) and the Android sources JAR now consistently referencegithub.com/DFXswiss/bitbox_flutter/api. JNI binaries refreshed for the four Android architectures (armeabi-v7a, arm64-v8a, x86, x86_64).Verified post-regen:
grep -rln konstantinullrich .returns nothing.Local validation
dart format --set-exit-if-changedflutter analyze --fatal-infosflutter testgo vet ./...+go test -race -timeout 60s ./...Closes deferred follow-ups