-
Notifications
You must be signed in to change notification settings - Fork 392
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
Add matchingRegex #598
Add matchingRegex #598
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,8 @@ fun PreMergeDocumentableTransformer.sourceSet(documentable: Documentable): Dokka | |
fun PreMergeDocumentableTransformer.perPackageOptions(documentable: Documentable): PackageOptions? { | ||
val packageName = documentable.dri.packageName ?: return null | ||
return sourceSet(documentable).perPackageOptions | ||
.sortedByDescending { packageOptions -> packageOptions.prefix.length } | ||
.firstOrNull { packageOptions -> packageName.startsWith(packageOptions.prefix) } | ||
.sortedByDescending { packageOptions -> packageOptions.matchingRegex.length } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels a bit awkward with regexes. I think I would prefer the order of the rules in the Gradle file to determine priority but I'll let people more familiar with the subject decide. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think ordering in Gradle might be more problematic and potentially could break easier. Also it will cause some confusion especially when having split logic for dokka configuration (eg. some packageOptions in buildSrc and some in Gradle build files), so I'd personally stick with the regex for now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point about split logic, especially since it's hard to know in advance the order of execution of Gradle scripts. I added a small note to the Gradle documentation to tell users that the longuest matchingRegexp will be used. For the |
||
.firstOrNull { packageOptions -> Regex(packageOptions.matchingRegex).matches(packageName) } | ||
} | ||
|
||
fun <T> PreMergeDocumentableTransformer.source(documentable: T) where T : Documentable, T : WithSources = | ||
|
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 think this check is now unnecessary as we dropped global settings and I see no reason why the regex could not be an
all match