-
Notifications
You must be signed in to change notification settings - Fork 55
Fix a bug where targets with multiple dependencies was only passed one dependency #98
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
Fix a bug where targets with multiple dependencies was only passed one dependency #98
Conversation
This means that flag/option specific API can leverage types instead of including "flag" or "option" in the API's name. This also means that a named option requires a value to create an argument. Co-authored-by: Sofía Rodríguez <sofia_rodriguez@apple.com>
Also, define `--dependency` as an array-of-values option. Co-authored-by: Sofía Rodríguez <sofia_rodriguez@apple.com>
…fixes would sometimes not extract a value.
@swift-ci please test |
Because we don't have a Swift 5.7 CI yet, I manually tested this with the
|
/// | ||
/// - Parameter names: The names of a command line option. | ||
/// - Returns: The extracted values for this command line option, in the order that they appear in the arguments list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment to match function signature:
/// Extracts the values for the command line argument.
///
/// Upon return, the arguments list no longer contains any elements that match any spelling of this command line option or its values.
///
/// - Parameter option: The command line option.
/// - Returns: The extracted values for this command line argument, in the order that they appear in the arguments list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 703f680
Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftDocCPluginUtilities/DocumentedPluginFlags/DocumentedArgument.swift
Outdated
Show resolved
Hide resolved
Co-authored-by: Sofía Rodríguez <sofia_rodriguez@apple.com>
@swift-ci please test |
Thanks for suggesting all those corrections and improvements to the documentation. I applied them in 703f680 together with a few more along the same lines. |
Bug/issue #, if applicable: #97
Summary
This fixes an issue where the plugin would only pass one
--dependency
value when building combined documentation.@sofiaromorales and I worked together on the initial fix and made some additional API refinements to the way that the plugin works with command line arguments to make it ensure that an option always has the same behavior at every call site and that an option can't accidentally be used as a flag or vice-versa.
After what Sofía and I worked on, I made some follow-up changes to use the
Flag
andOption
types in more places, move theinverseNames
intoFlag
, and useCommandLineArguments
for thedocc merge
arguments to avoid that direct[String]
manipulation.Dependencies
None.
Testing
Build combined documentation for a Swift package where at least one of the targets has more than once source dependency. For example;
Modify
IntegrationTests/Tests/Fixtures/TargetsWithDependencies
to depend on the local version of the plugin:Then, run
swift package generate-documentation --enable-experimental-combined-documentation --verbose
and inspect the build log.The
docc convert
call for the "Outer" target (which builds last because it depends on the other targets) should have two different--dependency
flags passed to it;.build/plugins/Swift-DocC/outputs/intermediates/InnerFirst.doccarchive
.build/plugins/Swift-DocC/outputs/intermediates/InnerSecond.doccarchive
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded[ ] Updated documentation if necessaryNot applicable