diff options
-rw-r--r-- | integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/build.gradle | 19 | ||||
-rw-r--r-- | integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/KotlinWebsiteSamplesTransformer.kt (renamed from plugins/base/src/main/kotlin/transformers/pages/samples/KotlinWebsiteSamplesTransformer.kt) | 4 | ||||
-rw-r--r-- | integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/SamplesTransformerPlugin.kt | 15 | ||||
-rw-r--r-- | integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin | 1 | ||||
-rw-r--r-- | integration-tests/gradle/projects/stdlib/stdlib.diff | 12 | ||||
-rw-r--r-- | integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt | 13 | ||||
-rw-r--r-- | plugins/base/api/base.api | 7 |
7 files changed, 56 insertions, 15 deletions
diff --git a/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/build.gradle b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/build.gradle new file mode 100644 index 00000000..3ab3e09b --- /dev/null +++ b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'org.jetbrains.kotlin.jvm' +} +description "Dokka Plugin to transform the samples from stdlib" + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + implementation "org.jetbrains.dokka:dokka-base:${dokka_it_kotlin_version}" + compileOnly "org.jetbrains.dokka:dokka-core:${dokka_it_kotlin_version}" +} + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { + kotlinOptions.jvmTarget = "1.8" +} + diff --git a/plugins/base/src/main/kotlin/transformers/pages/samples/KotlinWebsiteSamplesTransformer.kt b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/KotlinWebsiteSamplesTransformer.kt index 5babc289..9d5115cd 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/samples/KotlinWebsiteSamplesTransformer.kt +++ b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/KotlinWebsiteSamplesTransformer.kt @@ -1,4 +1,4 @@ -package org.jetbrains.dokka.base.transformers.pages.samples +package org.jetbrains.dokka.kotlinlang import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiElement @@ -6,6 +6,7 @@ import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.impl.source.tree.LeafPsiElement import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.dokka.base.transformers.pages.samples.SamplesTransformer import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.allChildren @@ -16,7 +17,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs import java.io.PrintWriter import java.io.StringWriter -// TODO Inspect below class for any bugs. Big chunk of was ripped from 0.10.1 class KotlinWebsiteSamplesTransformer(context: DokkaContext): SamplesTransformer(context) { private class SampleBuilder : KtTreeVisitorVoid() { diff --git a/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/SamplesTransformerPlugin.kt b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/SamplesTransformerPlugin.kt new file mode 100644 index 00000000..e39a3cda --- /dev/null +++ b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/kotlin/org/jetbrains/dokka/kotlinlang/SamplesTransformerPlugin.kt @@ -0,0 +1,15 @@ +package org.jetbrains.dokka.kotlinlang + +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.plugability.DokkaPlugin + +class SamplesTransformerPlugin : DokkaPlugin() { + private val dokkaBase by lazy { plugin<DokkaBase>() } + + val kotlinWebsiteSamplesTransformer by extending { + CoreExtensions.pageTransformer providing ::KotlinWebsiteSamplesTransformer override dokkaBase.defaultSamplesTransformer order { + before(dokkaBase.pageMerger) + } + } +}
\ No newline at end of file diff --git a/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin new file mode 100644 index 00000000..2ac2cd5f --- /dev/null +++ b/integration-tests/gradle/projects/stdlib/dokka-samples-transformer-plugin/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin @@ -0,0 +1 @@ +org.jetbrains.dokka.kotlinlang.SamplesTransformerPlugin
\ No newline at end of file diff --git a/integration-tests/gradle/projects/stdlib/stdlib.diff b/integration-tests/gradle/projects/stdlib/stdlib.diff index c009e788..71d27c99 100644 --- a/integration-tests/gradle/projects/stdlib/stdlib.diff +++ b/integration-tests/gradle/projects/stdlib/stdlib.diff @@ -37,7 +37,7 @@ diff --git a/build.gradle b/build.gradle index aa8f21b..dd6a2ae 100644 --- a/build.gradle +++ b/build.gradle -@@ -1,80 +1,424 @@ +@@ -1,80 +1,428 @@ +import org.jetbrains.dokka.Platform + plugins { @@ -74,10 +74,11 @@ index aa8f21b..dd6a2ae 100644 + jcenter() } --dependencies { + dependencies { - dokka "org.jetbrains.dokka:dokka-fatjar:$dokka_version" --} -- ++ dokkaPlugin project(":dokka-samples-transformer-plugin") + } + -final File dokkaHome = new File(buildDir, "dokka-home") -task setupDokka(type: Sync) { - from configurations.dokka @@ -542,7 +543,7 @@ diff --git a/settings.gradle b/settings.gradle index 5209245..bd38b18 100644 --- a/settings.gradle +++ b/settings.gradle -@@ -1,5 +1,18 @@ +@@ -1,5 +1,19 @@ +pluginManagement { + resolutionStrategy { + eachPlugin { @@ -562,3 +563,4 @@ index 5209245..bd38b18 100644 include 'kotlin_native' include 'kotlin_big' -include 'ant' ++include 'dokka-samples-transformer-plugin'
\ No newline at end of file diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt index 4f56ba55..a5b61b1d 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt @@ -3,7 +3,8 @@ package org.jetbrains.dokka.it.gradle.kotlin import org.gradle.testkit.runner.TaskOutcome import org.jetbrains.dokka.it.S3Project import org.jetbrains.dokka.it.copyAndApplyGitDiff -import org.jetbrains.dokka.it.gradle.* +import org.jetbrains.dokka.it.gradle.AbstractGradleIntegrationTest +import org.jetbrains.dokka.it.gradle.BuildVersions import org.junit.runners.Parameterized import java.io.File import kotlin.test.* @@ -28,6 +29,16 @@ class StdlibGradleIntegrationTest(override val versions: BuildVersions) : Abstra templateProjectDir.listFiles().orEmpty() .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + val pluginDir = File("projects", "stdlib/dokka-samples-transformer-plugin") + pluginDir.listFiles().orEmpty() + .forEach { topLevelFile -> + topLevelFile.copyRecursively( + File( + projectDir.resolve("dokka-samples-transformer-plugin").also { it.mkdir() }, topLevelFile.name + ) + ) + } + copyAndApplyGitDiff(File("projects", "stdlib/stdlib.diff")) } diff --git a/plugins/base/api/base.api b/plugins/base/api/base.api index e2f61c69..488d2d8d 100644 --- a/plugins/base/api/base.api +++ b/plugins/base/api/base.api @@ -1230,13 +1230,6 @@ public final class org/jetbrains/dokka/base/transformers/pages/samples/DefaultSa public fun processImports (Lcom/intellij/psi/PsiElement;)Ljava/lang/String; } -public final class org/jetbrains/dokka/base/transformers/pages/samples/KotlinWebsiteSamplesTransformer : org/jetbrains/dokka/base/transformers/pages/samples/SamplesTransformer { - public fun <init> (Lorg/jetbrains/dokka/plugability/DokkaContext;)V - public final fun getImportsToIgnore ()Ljava/util/List; - public fun processBody (Lcom/intellij/psi/PsiElement;)Ljava/lang/String; - public fun processImports (Lcom/intellij/psi/PsiElement;)Ljava/lang/String; -} - public abstract class org/jetbrains/dokka/base/transformers/pages/samples/SamplesTransformer : org/jetbrains/dokka/transformers/pages/PageTransformer { public fun <init> (Lorg/jetbrains/dokka/plugability/DokkaContext;)V protected fun createSampleBody (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; |