Skip to content

fix issue #17132 in pants, created test case#23242

Open
Shubham-Developer02 wants to merge 1 commit intopantsbuild:mainfrom
Shubham-Developer02:shubham_issue_fix
Open

fix issue #17132 in pants, created test case#23242
Shubham-Developer02 wants to merge 1 commit intopantsbuild:mainfrom
Shubham-Developer02:shubham_issue_fix

Conversation

@Shubham-Developer02
Copy link
Copy Markdown

Title: Reject targets that register multiple SourcesField subclasses (#17132)

Description:
Pants assumes each target exposes at most one field in the SourcesField hierarchy (e.g. MultipleSourcesField, SingleSourceField). Call sites use tgt.get(SourcesField) and related APIs as if that field were unique. If a target type accidentally registers two or more such fields, behavior is ambiguous and hard to debug.

This change fails fast during target construction: Target.validate() now raises a clear InvalidFieldException (wrapped as InvalidTargetException by Target.init) when more than one registered field type subclasses SourcesField.

Fixes pantsbuild/pants#17132.

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.

Eagerly error if a target has multiple SourcesField fields

1 participant