Skip to content

Commit

Permalink
Merge branch 'master' into bump-kotlinx-jvm
Browse files Browse the repository at this point in the history
  • Loading branch information
kamildoleglo committed Apr 6, 2021
2 parents 6de4d96 + cd071a5 commit fd1e4f0
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 79 deletions.
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/org/jetbrains/CrossPlatformExec.kt
Expand Up @@ -30,12 +30,12 @@ open class CrossPlatformExec : AbstractExecTask<CrossPlatformExec>(CrossPlatform
}

private fun findCommand(command: String): String {
val command = normalizeCommandPaths(command)
val normalizedCommand = normalizeCommandPaths(command)
val extensions = if (isWindows) windowsExtensions else unixExtensions

return extensions.map { extension ->
resolveCommandFromFile(Paths.get("$command$extension"))
}.firstOrNull { it.isNotBlank() } ?: command
resolveCommandFromFile(Paths.get("$normalizedCommand$extension"))
}.firstOrNull { it.isNotBlank() } ?: normalizedCommand
}

private fun resolveCommandFromFile(commandFile: Path) =
Expand All @@ -60,4 +60,4 @@ open class CrossPlatformExec : AbstractExecTask<CrossPlatformExec>(CrossPlatform
// then replace all forward slashes with whatever the separator actually is
.replace(forwardSlashSeparator, separator)
}
}
}
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Expand Up @@ -7,9 +7,9 @@ plugins {
}

dependencies {
api("org.jetbrains:markdown:0.2.0")
api("org.jetbrains:markdown:0.2.1")
implementation(kotlin("reflect"))
implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jsoup:jsoup:1.13.1")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.1")

Expand Down
10 changes: 5 additions & 5 deletions core/src/main/kotlin/DokkaBootstrapImpl.kt
Expand Up @@ -9,18 +9,18 @@ import java.util.function.BiConsumer
fun parsePerPackageOptions(args: List<String>): List<PackageOptions> = args.map { it.split(",") }.map {
val matchingRegex = it.first()

val args = it.subList(1, it.size)
val options = it.subList(1, it.size)

val deprecated = args.find { it.endsWith("skipDeprecated") }?.startsWith("+")
val deprecated = options.find { it.endsWith("skipDeprecated") }?.startsWith("+")
?: DokkaDefaults.skipDeprecated

val reportUndocumented = args.find { it.endsWith("reportUndocumented") }?.startsWith("+")
val reportUndocumented = options.find { it.endsWith("reportUndocumented") }?.startsWith("+")
?: DokkaDefaults.reportUndocumented

val privateApi = args.find { it.endsWith("includeNonPublic") }?.startsWith("+")
val privateApi = options.find { it.endsWith("includeNonPublic") }?.startsWith("+")
?: DokkaDefaults.includeNonPublic

val suppress = args.find { it.endsWith("suppress") }?.startsWith("+")
val suppress = options.find { it.endsWith("suppress") }?.startsWith("+")
?: DokkaDefaults.suppress

PackageOptionsImpl(
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/kotlin/pages/PageNodes.kt
Expand Up @@ -142,7 +142,7 @@ class MemberPageNode(
override val embeddedResources: List<String> = listOf()
) : MemberPage {
override fun modified(name: String, children: List<PageNode>): MemberPageNode =
modified(name = name, content = this.content, children = children) as MemberPageNode
modified(name = name, content = this.content, children = children)

override fun modified(
name: String,
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/kotlin/plugability/DokkaJavaPlugin.kt
Expand Up @@ -28,8 +28,8 @@ data class ExtensionBuilder<T: Any> internal constructor(
private val name: String,
private val ext: ExtensionPoint<T>,
private val action: LazyEvaluated<T>,
private val before: List<out Extension<*, *, *>>,
private val after: List<out Extension<*, *, *>>,
private val before: List<Extension<*, *, *>>,
private val after: List<Extension<*, *, *>>,
private val override: OverrideKind = OverrideKind.None,
private val conditions: List<(DokkaConfiguration) -> Boolean>
){
Expand Down Expand Up @@ -62,11 +62,11 @@ data class ExtensionBuilder<T: Any> internal constructor(

abstract class DokkaJavaPlugin: DokkaPlugin() {

fun <T: DokkaPlugin> plugin(clazz: Class<T>): T? =
fun <T: DokkaPlugin> plugin(clazz: Class<T>): T =
context?.plugin(clazz.kotlin) ?: throwIllegalQuery()


fun <T: Any> extend(func: (ExtensionBuilderStart) -> ExtensionBuilder<T>): Lazy<Extension<T, *, *>> =
lazy { func(ExtensionBuilderStart()).build() }.also { unsafeInstall(it) }

}
}
2 changes: 1 addition & 1 deletion docs/build.gradle.kts
@@ -1,3 +1,3 @@
plugins {
id("ru.vyarus.mkdocs") version "2.0.1"
id("ru.vyarus.mkdocs") version "2.1.1"
}
8 changes: 4 additions & 4 deletions gradle.properties
@@ -1,16 +1,16 @@
# Project Settings
dokka_version_base=1.4.30
dokka_version_base=1.4.32
dokka_publication_channels=bintray-kotlin-dev&space-dokka-dev
dokka_integration_test_parallelism=2
# Versions
kotlin_version=1.4.30
kotlin_version=1.4.32
coroutines_version=1.4.1
kotlinx_html_version=0.7.3
kotlin_plugin_version=202-1.4.30-release-IJ8194.7
kotlin_plugin_version=212-1.4.32-release-IJ1314
idea_version=202.7660.26
language_version=1.4
# Code style
kotlin.code.style=official
# Gradle settings
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
org.gradle.parallel=true
org.gradle.parallel=true
2 changes: 1 addition & 1 deletion integration-tests/build.gradle.kts
Expand Up @@ -61,6 +61,6 @@ dependencies {
api(project(":test-utils"))
val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jsoup:jsoup:1.13.1")
implementation("org.eclipse.jgit:org.eclipse.jgit:5.11.0.202103091610-r")
}
4 changes: 2 additions & 2 deletions kotlin-analysis/intellij-dependency/build.gradle.kts
Expand Up @@ -12,8 +12,8 @@ repositories {
maven(url = "https://www.jetbrains.com/intellij-repository/snapshots")
maven(url = "https://www.jetbrains.com/intellij-repository/releases")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide")
maven("https://kotlin.bintray.com/kotlin-ide-plugin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies")
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
}

val intellijCore: Configuration by configurations.creating
Expand Down
Expand Up @@ -98,6 +98,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl

fun createCoreEnvironment(): KotlinCoreEnvironment {
System.setProperty("idea.io.use.nio2", "true")
System.setProperty("idea.ignore.disabled.plugins", "true")

val configFiles = when (analysisPlatform) {
Platform.jvm, Platform.common -> EnvironmentConfigFiles.JVM_CONFIG_FILES
Expand Down
2 changes: 1 addition & 1 deletion plugins/all-modules-page/build.gradle.kts
Expand Up @@ -20,5 +20,5 @@ dependencies {
val kotlinx_html_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version")

implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jsoup:jsoup:1.13.1")
}
2 changes: 1 addition & 1 deletion plugins/base/base-test-utils/build.gradle.kts
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.registerDokkaArtifactPublication
dependencies {
compileOnly(project(":plugins:base"))
implementation(project(":core:test-api"))
implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jsoup:jsoup:1.13.1")
implementation(kotlin("test-junit"))
}

Expand Down
Expand Up @@ -86,7 +86,7 @@ class BaseTestBuilder : TestBuilder<BaseTestMethods>() {
var documentablesTransformationStage: (DModule) -> Unit = {}
var pagesGenerationStage: (RootPageNode) -> Unit = {}
var pagesTransformationStage: (RootPageNode) -> Unit = {}
var renderingStage: (RootPageNode, DokkaContext) -> Unit = { a, b -> }
var renderingStage: (RootPageNode, DokkaContext) -> Unit = { _, _ -> }

override fun build() = BaseTestMethods(
pluginsSetupStage,
Expand All @@ -105,4 +105,4 @@ abstract class BaseAbstractTest(logger: TestLogger = TestLogger(DokkaConsoleLogg
::BaseTestBuilder,
::BaseDokkaTestGenerator,
logger,
)
)
Expand Up @@ -2,15 +2,17 @@ package utils

import junit.framework.Assert.assertEquals
import org.jsoup.Jsoup
import org.jsoup.nodes.Document

/**
* Parses it using JSOUP, trims whitespace at the end of the line and asserts if they are equal
* parsing is required to unify the formatting
*/
fun assertHtmlEqualsIgnoringWhitespace(expected: String, actual: String) {
val ignoreFormattingSettings = Document.OutputSettings().indentAmount(0).outline(true)
assertEquals(
Jsoup.parse(expected).outerHtml().trimSpacesAtTheEndOfLine(),
Jsoup.parse(actual).outerHtml().trimSpacesAtTheEndOfLine()
Jsoup.parse(expected).outputSettings(ignoreFormattingSettings).outerHtml().trimSpacesAtTheEndOfLine(),
Jsoup.parse(actual).outputSettings(ignoreFormattingSettings).outerHtml().trimSpacesAtTheEndOfLine()
)
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/base/build.gradle.kts
Expand Up @@ -9,7 +9,7 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")

api(project(":kotlin-analysis"))
implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jsoup:jsoup:1.13.1")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1")
testImplementation(project(":plugins:base:base-test-utils"))
testImplementation(project(":core:content-matcher-test-utils"))
Expand Down
55 changes: 26 additions & 29 deletions plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
Expand Up @@ -52,7 +52,7 @@ open class HtmlRenderer(
val sorted = strategy.sort(tabs)
if (sorted.size != tabs.size)
context.logger.warn("Tab sorting strategy has changed number of tabs from ${tabs.size} to ${sorted.size}")
return sorted;
return sorted
}

override fun FlowContent.wrapGroup(
Expand All @@ -68,7 +68,7 @@ open class HtmlRenderer(
val firstLevel = node.children.filterIsInstance<ContentHeader>().flatMap { it.children }
.filterIsInstance<ContentText>()

val renderable = firstLevel.union(secondLevel).let { sortTabs(tabSortingStrategy, it) }
val renderable = sortTabs(tabSortingStrategy, firstLevel.union(secondLevel))

div(classes = "tabs-section") {
attributes["tabs-section"] = "tabs-section"
Expand All @@ -84,7 +84,7 @@ open class HtmlRenderer(
childrenCallback()
}
}
node.hasStyle(ContentStyle.WithExtraAttributes) -> div() {
node.hasStyle(ContentStyle.WithExtraAttributes) -> div {
node.extra.extraHtmlAttributes().forEach { attributes[it.extraKey] = it.extraValue }
childrenCallback()
}
Expand All @@ -93,13 +93,13 @@ open class HtmlRenderer(
if (node.hasStyle(TextStyle.Monospace)) copyButton()
}
node.hasStyle(TextStyle.BreakableAfter) -> {
span() { childrenCallback() }
span { childrenCallback() }
wbr { }
}
node.hasStyle(TextStyle.Breakable) -> {
span("breakable-word") { childrenCallback() }
}
node.hasStyle(TextStyle.Span) -> span() { childrenCallback() }
node.hasStyle(TextStyle.Span) -> span { childrenCallback() }
node.dci.kind == ContentKind.Symbol -> div("symbol $additionalClasses") { childrenCallback() }
node.dci.kind == ContentKind.BriefComment -> div("brief $additionalClasses") { childrenCallback() }
node.dci.kind == ContentKind.Cover -> div("cover $additionalClasses") { //TODO this can be removed
Expand Down Expand Up @@ -152,11 +152,6 @@ open class HtmlRenderer(
}
}

fun FlowContent.withHtml(content: String): Unit = when (this) {
is HTMLTag -> unsafe { +content }
else -> div { unsafe { +content } }
}

override fun FlowContent.buildPlatformDependent(
content: PlatformHintedContent,
pageContext: ContentPage,
Expand Down Expand Up @@ -245,22 +240,24 @@ open class HtmlRenderer(
override fun FlowContent.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) {

val distinct =
node.groupDivergentInstances(pageContext, { instance, contentPage, sourceSet ->
createHTML(prettyPrint = false).prepareForTemplates().div {
instance.before?.let { before ->
buildContentNode(before, pageContext, sourceSet)
}
}.stripDiv()
}, { instance, contentPage, sourceSet ->
createHTML(prettyPrint = false).prepareForTemplates().div {
instance.after?.let { after ->
buildContentNode(after, pageContext, sourceSet)
}
}.stripDiv()
})
node.groupDivergentInstances(pageContext,
beforeTransformer = { instance, _, sourceSet ->
createHTML(prettyPrint = false).prepareForTemplates().div {
instance.before?.let { before ->
buildContentNode(before, pageContext, sourceSet)
}
}.stripDiv()
},
afterTransformer = { instance, _, sourceSet ->
createHTML(prettyPrint = false).prepareForTemplates().div {
instance.after?.let { after ->
buildContentNode(after, pageContext, sourceSet)
}
}.stripDiv()
})

distinct.forEach {
val groupedDivergent = it.value.groupBy { it.second }
distinct.forEach { distinctInstances ->
val groupedDivergent = distinctInstances.value.groupBy { it.second }

consumer.onTagContentUnsafe {
+createHTML().prepareForTemplates().div("divergent-group") {
Expand All @@ -279,7 +276,7 @@ open class HtmlRenderer(

consumer.onTagContentUnsafe {
+createHTML().prepareForTemplates().div("with-platform-tags") {
consumer.onTagContentUnsafe { +it.key.first }
consumer.onTagContentUnsafe { +distinctInstances.key.first }

consumer.onTagContentUnsafe {
+createHTML().prepareForTemplates().span("pull-right") {
Expand All @@ -296,12 +293,12 @@ open class HtmlRenderer(
if (node.implicitlySourceSetHinted) {
buildPlatformDependent(divergentForPlatformDependent, pageContext)
} else {
it.value.forEach {
distinctInstances.value.forEach {
buildContentNode(it.first.divergent, pageContext, setOf(it.second))
}
}
}
consumer.onTagContentUnsafe { +it.key.second }
consumer.onTagContentUnsafe { +distinctInstances.key.second }
}
}
}
Expand Down Expand Up @@ -492,7 +489,7 @@ open class HtmlRenderer(

private fun FlowContent.createPlatformTagBubbles(sourceSets: List<DisplaySourceSet>, cssClasses: String = "") {
if (shouldRenderSourceSetBubbles) {
div("platform-tags " + cssClasses) {
div("platform-tags $cssClasses") {
sourceSets.sortedBy { it.name }.forEach {
div("platform-tag") {
when (it.platform.key) {
Expand Down
Expand Up @@ -8,8 +8,8 @@ import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer

class ActualTypealiasAdder : DocumentableTransformer {

override fun invoke(modules: DModule, context: DokkaContext) = modules.generateTypealiasesMap().let { aliases ->
modules.copy(packages = modules.packages.map { it.copy(classlikes = addActualTypeAliasToClasslikes(it.classlikes, aliases)) })
override fun invoke(original: DModule, context: DokkaContext) = original.generateTypealiasesMap().let { aliases ->
original.copy(packages = original.packages.map { it.copy(classlikes = addActualTypeAliasToClasslikes(it.classlikes, aliases)) })
}

private fun DModule.generateTypealiasesMap(): Map<DRI, DTypeAlias> =
Expand Down
Expand Up @@ -71,7 +71,8 @@ open class DefaultPageCreator(
private fun <T> T.toClashedName() where T : Documentable, T : WithExtraProperties<T> =
(extra[ClashingDriIdentifier]?.value?.joinToString(", ", "[", "]") { it.displayName } ?: "") + name.orEmpty()

private fun <T> List<T>.renameClashingDocumentable(): List<T> where T : Documentable =
@Suppress("UNCHECKED_CAST")
private fun <T : Documentable> List<T>.renameClashingDocumentable(): List<T> =
groupBy { it.dri }.values.flatMap { elements ->
if (elements.size == 1) elements else elements.mapNotNull { element ->
when (element) {
Expand Down
Expand Up @@ -172,15 +172,15 @@ class DefaultPsiToDocumentableTranslator(
methods.asIterable().parallelForEach { superMethodsKeys.add(it.hash) }
fun parseSupertypes(superTypes: Array<PsiClassType>, level: Int = 0) { // TODO: Rewrite it
if (superTypes.isEmpty()) return
val parsedClasses = superTypes.filter { !it.shouldBeIgnored }.mapNotNull { psi ->
psi.resolve()?.let { psiClass ->
val (dri, javaClassKind) = when {
psiClass.isInterface -> DRI.from(psiClass) to JavaClassKindTypes.INTERFACE
else -> DRI.from(psiClass) to JavaClassKindTypes.CLASS
val parsedClasses = superTypes.filter { !it.shouldBeIgnored }.mapNotNull { supertypePsi ->
supertypePsi.resolve()?.let { supertypePsiClass ->
val (supertypeDri, javaClassKind) = when {
supertypePsiClass.isInterface -> DRI.from(supertypePsiClass) to JavaClassKindTypes.INTERFACE
else -> DRI.from(supertypePsiClass) to JavaClassKindTypes.CLASS
}
GenericTypeConstructor(
dri,
psi.parameters.map(::getProjection)
supertypeDri,
supertypePsi.parameters.map(::getProjection)
) to javaClassKind
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/kotlin-as-java/build.gradle.kts
Expand Up @@ -5,7 +5,7 @@ dependencies {
testImplementation(project(":plugins:base"))
testImplementation(project(":plugins:base:base-test-utils"))
testImplementation(project(":core:content-matcher-test-utils"))
testImplementation("org.jsoup:jsoup:1.12.1")
testImplementation("org.jsoup:jsoup:1.13.1")
}

registerDokkaArtifactPublication("kotlinAsJavaPlugin") {
Expand Down

0 comments on commit fd1e4f0

Please sign in to comment.