aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/psi
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-18 12:18:59 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-14 17:51:11 +0200
commiteae1ce49d18c2978b49166ea502bf2c109a85504 (patch)
tree477f39e33f14c71042f06eecc938d6efaa95e66c /plugins/base/src/main/kotlin/translators/psi
parent6c635551ed3ea0cfe5f04b54a98cb28225061d26 (diff)
downloaddokka-eae1ce49d18c2978b49166ea502bf2c109a85504.tar.gz
dokka-eae1ce49d18c2978b49166ea502bf2c109a85504.tar.bz2
dokka-eae1ce49d18c2978b49166ea502bf2c109a85504.zip
Simplify Dokka Gradle Plugin
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/psi')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt47
1 files changed, 31 insertions, 16 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 9ed37c30..cd43e635 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -43,8 +43,8 @@ class DefaultPsiToDocumentableTranslator(
override fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule {
- fun isFileInSourceRoots(file: File) : Boolean {
- return sourceSet.sourceRoots.any { root -> file.path.startsWith(File(root.path).absolutePath) }
+ fun isFileInSourceRoots(file: File): Boolean {
+ return sourceSet.sourceRoots.any { root -> file.startsWith(root.directory) }
}
val (environment, _) = kotlinAnalysis[sourceSet]
@@ -133,7 +133,7 @@ class DefaultPsiToDocumentableTranslator(
val superMethods = mutableListOf<Pair<PsiMethod, DRI>>()
methods.forEach { superMethodsKeys.add(it.hash) }
fun parseSupertypes(superTypes: Array<PsiClassType>, level: Int = 0) {
- if(superTypes.isEmpty()) return
+ if (superTypes.isEmpty()) return
val parsedClasses = superTypes.filter { !it.shouldBeIgnored }.mapNotNull {
it.resolve()?.let {
when {
@@ -178,7 +178,8 @@ class DefaultPsiToDocumentableTranslator(
}) + it.interfaces.map { DriWithKind(dri = it, kind = JavaClassKindTypes.INTERFACE) }
}.toSourceSetDependent()
val modifiers = getModifier().toSourceSetDependent()
- val implementedInterfacesExtra = ImplementedInterfaces(inheritanceTree.flatMap { it.interfaces }.distinct().toSourceSetDependent())
+ val implementedInterfacesExtra =
+ ImplementedInterfaces(inheritanceTree.flatMap { it.interfaces }.distinct().toSourceSetDependent())
return when {
isAnnotationType ->
DAnnotation(
@@ -195,8 +196,11 @@ class DefaultPsiToDocumentableTranslator(
constructors.map { parseFunction(it, true) },
mapTypeParameters(dri),
setOf(sourceSetData),
- PropertyContainer.withAll(implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
- .toAnnotations())
+ PropertyContainer.withAll(
+ implementedInterfacesExtra,
+ annotations.toList().toListOfAnnotations().toSourceSetDependent()
+ .toAnnotations()
+ )
)
isEnum -> DEnum(
dri,
@@ -211,8 +215,11 @@ class DefaultPsiToDocumentableTranslator(
emptyList(),
emptyList(),
setOf(sourceSetData),
- PropertyContainer.withAll(implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
- .toAnnotations())
+ PropertyContainer.withAll(
+ implementedInterfacesExtra,
+ annotations.toList().toListOfAnnotations().toSourceSetDependent()
+ .toAnnotations()
+ )
)
},
documentation,
@@ -226,8 +233,10 @@ class DefaultPsiToDocumentableTranslator(
constructors.map { parseFunction(it, true) },
ancestors,
setOf(sourceSetData),
- PropertyContainer.withAll(implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
- .toAnnotations())
+ PropertyContainer.withAll(
+ implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
+ .toAnnotations()
+ )
)
isInterface -> DInterface(
dri,
@@ -243,8 +252,10 @@ class DefaultPsiToDocumentableTranslator(
mapTypeParameters(dri),
ancestors,
setOf(sourceSetData),
- PropertyContainer.withAll(implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
- .toAnnotations())
+ PropertyContainer.withAll(
+ implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
+ .toAnnotations()
+ )
)
else -> DClass(
dri,
@@ -262,8 +273,10 @@ class DefaultPsiToDocumentableTranslator(
null,
modifiers,
setOf(sourceSetData),
- PropertyContainer.withAll(implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
- .toAnnotations())
+ PropertyContainer.withAll(
+ implementedInterfacesExtra, annotations.toList().toListOfAnnotations().toSourceSetDependent()
+ .toAnnotations()
+ )
)
}
}
@@ -305,7 +318,8 @@ class DefaultPsiToDocumentableTranslator(
PropertyContainer.withAll(
InheritedFunction(inheritedFrom.toSourceSetDependent()),
it.toSourceSetDependent().toAdditionalModifiers(),
- (psi.annotations.toList().toListOfAnnotations() + it.toListOfAnnotations()).toSourceSetDependent()
+ (psi.annotations.toList()
+ .toListOfAnnotations() + it.toListOfAnnotations()).toSourceSetDependent()
.toAnnotations()
)
}
@@ -434,7 +448,8 @@ class DefaultPsiToDocumentableTranslator(
psi.additionalExtras().let {
PropertyContainer.withAll<DProperty>(
it.toSourceSetDependent().toAdditionalModifiers(),
- (psi.annotations.toList().toListOfAnnotations() + it.toListOfAnnotations()).toSourceSetDependent()
+ (psi.annotations.toList()
+ .toListOfAnnotations() + it.toListOfAnnotations()).toSourceSetDependent()
.toAnnotations()
)
}