Skip to content

Fix ArgumentExtractor implementation bug #4287

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

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

Kyle-Ye
Copy link
Contributor

@Kyle-Ye Kyle-Ye commented Apr 9, 2022

Fix ArgumentExtractor implementation bug

Motivation:

swift-docc-plugin uses the PackagePlugin API and support generate-documentation action.

If we run

swift package --allow-writing-to-directory ./docs \
    generate-documentation --target SymbolKit --output-path ./docs

It will be fine.
However if we run

swift package --allow-writing-to-directory ./docs \
    generate-documentation --target=SymbolKit --output-path ./docs

It will loop infinitely.

And the core reason seems to be the ArgumentExtractor implementation in PackagePlugin Package.

Modifications:

  • Fix the ArgumentExtractor implementation bug
  • Add testExtractOption for ArgumentExtractor

Result:

When using --<name>=<value> form to specify the argument, the Plugin will no long loop infinitely.

Other consideration

I think this should be cherry-picked into release/5.7
But should it be cherry-picked into release/5.6.2?
cc @tomerd @abertelrud

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Apr 9, 2022

@swift-ci please test

@Kyle-Ye Kyle-Ye requested a review from ethan-kusters April 10, 2022 08:41
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Apr 10, 2022

/// Extracts options of the form --<name> <value> or --<name>=<value> from the remaining arguments, and returns the extracted values.

Due to the implementation issue of ArgumentExtractor, currently we can not use --<name>=<value> form successfully as the comments says cc @ethan-kusters

@abertelrud
Copy link
Contributor

Thank you very much for the fix @Kyle-Ye! Yes, it should definitely be nominated for 5.7. The bar is probably quite high for 5.6.2 as I understand it.

@abertelrud
Copy link
Contributor

@swift-ci please smoke test

@Kyle-Ye Kyle-Ye force-pushed the argument-extractor-fix branch from b02d952 to 249c947 Compare April 11, 2022 04:19
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Apr 11, 2022

Swift 5.6 #4289
Swift 5.7 #4288

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Apr 11, 2022

@swift-ci please smoke test

@abertelrud abertelrud merged commit 35e5151 into swiftlang:main Apr 11, 2022
@Kyle-Ye Kyle-Ye deleted the argument-extractor-fix branch April 11, 2022 17:23
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