Skip to content

Fix exception thrown from BaseDirFileResolver when Tooling API receives a relative project directory#37762

Merged
eskatos merged 1 commit into
gradle:releasefrom
joshfriend:fix/daemon-toolchain-relative-path-basedir
May 6, 2026
Merged

Fix exception thrown from BaseDirFileResolver when Tooling API receives a relative project directory#37762
eskatos merged 1 commit into
gradle:releasefrom
joshfriend:fix/daemon-toolchain-relative-path-basedir

Conversation

@joshfriend

Copy link
Copy Markdown
Contributor

PR #32894 introduced a regression where DaemonClientToolchainServices passes getRootDirectory() directly to BaseDirFileResolver, which requires an absolute path. When the Tooling API is invoked with a relative project directory (e.g. File(".")), this throws:

IllegalArgumentException: base dir '.' is not an absolute file.

Context

This affects any Tooling API consumer that connects with a relative or default project directory, such as block/artifact-swap which defaults --dir to Path(".") here.

Contributor Checklist

  • Review Contribution Guidelines.
  • Make sure that all commits are signed off to indicate that you agree to the terms of Developer Certificate of Origin.
  • Make sure all contributed code can be distributed under the terms of the Apache License 2.0, e.g. the code was written by yourself or the original code is licensed under a license compatible to Apache License 2.0.
  • Check "Allow edit from maintainers" option in pull request so that additional changes can be pushed by Gradle team.
  • Provide integration tests (under <subproject>/src/integTest) to verify changes from a user perspective.
  • Provide unit tests (under <subproject>/src/test) to verify logic.
  • Update User Guide, DSL Reference, and Javadoc for public-facing changes.
  • Ensure that tests pass sanity check: ./gradlew sanityCheck.
  • Ensure that tests pass locally: ./gradlew <changed-subproject>:quickTest.

Reviewing cheatsheet

Before merging the PR, comments starting with

  • ❌ ❓must be fixed
  • 🤔 💅 should be fixed
  • 💭 may be fixed
  • 🎉 celebrate happy things

@joshfriend joshfriend requested review from a team as code owners April 30, 2026 19:04
@joshfriend joshfriend requested review from asodja, bamboo and h0tk3y and removed request for a team April 30, 2026 19:04
@bot-gradle bot-gradle added from:contributor PR by an external contributor to-triage labels Apr 30, 2026
@joshfriend joshfriend force-pushed the fix/daemon-toolchain-relative-path-basedir branch from ecd6dbd to e7d987c Compare April 30, 2026 19:06
@reinsch82

Copy link
Copy Markdown
Member

@bot-gradle test this

@bot-gradle

This comment has been minimized.

@bot-gradle

Copy link
Copy Markdown
Collaborator

The following builds have passed:

@ljacomet

ljacomet commented May 4, 2026

Copy link
Copy Markdown
Member

Thank you for your proposed contribution!

This PR has a valid DCO and tests. The relevant team for this area will confirm the implementation choices.


Given that #32894 was included in 9.5.0, should we consider this for a potential 9.5.1? Does it make a patch release necessary on its own?

@ljacomet ljacomet added this to the 9.6.0 RC1 milestone May 4, 2026
@ljacomet ljacomet added in:tooling-api 👋 team-triage Issues that need to be triaged by a specific team and removed to-triage labels May 4, 2026
@reinsch82 reinsch82 modified the milestones: 9.6.0 RC1, 9.5.1 May 5, 2026
@reinsch82

Copy link
Copy Markdown
Member

We agree this mandates a 9.5.1.

@joshfriend Can you please put this PR on top of the release branch?

@eskatos eskatos self-assigned this May 5, 2026
@reinsch82 reinsch82 removed the 👋 team-triage Issues that need to be triaged by a specific team label May 5, 2026
@eskatos eskatos linked an issue May 5, 2026 that may be closed by this pull request
…ives a relative project directory

PR gradle#32894 introduced a regression where `DaemonClientToolchainServices`
passes `getRootDirectory()` directly to `BaseDirFileResolver`, which
requires an absolute path. When the Tooling API is invoked with a relative
project directory (e.g. `File(".")`), this throws:

    IllegalArgumentException: base dir '.' is not an absolute file.

This affects any Tooling API consumer that connects with a relative or
default project directory, such as block/artifact-swap which defaults
`--dir` to `Path(".")`:
https://github.com/block/artifact-swap/blob/v0.1.12/cli/src/main/kotlin/xyz/block/artifactswap/cli/options/CommonOptions.kt#L14-L18

Signed-off-by: Josh Friend <jfriend@block.xyz>
@joshfriend joshfriend force-pushed the fix/daemon-toolchain-relative-path-basedir branch from e7d987c to c0e5e4a Compare May 5, 2026 20:36
@joshfriend joshfriend requested review from a team as code owners May 5, 2026 20:36
@joshfriend joshfriend changed the base branch from master to release May 5, 2026 20:37
@joshfriend

Copy link
Copy Markdown
Contributor Author

Can you please put this PR on top of the release branch?

done

@cobexer cobexer removed the request for review from a team May 6, 2026 07:09
@eskatos eskatos added this pull request to the merge queue May 6, 2026
Merged via the queue into gradle:release with commit 4fd85da May 6, 2026
20 of 21 checks passed
@joshfriend joshfriend deleted the fix/daemon-toolchain-relative-path-basedir branch May 6, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:contributor PR by an external contributor in:tooling-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tooling API can't be used with a relative project directory in 9.5.0

6 participants