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

Integrate the new Rust ArgSplitter. #21824

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Jan 11, 2025

Replaces the implementation of the Python ArgSplitter
with a call to the Rust one.

But the Python ArgSplitter class still exists (for now)
as a thin wrapper, primarily to show that its tests
still pass.

A future change may rip it out entirely and call
ArgSplitter exclusively from other Rust code.

@benjyw benjyw added the category:internal CI, fixes for not-yet-released features, etc. label Jan 11, 2025
@benjyw benjyw requested review from tdyas and huonw January 11, 2025 01:58
@@ -188,73 +114,25 @@ def add_goal(scope: str) -> str:
f"The {si.deprecated_scope} goal was renamed to {si.subsystem_cls.options_scope}",
)

if (si.is_builtin or si.is_auxiliary) and (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Rust side doesn't (yet) know about builtin or auxiliary goals, so we need this logic here. Note that it's copied directly from the deleted block above.

@@ -65,49 +64,6 @@ def assert_unknown_goal(splitter: ArgSplitter, args_str: str, unknown_goals: lis
assert set(unknown_goals) == set(split_args.unknown_goals)


def test_is_spec(tmp_path: Path, splitter: ArgSplitter, known_scope_infos: list[ScopeInfo]) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test was ported to Rust, and since we no longer need a Python likely_a_spec() method, we also don't need to test it separately.

builtin_or_auxiliary_goal: str | None = None
canonical_goals = []
for goal in native_split_args.goals():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rust returns a string-valued goal name, here we get a ScopeInfo instance for it.

@benjyw benjyw merged commit ca8a5a5 into pantsbuild:main Jan 11, 2025
24 checks passed
@benjyw benjyw deleted the integrate_native_arg_splitter branch January 11, 2025 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants