Skip to content

crate_universe: move build-script dep to extra_deps#4090

Open
ashi009 wants to merge 1 commit into
bazelbuild:mainfrom
ashi009:fix-self-buildscript-member-alias
Open

crate_universe: move build-script dep to extra_deps#4090
ashi009 wants to merge 1 commit into
bazelbuild:mainfrom
ashi009:fix-self-buildscript-member-alias

Conversation

@ashi009

@ashi009 ashi009 commented Jun 18, 2026

Copy link
Copy Markdown

Fixes #4089.

A crate with a build script depends on its own build_script_build target. That edge was stored in common_attrs.deps, which Context::workspace_member_deps() collects to emit crate-hub aliases — so a library crate with a build script got a dead crate-hub alias for itself.

Store the edge in common_attrs.extra_deps instead: workspace_member_deps() does not read extra_deps, so the self-reference no longer yields an alias. (extra_deps holds resolved labels, so the edge becomes a relative :build_script_build — same target, same package.)

@ashi009 ashi009 force-pushed the fix-self-buildscript-member-alias branch 2 times, most recently from 6bd7223 to 6375a24 Compare June 23, 2026 05:23
@ashi009 ashi009 changed the title crate_universe: don't alias a workspace member's own build script crate_universe: synthesize build-script edge at render time Jun 23, 2026
@ashi009 ashi009 force-pushed the fix-self-buildscript-member-alias branch 4 times, most recently from b249c70 to a26ab8f Compare June 23, 2026 07:15
@ashi009 ashi009 marked this pull request as draft June 23, 2026 07:15
@ashi009 ashi009 force-pushed the fix-self-buildscript-member-alias branch 2 times, most recently from 2130c41 to 4de1b19 Compare June 23, 2026 07:52
@ashi009 ashi009 changed the title crate_universe: synthesize build-script edge at render time crate_universe: reference a crate's own build script by relative label Jun 23, 2026
@ashi009 ashi009 force-pushed the fix-self-buildscript-member-alias branch from 4de1b19 to bb334f7 Compare June 23, 2026 07:54
@ashi009 ashi009 marked this pull request as ready for review June 23, 2026 08:03
@ashi009 ashi009 force-pushed the fix-self-buildscript-member-alias branch from bb334f7 to 8409390 Compare June 23, 2026 08:49
@ashi009 ashi009 changed the title crate_universe: reference a crate's own build script by relative label crate_universe: record a crate's own build-script dep in extra_deps, not deps Jun 23, 2026
A crate with a build script depends on its own `build_script_build` target. That
edge was stored in `common_attrs.deps`, which `Context::workspace_member_deps()`
collects to emit crate-hub aliases — so a library crate with a build script got a
dead crate-hub alias for itself.

Move it to `common_attrs.extra_deps`, which `workspace_member_deps()` does not
read, so the self-reference no longer yields an alias. `extra_deps` holds resolved
labels, so the edge becomes a relative `:build_script_build` (same target, same
package).

Fixes bazelbuild#4089.
@ashi009 ashi009 force-pushed the fix-self-buildscript-member-alias branch from 8409390 to c6b4a30 Compare June 23, 2026 08:52
@ashi009 ashi009 changed the title crate_universe: record a crate's own build-script dep in extra_deps, not deps crate_universe: move build-script dep to extra_deps Jun 23, 2026
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.

crate_universe: spurious hub alias for an rlib workspace member that has a build.rs

1 participant