cxx_builtin_include_directories package resolution uses deprecated function
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
The logic which expands package directories for `cxx_builtin_include_directories` uses the deprecated `Label.relative` function [here](https://github.com/bazelbuild/bazel/blob/935bd263ec5912469d7d0f0abe54efc071018a32/src/main/starlark/builtins_bzl/common/cc/cc_toolchain_provider_helper.bzl#L130)
### Which category does this issue belong to?
C++ Rules
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
According to @Wyverald, this should cause issues when you have a package in a repo with `@` (for example, `"%package(@repo//foo/bar)%/baz/quux") when Bzlmod is enabled.
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
_No response_
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start in src/main/starlark/builtins_bzl/common/cc/cc_toolchain_provider_helper.bzl at the package-directory expansion that uses Label.relative. Check the referenced package form, such as "%package(@repo//foo/bar)%/baz/quux", with Bzlmod enabled. Done means package resolution no longer relies on the deprecated function and the example works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100