mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 08:03:20 +00:00
`-PorcaInspectableRelease=true` marks the release variant debuggable through an Expo config plugin and flips a build config field the shell's inspection policy reads. The OS debuggable flag stays a hard requirement, so a shipped production APK can never be inspected regardless of the Gradle property. Default builds are byte-for-byte unchanged. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
const { withAppBuildGradle } = require('expo/config-plugins')
|
|
|
|
// Why: android/ is generated and gitignored, so the opt-in has to be reapplied on every prebuild.
|
|
const RELEASE_BLOCK = ' release {\n'
|
|
const DEBUGGABLE_LINE =
|
|
' // Dogfood opt-in: -PorcaInspectableRelease=true keeps the release bundle but marks the APK debuggable.\n' +
|
|
" debuggable = (findProperty('orcaInspectableRelease') ?: 'false').toBoolean()\n"
|
|
|
|
function addInspectableReleaseOptIn(contents) {
|
|
if (contents.includes('orcaInspectableRelease')) {
|
|
return contents
|
|
}
|
|
if (!contents.includes(RELEASE_BLOCK)) {
|
|
throw new Error('android app/build.gradle has no release buildType block to make inspectable')
|
|
}
|
|
return contents.replace(RELEASE_BLOCK, RELEASE_BLOCK + DEBUGGABLE_LINE)
|
|
}
|
|
|
|
module.exports = function withAndroidInspectableRelease(config) {
|
|
return withAppBuildGradle(config, (cfg) => {
|
|
cfg.modResults.contents = addInspectableReleaseOptIn(cfg.modResults.contents)
|
|
return cfg
|
|
})
|
|
}
|
|
|
|
module.exports.addInspectableReleaseOptIn = addInspectableReleaseOptIn
|