ADFA-4636: Remove Kotlin/JS and Kotlin/Native backends from kt-android.jar#1506
ADFA-4636: Remove Kotlin/JS and Kotlin/Native backends from kt-android.jar#1506davidschachterADFA wants to merge 2 commits into
Conversation
…d.jar Adds excludeEntryPrefixes support to ExternalJarDependencyConfiguration and ExternalAssetsPlugin so that ZIP entries matching listed prefixes are stripped from a cached copy of the downloaded JAR before it is added as a dependency. Configures kotlin-analysis-api to strip all org/jetbrains/kotlin/js/ and org/jetbrains/kotlin/konan/ classes (794 entries, ~3.4 MB) since neither backend has any place in an Android IDE. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
📝 WalkthroughWalkthroughAdds configurable ZIP-entry filtering for external JAR dependencies. Matching entries are omitted into a cached ChangesExternal JAR stripping
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant jarDependency
participant stripJar
participant fileTree
jarDependency->>stripJar: prepare stripped JAR using excluded prefixes
stripJar->>stripJar: copy non-matching ZIP entries
jarDependency->>fileTree: include stripped JAR artifact
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/ExternalAssetsPlugin.kt (1)
88-88: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer suffix-safe derivation over
String.replace.
config.jarName.replace(".jar", "-stripped.jar")replaces every occurrence of.jarand silently produces an unmodified name if the file has no.jarextension. UseremoveSuffix/substringBeforeLastto target only the extension.- val stripped = cacheDir.resolve(config.jarName.replace(".jar", "-stripped.jar")) + val stripped = cacheDir.resolve("${config.jarName.removeSuffix(".jar")}-stripped.jar")🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/ExternalAssetsPlugin.kt` at line 88, In the stripped artifact path within the relevant asset-processing function, replace config.jarName.replace(".jar", "-stripped.jar") with suffix-safe logic that removes only a trailing .jar extension and appends -stripped.jar, using removeSuffix or substringBeforeLast; preserve the original basename and avoid replacing earlier occurrences or silently accepting an invalid extension.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/ExternalAssetsPlugin.kt`:
- Around line 104-107: Update the strip-cache logic in the relevant task or
function containing the dest/source timestamp check so changes to
excludeEntryPrefixes invalidate the existing stripped JAR. Persist a
deterministic hash or serialized representation of the prefix set alongside the
output, compare it during the up-to-date check, and regenerate the stripped
artifact when it differs while preserving the existing timestamp check.
- Around line 109-125: Update stripJar to write the stripped archive to a
temporary file in dest’s directory, using the existing ZIP stream logic against
that temp path. After successful completion, atomically move the temp file to
dest, with an appropriate fallback if atomic moves are unsupported; ensure
failures delete the temporary file and never leave a partial dest. Keep the
existing size calculation and logging based on the finalized destination.
---
Nitpick comments:
In
`@composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/ExternalAssetsPlugin.kt`:
- Line 88: In the stripped artifact path within the relevant asset-processing
function, replace config.jarName.replace(".jar", "-stripped.jar") with
suffix-safe logic that removes only a trailing .jar extension and appends
-stripped.jar, using removeSuffix or substringBeforeLast; preserve the original
basename and avoid replacing earlier occurrences or silently accepting an
invalid extension.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7a8d843c-21ea-4d0f-bc04-9a0a2b12618e
📒 Files selected for processing (3)
composite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/ExternalAssetsPlugin.ktcomposite-builds/build-logic/plugins/src/main/java/com/itsaky/androidide/plugins/extension/ExternalAssetsExtension.ktsubprojects/kotlin-analysis-api/build.gradle.kts
- Use removeSuffix(".jar") instead of replace(".jar", ...) so only the
trailing extension is affected, not any earlier occurrence in the name
- Add a .prefixes companion file alongside the stripped JAR so changes
to excludeEntryPrefixes invalidate the cached output even when the
source JAR mtime is unchanged
- Write to a .tmp file and atomically rename to dest on success; delete
the temp file on any failure to prevent partial output from being
treated as valid on subsequent builds
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
At the top of this PR, Claude Code's test plan says the APK should shrink by about 3.4 MB. In the interactive Claude session, an estimate of 274 kB was provided. I measured an actual reduction of 590 kB. |
Summary
excludeEntryPrefixessupport toExternalJarDependencyConfigurationandExternalAssetsPlugin, allowing ZIP entries matching listed prefixes to be stripped from a cached copy of a downloaded JAR before it is added as a dependencykotlin-analysis-apito strip allorg/jetbrains/kotlin/js/andorg/jetbrains/kotlin/konan/classes and their associatedMETA-INF/*.kotlin_moduleentries (794 entries, ~3.4 MB) — neither backend has any place in an Android IDETest plan
🤖 Generated with Claude Code