Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolchain types should be aliasable #7404

Closed
brandjon opened this issue Feb 12, 2019 · 4 comments
Closed

Toolchain types should be aliasable #7404

brandjon opened this issue Feb 12, 2019 · 4 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug

Comments

@brandjon
Copy link
Member

Suppose you define a toolchain_type with label "//pkg:tt", and an alias that points to it named "//tt2". Then you should be able to use either //pkg:tt and //pkg:tt2interchangeably. This is important for smooth migration of toolchain_type definitions from one name/package/repository to another.

Currently this works for a toolchain target's toolchain_type attribute: When you specify //pkg:tt2, it retrieves the original ToolchainTypeInfo provider from the alias target and sees the original //pkg:tt label.

It does not work for a rule that declares a required toolchain type of //pkg:tt2. The problem can be traced back to the fact that ToolchainResolutionFunction directly compares the label of the requested toolchain type, when it should instead resolve this label to a configured target and retrieve the label in the ToolchainTypeInfo provider.

@brandjon brandjon added type: bug team-Configurability platforms, toolchains, cquery, select(), config transitions untriaged labels Feb 12, 2019
@brandjon
Copy link
Member Author

Note that once this is fixed, it would still not be expected that you can require a toolchain type under one name but retrieve it from ctx.toolchains under another.

@katre katre self-assigned this Feb 12, 2019
@katre katre added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Feb 12, 2019
@katre
Copy link
Member

katre commented Feb 12, 2019

This seems related to the concerns @aragos has about constraint values proliferating.

@brandjon
Copy link
Member Author

How so? I did a cursory check, and aliasing appears to be fully transparent to constraint values and constraint settings.

Or are you referring to the problem of explicitly merging two distinct constraint values that are not declared as aliases?

@katre
Copy link
Member

katre commented Feb 12, 2019

I meant the latter, which won't directly involve alias rules, but which is conceptually related.

katre added a commit to katre/bazel that referenced this issue May 17, 2019
This allows Bazel to validate toolchain types earleir, and to deal with
aliases to toolchain types.

Fixes bazelbuild#7404.
irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
This allows Bazel to validate toolchain types earleir, and to deal with
aliases to toolchain types.

Fixes bazelbuild#7404.

Closes bazelbuild#8381.

PiperOrigin-RevId: 248755418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants