From 3935b4e05c13528e5b8f4b99aea1962ab904a8ee Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 26 Aug 2020 16:09:04 +0200 Subject: Implement `root package is matched by empty string and the root keyword` test --- .../documentables/ModuleAndPackageDocumentationReader.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugins/base/src/main') diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt index 4900e9a8..e712d6e5 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt @@ -56,6 +56,13 @@ private class ContextModuleAndPackageDocumentationReader( } } + private val ModuleAndPackageDocumentationFragment.canonicalPackageName: String + get() { + check(classifier == Classifier.Package) + if (name == "[root]") return "" + return name + } + override fun get(module: DModule): SourceSetDependent { return findDocumentationNodes(module.sourceSets) { fragment -> fragment.classifier == Classifier.Module && ( @@ -68,8 +75,7 @@ private class ContextModuleAndPackageDocumentationReader( override fun get(pkg: DPackage): SourceSetDependent { return findDocumentationNodes(pkg.sourceSets) { fragment -> - // TODO NOW: handle JS Root thing - fragment.classifier == Classifier.Package && fragment.name == pkg.dri.packageName + fragment.classifier == Classifier.Package && fragment.canonicalPackageName == pkg.dri.packageName } } } -- cgit