Skip to content

ADFA-2602: Resolve buildscript classpaths from the on-device Maven repo - #1646

Merged
Daniel-ADFA merged 2 commits into
stagefrom
task/ADFA-2602-offline-buildscript-repos
Sep 11, 2026
Merged

ADFA-2602: Resolve buildscript classpaths from the on-device Maven repo#1646
Daniel-ADFA merged 2 commits into
stagefrom
task/ADFA-2602-offline-buildscript-repos

Conversation

@Daniel-ADFA

Copy link
Copy Markdown
Contributor

COTGSettingsPlugin injects the bundled repo into pluginManagement and
dependencyResolutionManagement only. A buildscript { } block resolves
against its own repositories, which nothing reached, so any project
declaring its build classpath that way could only be built online. That
is why plugin-template builds required network.

Inject the repo for both scopes, each before the script that consumes it
is evaluated:

  • beforeSettings, for a buildscript block in settings.gradle.kts
    (the plugin template declares AGP and Kotlin there)
  • beforeProject, for a buildscript block in build.gradle.kts

settingsEvaluated is too late: by then the settings buildscript classpath
has already resolved.

A missing repo is not fatal. The directory does not exist until onboarding
has installed the assets, and failing there would break every build before
that point.


Stack created with GitHub Stacks CLIGive Feedback 💬

COTGSettingsPlugin injects the bundled repo into pluginManagement and
dependencyResolutionManagement only. A `buildscript { }` block resolves
against its own repositories, which nothing reached, so any project
declaring its build classpath that way could only be built online. That
is why plugin-template builds required network.

Inject the repo for both scopes, each before the script that consumes it
is evaluated:

  - beforeSettings, for a buildscript block in settings.gradle.kts
    (the plugin template declares AGP and Kotlin there)
  - beforeProject, for a buildscript block in build.gradle.kts

settingsEvaluated is too late: by then the settings buildscript classpath
has already resolved.

A missing repo is not fatal. The directory does not exist until onboarding
has installed the assets, and failing there would break every build before
that point.

@itsaky-adfa itsaky-adfa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me so far.

Since this is a draft, I'll re-review when it's ready for review.

@Daniel-ADFA
Daniel-ADFA marked this pull request as ready for review August 11, 2026 13:59

@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 Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Summary
  • Injects the bundled on-device Maven repository into buildscript dependency resolution through beforeSettings and beforeProject.
  • Supports AGP and Kotlin buildscript dependencies without network access.
  • Skips missing repository directories and logs an informational message.
  • Risk: Repository injection changes buildscript dependency resolution and may affect repository precedence or dependency selection.

Walkthrough

The Gradle init script now injects the existing local Maven repository into settings- and project-level buildscript repositories. Missing repositories are logged and skipped.

Changes

Local Maven repository injection

Layer / File(s) Summary
Repository lookup and buildscript extensions
gradle-plugin/src/main/java/com/itsaky/androidide/gradle/COTGSettingsPlugin.kt
Adds settings- and project-level extensions. The extensions add the local Maven repository when it exists.
Lifecycle callback integration
gradle-plugin/src/main/java/com/itsaky/androidide/gradle/AndroidIDEInitScriptPlugin.kt
Registers beforeSettings and beforeProject callbacks that invoke the repository extensions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the issue and the main change: resolving buildscript classpaths from the on-device Maven repository.
Description check ✅ Passed The description explains why buildscript repository injection is needed and how the changes address settings and project builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/ADFA-2602-offline-buildscript-repos

A rabbit hops where Maven files lie,
And adds their path as builds pass by.
Settings and projects share the way,
Missing paths skip without delay.
“Build on,” says Bun, “and compile bright!”

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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
`@gradle-plugin/src/main/java/com/itsaky/androidide/gradle/COTGSettingsPlugin.kt`:
- Line 97: Update the missing-repository log in the beforeSettings/beforeProject
helper to use the parameterized Logger.info overload: keep the repository value
as a placeholder argument and pass MAVEN_LOCAL_REPOSITORY separately instead of
interpolating it into the message.
🪄 Autofix

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 Plus

Run ID: e799fca5-d220-4b64-b0b1-b463247aed47

📥 Commits

Reviewing files that changed from the base of the PR and between 62d5573 and 578f731.

📒 Files selected for processing (2)
  • gradle-plugin/src/main/java/com/itsaky/androidide/gradle/AndroidIDEInitScriptPlugin.kt
  • gradle-plugin/src/main/java/com/itsaky/androidide/gradle/COTGSettingsPlugin.kt

Brings the branch up to date with stage so the stacked merge can proceed;
GitHub refuses update-branch on a stacked PR.
@Daniel-ADFA
Daniel-ADFA merged commit 58200f5 into stage Sep 11, 2026
6 checks passed
@Daniel-ADFA
Daniel-ADFA deleted the task/ADFA-2602-offline-buildscript-repos branch September 11, 2026 06:22
Daniel-ADFA pushed a commit that referenced this pull request Sep 11, 2026
Brings the branch up to date with stage (including #1646) so the stacked merge
can proceed; GitHub refuses update-branch on a stacked PR.
Daniel-ADFA pushed a commit that referenced this pull request Sep 11, 2026
Brings the branch up to date with stage (including #1646 and #1647) so the
stacked merge can proceed; GitHub refuses update-branch on a stacked PR.
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.

3 participants