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

Initial rules_toolchain implementation #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

matts1
Copy link
Owner

@matts1 matts1 commented Jan 14, 2025

No description provided.

@matts1 matts1 force-pushed the push-zvlypmywpvpq branch 2 times, most recently from d901782 to 05cd210 Compare January 14, 2025 02:42
@matts1 matts1 changed the title Delete toolchains Update config Jan 14, 2025
@matts1 matts1 force-pushed the push-zvlypmywpvpq branch from 05cd210 to a4d5035 Compare January 14, 2025 02:49
@matts1 matts1 changed the title Update config Initial rules_toolchain implementation Jan 14, 2025
@matts1 matts1 force-pushed the push-zvlypmywpvpq branch 8 times, most recently from 47fe0af to 6a10f53 Compare January 15, 2025 02:56
@matts1 matts1 requested a review from fmeum February 18, 2025 18:56
Copy link
Collaborator

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

I haven't looked at the actual implementation yet, but already have some comments on the API.

args_add_strings(
name = "subcommand_compile",
actions = ["//lang/toolchain/actions:compile"],
env = {"LANG_ACTION_TYPE": "compile"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Slightly confusing to see env on args_add_strings. How does this relate to the added string values?

Copy link
Owner Author

Choose a reason for hiding this comment

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

env is on all args_add_*, not just args_add_strings. This is a bit of a legacy from the C++ toolchains' flags, which support both args and env. I'm open to changing this. I could create a new rule args_set_env or something similar if you'd prefer, and remove the flag from elsewhere?

"//lang/toolchain/features:feature1",
],
# If you have tools such as clang which have seperate binaries per exec-target pair (eg. gcc-<exec>-<target>),
# you can perform a select here over the target platform, then perform a select over the exec platform in the tool.
Copy link
Collaborator

Choose a reason for hiding this comment

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

As discussed for rules_cc, this won't work. Since we control the toolchain, could we expose a single exec attr in the right place in which users can use select on the exec platform?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I came up with an alternative approach to this which I think I prefer. I took inspiration from bazel-lib, and changed it so that the user will explicitly say "I support platform x and platform y", and then it will automatically perform a transition to platform x and y respectively (not the exec platform, which as we've determined in that other bug, is different to those).

What do you think?

@fmeum
Copy link
Collaborator

fmeum commented Feb 24, 2025

@matts1 As a general comment, please don't force push massive PRs as GitHub's review UI just doesn't work well in that case.

@matts1
Copy link
Owner Author

matts1 commented Feb 24, 2025

Sorry, I'm used to the amend model rather than the "stack additional commits" model that github prefers, and only realized once I'd already amended the big commit. I tried to put most of the important changes in a seperate commit, so the force push of the original commit should only have a few lines of mostly trivial changes.

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.

2 participants