Skip to content

ADFA-7220: Store Maven repo files under the .module url name - #2286

Merged
davidschachterADFA merged 3 commits into
stagefrom
fix/ADFA-7220-maven-url-names
Nov 21, 2026
Merged

davidschachterADFA merged 3 commits into
stagefrom
fix/ADFA-7220-maven-url-names

Conversation

@davidschachterADFA

@davidschachterADFA davidschachterADFA commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

ADFA-7220

On stage, cacheToLocalMavenRepo copies each file from a Gradle module cache under its cache file name. But Gradle's cache keeps a file under the name its .module metadata gives it, while a build asks the repository for the url. For androidx.lifecycle:lifecycle-viewmodel-android:2.9.4 they differ: lifecycle-viewmodel-release.aar against lifecycle-viewmodel-android-2.9.4.aar. A repository this task makes therefore fails offline builds with "Could not find". The ADFA-7082 offline test hit exactly this in dev-assets' copy of the logic, which dev-assets #81 fixed.

Change

  • Reformat only: the first commit, style: spotless reformat, no functional change, is Spotless's ratchet reindenting build-logic/common/build.gradle.kts (2 spaces to tabs) once the file is touched. Its git diff -w is empty, so review can skip it.
  • renameFilesToModuleUrls() in composite-builds/build-logic/common (com.itsaky.androidide.build.maven), a port of dev-assets' reviewed rename_files_to_module_urls. convertCacheToLocalMavenRepo calls it after the copy.
    • It stores each variant file under its url when that differs from its name and has no slash.
    • It removes the name copy unless another variant serves the file under that name.
    • A missing file, an existing url file, or a .module of an unexpected shape is left alone.
    • It parses JSON with Groovy's JsonSlurper, which gradleApi() already provides, so there's no new dependency.
    • build-logic/common gains JUnit 4 and Truth test dependencies, as build-logic/desugaring has.

Tests

  • ModuleUrlNamesTest ports the seven cases of dev-assets' scripts/tests/test-cache-to-local-maven-repo.py. At a0b1b77, ./gradlew :build-logic:common:test runs 8 of 8 passing (seven ported cases, plus one that a .module that is not JSON stops the conversion with an error naming the file).
  • Without the fix (the function's body stubbed to return emptyList()), the three rename cases fail: "a file takes its module url name", "a name another variant serves is kept", and "one name serves two urls". The four "leave it alone" cases pass either way.
  • End to end: I ran ./gradlew cacheToLocalMavenRepo on a module cache holding lifecycle-viewmodel-android 2.9.4 as Gradle stores it (the .module, .pom and lifecycle-viewmodel-release.aar in separate hash directories). The repository it writes has lifecycle-viewmodel-android-2.9.4.aar and no lifecycle-viewmodel-release.aar (acceptance criterion 1).

Notes

  • No workflow in .github/workflows runs :build-logic:common:test, so the results above are local.
  • Acceptance criterion 4, updating dev-assets' CLAUDE.md so it no longer lists this as a difference from the CoGo task, is a one-line dev-assets PR. I'll open it once this merges, so dev-assets doesn't describe unmerged code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw


Code Reviewer: Code Reviewer couldn't review this pull request
The pull request author does not have access to AI for the associated Atlassian organization.

davidschachterADFA and others added 2 commits November 20, 2026 18:21
Spotless's ratchet reformats composite-builds/build-logic/common/build.gradle.kts
in full (2-space indent to tabs) once ADFA-7220 touches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw
cacheToLocalMavenRepo copied each file from a Gradle module cache under its
cache file name. Gradle's cache keeps a file under the "name" its .module
metadata gives it, but a build asks the repository for the "url". For
androidx.lifecycle:lifecycle-viewmodel-android:2.9.4 they differ
(lifecycle-viewmodel-release.aar against lifecycle-viewmodel-android-2.9.4.aar),
so a repository this task made failed offline builds with "Could not find".

renameFilesToModuleUrls() in build-logic/common, a port of dev-assets'
rename_files_to_module_urls (dev-assets #81), runs after the copy: it stores
each variant file under its url when that differs and has no slash, and
removes the name copy unless another variant serves that name.

ModuleUrlNamesTest ports dev-assets' seven cases: 7 of 7 pass, and with the
function stubbed out the three rename cases fail. Run end to end on a cache
holding lifecycle-viewmodel-android 2.9.4, cacheToLocalMavenRepo now writes
lifecycle-viewmodel-android-2.9.4.aar and no lifecycle-viewmodel-release.aar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

  • Adds renameFilesToModuleUrls() in composite-builds/build-logic/common. convertCacheToLocalMavenRepo calls it after copying files.
  • Renames a copied file to its .module url when the url differs from name and contains no /.
  • Keeps the name copy only when another variant serves that file under that name.
  • Leaves missing files, existing url files, and unexpected .module shapes unchanged.
  • Targets the local mismatch where cached lifecycle-viewmodel-release.aar did not match the requested lifecycle-viewmodel-android-2.9.4.aar.
  • Adds JUnit and Google Truth test dependencies, and ModuleUrlNamesTest with eight test methods.

Risks and best-practice concerns:

  • The function deletes copied source files. It has no dry-run or confirmation step.
  • Malformed .module JSON throws IllegalStateException and stops conversion.
  • Tests ran locally only (:build-logic:common:test, 8 of 8 reported). No CI workflow runs this task.
  • The end-to-end result is a local run, not a recorded artifact.
  • Acceptance criterion 4 (dev-assets CLAUDE.md update) is deferred to a separate PR.

The build logic adds a utility that reads Gradle .module metadata and aligns eligible artifact filenames with metadata URLs. The cache conversion task invokes it after copying cached files and logs its messages. JUnit and Google Truth dependencies and tests are added.

Changes: Module URL Filename Alignment

Layer / File(s) Summary
Module metadata URL mapping
composite-builds/build-logic/common/src/main/java/com/itsaky/androidide/build/maven/ModuleUrlNames.kt, composite-builds/build-logic/common/build.gradle.kts, composite-builds/build-logic/common/src/test/java/com/itsaky/androidide/build/maven/ModuleUrlNamesTest.kt
Adds renameFilesToModuleUrls to copy eligible sibling files to metadata URL names and remove copied source names not referenced by a URL in that module. Adds JUnit and Google Truth test dependencies and tests for mappings, retained files, external URLs, and malformed metadata.
Cache conversion integration
build.gradle.kts
Calls renameFilesToModuleUrls after copying cache files into the local repository layout and logs the returned messages.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CacheConversion
  participant LocalMavenRepository
  participant renameFilesToModuleUrls
  CacheConversion->>LocalMavenRepository: Copy eligible cache files
  CacheConversion->>renameFilesToModuleUrls: Pass repository path
  renameFilesToModuleUrls->>LocalMavenRepository: Scan metadata and copy or remove files
  renameFilesToModuleUrls-->>CacheConversion: Return rename messages
  CacheConversion->>CacheConversion: Log messages
Loading

Suggested reviewers: itsaky-adfa

Merge Risk: Minimal · up to a0b1b

This change stores local Maven repository files under the filenames the module metadata requests. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "ADFA-7220: Store Maven repo files under the .module url name" matches the main change. The PR adds renameFilesToModuleUrls() and calls it from convertCacheToLocalMavenRepo so that variant f…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is specific and on-topic. It names the ADFA-7220 issue, explains that the cache file name differs from the URL name in the .module metadata, and gives the lifecycle-viewmodel example. …
Full details: Title check

Explanation

The title "ADFA-7220: Store Maven repo files under the .module url name" matches the main change. The PR adds renameFilesToModuleUrls() and calls it from convertCacheToLocalMavenRepo so that variant files are stored under the .module url name. The title names the ticket and the primary behavior change.

Full details: Description check

Explanation

The description is specific and on-topic. It names the ADFA-7220 issue, explains that the cache file name differs from the URL name in the .module metadata, and gives the lifecycle-viewmodel example. It lists the changes: the Spotless reformat commit, the renameFilesToModuleUrls() function, the JUnit and Truth test dependencies, and ModuleUrlNamesTest. It also reports test results and an end-to-end run.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each module name,
And maps the files the URLs claim.
It copies what the paths describe,
Keeps shared names that still apply.
Tests watch each edge case closely,
Then logs each change quite promptly.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: f9863d6c-3326-46a0-a3d1-29770c8b5204
Commits

Reviewing files that changed from the base of the PR and between 18318a1 and a0b1b77.

Files selected for processing: 1

  • composite-builds/build-logic/common/src/test/java/com/itsaky/androidide/build/maven/ModuleUrlNamesTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 2 remain after this review.

…the conversion

renameFilesToModuleUrls() throws IllegalStateException naming the file
when a .module can't be parsed, as dev-assets' script exits; that path had
no test. 8 of 8 pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw
@davidschachterADFA
davidschachterADFA merged commit 0c04cab into stage Nov 21, 2026
5 checks passed
@davidschachterADFA
davidschachterADFA deleted the fix/ADFA-7220-maven-url-names branch November 21, 2026 21:01
davidschachterADFA added a commit that referenced this pull request Nov 22, 2026
…a49afd (ADFA-7220, ADFA-7200)

Stage moved by two commits: ADFA-7220 (#2286, Maven repo files stored under
the .module url name, in build-logic) and ADFA-7200 (#2285, sqlite-js 1.4.4).
No conflicts; this branch's own diff against stage is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
davidschachterADFA added a commit that referenced this pull request Nov 22, 2026
…137: #2259's review fixes and stage at 5a49afd

Brings in #2259's merge of stage (2d7c135: ADFA-7220 #2286, ADFA-7200
#2285) and #2259's five review fixes: the 1.5 s cap on server statements
on a database not in WAL mode (df22b7a), draining unread request input
before closing after an error reply (3a3d57a), the Kotlin unit tests in
CI (f683484), closing-only paths reported as not available (4ee1506)
and the sqlite_ name escape in get_stats (a522456).

No conflicts; subprojects/sqlite-debugger/README.md auto-merged (#2259
edits its Testing and lock paragraphs, this PR its "Not done yet" list).

Semantic checks: neither stage's two commits nor #2259's fixes touch a
Room database, entity or migration, so this PR's RecentProjectRoomDatabase
version 6 with migration5To6 stays the next version. This PR's own diff is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
davidschachterADFA added a commit that referenced this pull request Nov 22, 2026
…139: #2259's review fixes and stage at 5a49afd

Brings in #2260's merge-up (8b7c558) of #2259's stage merge (2d7c135: ADFA-7220 #2286, ADFA-7200 #2285) and #2259's five review fixes (a522456, 4ee1506, 3a3d57a, df22b7a, f683484). No conflicts; subprojects/sqlite-debugger/README.md auto-merged. This PR's own diff is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
davidschachterADFA added a commit that referenced this pull request Nov 22, 2026
…138: #2259's review fixes and stage at 5a49afd

Brings in #2259's merge of stage (2d7c135: ADFA-7220 #2286, ADFA-7200 #2285) and #2259's five review fixes (a522456, 4ee1506, 3a3d57a, df22b7a, f683484). No conflicts: .github/workflows/debug.yml auto-merged, with #2259's sqlite-debugger unit-test step after the :plugin-api tests and this PR's release-APK check after it; subprojects/sqlite-debugger/README.md auto-merged. This PR's own diff is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYT7GPoC2cDzo8LErn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants