Repository navigation
feat(build): make debug builds installable beside release, with a badged icon - #21
Merged
Merged
Conversation
…ged icon Our own test builds were indistinguishable from the release on the home screen and could not be installed next to it. The debug build type now has: - its own package (applicationIdSuffix .debug), so data, runtime and server password are separate from the release install - its own local OpenCode port (4099), set through a BuildConfig override of the runtime manifest's port rather than a copied manifest, so the OpenCode version and checksums stay single-sourced - a "-debug" versionName suffix and the label "DoubleCode Debug" - an amber bug badge on the launcher icon, also on the themed (monochrome) icon, placed inside the adaptive-icon safe zone The CI debug APK attached to releases changes package with this, so it no longer upgrades an older debug install that used the release package.
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.
Our own test builds looked identical to the release on the home screen and could not be installed beside it. This makes the debug build type a separate, recognisable app.
What changes in debug builds
applicationIdSuffix ".debug"): data, runtime and server password are kept apart from the release install.BuildConfig.LOCAL_RUNTIME_PORT_OVERRIDE, which replaces the runtime manifest's port when it is non-zero (release: 0). This avoids keeping a copied manifest, so the OpenCode version and checksums are defined in one place.-debugversion-name suffix, and the label "DoubleCode Debug" in all 8 locales.src/debug/res.Release builds are unchanged.
Side effect: the
-debug.apkattached to releases changes package too. It no longer upgrades an old debug install that used the release package. The README now says so.Verified
detekt spotlessCheck :app:lintGithubDebug :app:testGithubDebugUnitTest :app:assembleGithubDebugpasses, including all 1411 unit tests.com.doublepi123.andcode.debug,1.2.27-dp7-debug, "DoubleCode Debug".Pre-PR review
Reviewed at 73b23cd: APPROVE. Follow-up 3b5b74f applies the review's suggestions:
app_namecopiesReport:
判定: APPROVE
ブロッカー
なし
提案(非ブロッキング)
.github/workflows/release.yml:123/README.md:243,README.ja.md:243— リリースに添付されるand-code-$TAG-debug.apkのパッケージがcom.doublepi123.andcode.debugに変わります。旧 CI debug APK(パッケージcom.doublepi123.andcode、debug 鍵で署名)を使っていた人は、更新しても上書きされず、新しいアプリとして初期状態から始まります。runtime・パスワード・設定は引き継がれません。リリースノートか README の「Install to device」に、debug は別アプリとして並んで入ることを一行足すと親切です。127.0.0.1:1455(docs/CODEX.md:196)と Antigravity の localhost リダイレクトです。debug 版と release 版で同時にサインインすると衝突する可能性があります。めったに起きませんが、docs/などに「同時サインインは不可」と書いておくとよいです。.and-code/browser-command.jsonを両方のGuestBrowserCommandWatcher(feature/browser/BrowserCommandWatcher.kt:29-40)がポーリングします。先に読んだ側がコマンドを消費します。これも同時利用時だけの話で、今回の対応範囲外として問題ありません。app/src/debug/res/values-*/strings.xml— locale 別ファイルが必要な理由は、main 側のvalues-jaなどのapp_nameが debug のvalues/より優先されるためです。この理由は自明ではないので、values/strings.xmlのコメントに一行あると、後で「重複だから」と消されるのを防げます。なおtranslatable="false"を locale ファイルに付けると lintExtraTranslationに当たることがあります。報告どおりlintGithubDebugが通っているなら問題ありません。チェック済み項目
git diffは実行できませんでした。代わりに、変更概要にあるファイルを worktree 上で直接読んで確認しました。全 hunk を diff で通読したわけではありません。app/build.gradle.kts:131-132,184-191を確認。defaultConfig はLOCAL_RUNTIME_PORT_OVERRIDE=0、debug はapplicationIdSuffix ".debug"/versionNameSuffix "-debug"/4099です。release には設定がなく、release の挙動は変わりません。LocalRuntimeManifest.kt:22,61,68を確認。上書きはvalidate()の前に適用されるので、4099 にも範囲チェックがかかります。LocalRuntimeManifestReaderを作っているのはLocalRuntimeInstaller.kt:21だけで、manifestReader.read()(:82、port は :206 の metadata に書かれる)とmanifestReader::port(:272)の両方に上書きが効きます。LocalRuntimePort.kt:42-44は metadata が厳密に 4097 のときだけ書き換えます。debug は別パッケージで新規インストールになり、metadata には 4099 が直接書かれるので移行は起きません。release(4098)にも影響しません。テストはLocalRuntimeManifestTest.kt:34-47に追加済みです。LocalOpenCodeBackend.kt:73、LocalRuntimeManager.kt:725、defaultServerOwnershipProbeはすべて metadata の port を使っています。findManagedRuntimeRootPids/findOpenCodeServerPids(LocalRuntimeProcessLauncher.kt:273-316)はruntimeDirectoryの絶対パス(パッケージ名を含む)で絞り込んでいます。debug から release の proot を誤って kill することはありません。androidx-startupの authorities は${applicationId}を使っているので衝突しません。FileProvider、<data>ディープリンク、カスタム<permission>は存在しません(rg で確認)。com.yugahashimoto.andcode.*固定ですが、問題ありません。PendingIntent はすべて明示コンポーネント(RuntimeNotificationHelper.kt:299、ScheduleManager.kt:134、QuickInputWidgetProvider.kt:35,48)です。唯一の暗黙ブロードキャスト(AndCodeVoiceInteractionService.kt:102-104)もsetPackage(context.packageName)で限定されていて、アプリ間で混ざりません。exported receiver はすべてexported="false"です。voice_interaction_service.xmlの FQCN はクラス名(namespace 側)なので suffix の影響を受けません。benchmark/build.gradle.kts:21-26はbenchmarkbuildType(fallback は release)だけを有効にしていて、debug の suffix は適用されません。packageName = "com.doublepi123.andcode"のハードコードはそのまま正しいです。GITHUB_CLIENT_IDは build config から渡されるので、パッケージ名の影響を受けません。i18n-check.yml:6,18,28が見るのはapp/src/main/resだけで、src/debugは対象外です。main のapp_nameは 8 ロケールすべてにそのまま残っていて CI は落ちません。debug 側にも 8 ロケール分のapp_name(translatable="false")があることを確認しました。mipmap-anydpi-v26/v33のic_launcher/ic_launcher_roundが main と同じ名前で上書きしていることを確認しました。v33 には monochrome レイヤもあります。layer-listが参照する@mipmap/ic_launcher_foreground/@mipmap/ic_launcher_monochromeは main に全密度分あります。バッジの vector は 108dp の viewport です。ReleaseMetadataTest.kt:12-14はBuildConfig.DEBUGで期待値を分けていて、testGithubDebugUnitTestと release 系テストの両方で通る形です。