-
Notifications
You must be signed in to change notification settings - Fork 56
Add symbolGraphMinimumAccessLevel option support #82
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
Conversation
1c49dd8
to
a32a9d8
Compare
@swift-ci please test |
As the individual who opened #11, I'm hugely in favor of this. I don't know what the intended pattern is in calling a command line option "experimental", but since this has a stable part of the API of DocC for some time, and is actively used and adjusted with "OTHER DOCC FLAGS" in a number of places, I'd very much prefer to drop the "experimental" from the CLI option. |
Oh, I think we'll eventually not need experimental too. It's the suggestion I got from @ethan-kusters on swift-docc Slack channel.
|
Thanks for opening this PR @Kyle-Ye! I'll be reviewing this in the upcoming days :) |
|
||
extension Arguments { | ||
/// The symbol graph minimum access level, if any, described by this set of command-line arguments. | ||
public var symbolGraphMinimumAccessLevel: String? { |
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.
Would it make sense for this property to return SymbolGraphOptions.AccessLevel?
instead? That way the two call sites wouldn't need to use .flatMap { .init(rawValue: $0) }
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.
I'd like to. But SymbolGraphOptions.AccessLevel
is defined in a module we can't access here.
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.
I see. Should we move this into SharedPackagePluginExtensions then so that it can access the necessary types?
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.
- This is an alignment with
Arguments+outputPath.swift
. - If we move this into
SharedPackagePluginExtensions
, we could not accessCommandLineOption
anymore unless we moveCommandLineOption
too or removeCommandLineOption.symbolGraphMinimumAccessLevel
dependency. - But in general, I agree your idea here.
Tests/SwiftDocCPluginUtilitiesTests/ArgumentsSymbolGraphMinimumAccessLevelTests.swift
Outdated
Show resolved
Hide resolved
|
||
/// Specifies the symbol graph minimum access level. | ||
static let symbolGraphMinimumAccessLevel = CommandLineOption( | ||
defaultName: "--experimental-symbol-graph-minimum-access-level" |
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.
One comment and a question:
- I don't think this needs to say "experimental".
- Should we also define this in a
PluginFlag
so that it is listed in theswift package generate-documentation --help
output as a "plugin option"?
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.
I don't think this needs to say "experimental".
+1 for this.
A PR would be great! Maybe we should start with an --experimental prefixed flag?
What do you think about it? cc @ethan-kusters
Should we also define this in a PluginFlag so that it is listed in the swift package generate-documentation --help output as a "plugin option"?
I will give some check on this part.
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.
I don't think this needs to say "experimental".
Fixed.
Should we also define this in a PluginFlag so that it is listed in the swift package generate-documentation --help output as a "plugin option"?
I remember I tried it at the first time. But I forgot what is stopping me to use it.
Any updates on this? I'd love to adopt it in swift-mmio |
I'll take some time later this week to resolve the feedback I receive from the reviewers. |
There isn't any blocking feedback. I'd be happy to merge this as is and look at surfacing the new flag in the help text in a later PR. |
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.
LGTM
Can we rebase and merge this? |
a32a9d8
to
87e893c
Compare
Not have time to address all the PR comments. Maybe we can address them later since they are implementation details and there are downstream usage waiting this PR.
Done. I'd like to request @d-ronnqvist for a final approval since I removed experimental prefix. |
@swift-ci please test |
I'll take a look later today |
87e893c
to
22c8086
Compare
@swift-ci please test |
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.
LGTM
Bug/issue #, if applicable:
Close #11
Summary
Add symbolGraphMinimumAccessLevel option support.
The current behavior for it is for library target we assume it to be
public
and for executable target we assume it to beinternal
implemented indefaultSymbolGraphOptions
.I propose to add
symbol-graph-minimum-access-level
option in command line so that we can opt-out the defaultinternal
behavior for executable target.The usage is we want to documentation the executable target via docc bundle but we do not want to expose the internal symbol graph into the documentation.
See apple/swift-mmio#104 (comment)
Dependencies
None
Testing
See ArgumentsSymbolGraphMinimumAccessLevelTests.swift
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeededOther Link