From 8e5c63d035ef44a269b8c43430f43f5c8eebfb63 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Fri, 10 Nov 2023 11:46:54 +0100 Subject: Restructure the project to utilize included builds (#3174) * Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich --- .../kotlin/org/jetbrains/dokka/base/DokkaBase.kt | 299 ++++ .../jetbrains/dokka/base/DokkaBaseConfiguration.kt | 28 + .../base/deprecated/AnalysisApiDeprecatedError.kt | 16 + .../base/deprecated/KotlinAnalysisDeprecatedApi.kt | 77 + .../dokka/base/deprecated/ParsersDeprecatedAPI.kt | 42 + .../deprecated/ParsersFactoriesDeprecatedAPI.kt | 24 + .../TranslatorDescriptorsDeprecatedAPI.kt | 50 + .../base/deprecated/TranslatorPsiDeprecatedAPI.kt | 25 + .../base/generation/SingleModuleGeneration.kt | 131 ++ .../dokka/base/renderers/DefaultRenderer.kt | 257 +++ .../jetbrains/dokka/base/renderers/FileWriter.kt | 109 ++ .../jetbrains/dokka/base/renderers/OutputWriter.kt | 11 + .../dokka/base/renderers/PackageListService.kt | 80 + .../dokka/base/renderers/TabSortingStrategy.kt | 11 + .../dokka/base/renderers/contentTypeChecking.kt | 24 + .../dokka/base/renderers/html/HtmlContent.kt | 18 + .../dokka/base/renderers/html/HtmlRenderer.kt | 1013 ++++++++++++ .../base/renderers/html/NavigationDataProvider.kt | 134 ++ .../dokka/base/renderers/html/NavigationPage.kt | 129 ++ .../base/renderers/html/SearchbarDataInstaller.kt | 128 ++ .../jetbrains/dokka/base/renderers/html/Tags.kt | 82 + .../consumers/ImmediateResolutionTagConsumer.kt | 37 + .../html/command/consumers/PathToRootConsumer.kt | 26 + .../command/consumers/ReplaceVersionsConsumer.kt | 29 + .../html/command/consumers/ResolveLinkConsumer.kt | 34 + .../base/renderers/html/htmlFormatingUtils.kt | 67 + .../dokka/base/renderers/html/htmlPreprocessors.kt | 172 +++ .../innerTemplating/DefaultTemplateModelFactory.kt | 234 +++ .../innerTemplating/DefaultTemplateModelMerger.kt | 20 + .../html/innerTemplating/HtmlTemplater.kt | 82 + .../html/innerTemplating/TemplateModelFactory.kt | 19 + .../html/innerTemplating/TemplateModelMerger.kt | 9 + .../renderers/html/shouldRenderSourceSetBubbles.kt | 20 + .../org/jetbrains/dokka/base/renderers/pageId.kt | 31 + .../dokka/base/renderers/preprocessors.kt | 41 + .../dokka/base/resolvers/anchors/AnchorsHint.kt | 19 + .../external/DefaultExternalLocationProvider.kt | 46 + .../DefaultExternalLocationProviderFactory.kt | 28 + .../external/Dokka010ExternalLocationProvider.kt | 46 + .../resolvers/external/ExternalLocationProvider.kt | 18 + .../external/ExternalLocationProviderFactory.kt | 11 + .../ExternalLocationProviderFactoryWithCache.kt | 21 + .../javadoc/AndroidExternalLocationProvider.kt | 18 + .../javadoc/JavadocExternalLocationProvider.kt | 62 + .../JavadocExternalLocationProviderFactory.kt | 39 + .../resolvers/local/DefaultLocationProvider.kt | 82 + .../resolvers/local/DokkaBaseLocationProvider.kt | 27 + .../base/resolvers/local/DokkaLocationProvider.kt | 182 +++ .../local/DokkaLocationProviderFactory.kt | 26 + .../dokka/base/resolvers/local/LocationProvider.kt | 47 + .../resolvers/local/LocationProviderFactory.kt | 11 + .../base/resolvers/shared/ExternalDocumentation.kt | 9 + .../dokka/base/resolvers/shared/LinkFormat.kt | 10 + .../dokka/base/resolvers/shared/PackageList.kt | 83 + .../base/resolvers/shared/RecognizedLinkFormat.kt | 29 + .../jetbrains/dokka/base/resolvers/shared/utils.kt | 41 + .../dokka/base/signatures/JvmSignatureUtils.kt | 231 +++ .../base/signatures/KotlinSignatureProvider.kt | 503 ++++++ .../dokka/base/signatures/KotlinSignatureUtils.kt | 86 ++ .../dokka/base/signatures/SignatureProvider.kt | 12 + .../base/templating/AddToNavigationCommand.kt | 9 + .../jetbrains/dokka/base/templating/AddToSearch.kt | 12 + .../base/templating/AddToSourcesetDependencies.kt | 10 + .../org/jetbrains/dokka/base/templating/Command.kt | 15 + .../templating/ImmediateHtmlCommandConsumer.kt | 17 + .../dokka/base/templating/InsertTemplateExtra.kt | 16 + .../templating/PathToRootSubstitutionCommand.kt | 10 + .../templating/ProjectNameSubstitutionCommand.kt | 10 + .../base/templating/ReplaceVersionsCommand.kt | 7 + .../dokka/base/templating/ResolveLinkCommand.kt | 11 + .../dokka/base/templating/jsonMapperForPlugins.kt | 62 + .../documentables/ActualTypealiasAdder.kt | 127 ++ .../documentables/ClashingDriIdentifier.kt | 12 + .../documentables/DefaultDocumentableMerger.kt | 0 .../DeprecatedDocumentableFilterTransformer.kt | 62 + .../DocumentableReplacerTransformer.kt | 239 +++ .../DocumentableVisibilityFilterTransformer.kt | 388 +++++ .../documentables/EmptyModulesFilterTransformer.kt | 14 + .../EmptyPackagesFilterTransformer.kt | 30 + .../documentables/ExtensionExtractorTransformer.kt | 160 ++ ...nheritedEntriesDocumentableFilterTransformer.kt | 23 + .../InheritorsExtractorTransformer.kt | 91 ++ .../KotlinArrayDocumentableReplacerTransformer.kt | 68 + .../ModuleAndPackageDocumentationTransformer.kt | 47 + ...bviousFunctionsDocumentableFilterTransformer.kt | 17 + .../documentables/ReportUndocumentedTransformer.kt | 143 ++ .../documentables/SuppressTagDocumentableFilter.kt | 17 + ...ssedByConditionDocumentableFilterTransformer.kt | 146 ++ ...ByConfigurationDocumentableFilterTransformer.kt | 57 + .../dokka/base/transformers/documentables/utils.kt | 35 + .../pages/DefaultSamplesTransformer.kt | 117 ++ .../pages/annotations/SinceKotlinTransformer.kt | 186 +++ .../pages/comments/CommentsToContentConverter.kt | 22 + .../pages/comments/DocTagToContentConverter.kt | 270 ++++ .../pages/merger/FallbackPageMergerStrategy.kt | 22 + .../base/transformers/pages/merger/PageMerger.kt | 40 + .../pages/merger/PageMergerStrategy.kt | 13 + .../merger/SameMethodNamePageMergerStrategy.kt | 68 + .../merger/SourceSetMergingPageTransformer.kt | 43 + .../pages/sourcelinks/SourceLinksTransformer.kt | 140 ++ .../pages/tags/CustomTagContentProvider.kt | 63 + .../pages/tags/SinceKotlinTagContentProvider.kt | 38 + .../DefaultDocumentableToPageTranslator.kt | 34 + .../documentables/DefaultPageCreator.kt | 779 ++++++++++ .../documentables/DeprecationSectionCreator.kt | 194 +++ .../documentables/DescriptionSections.kt | 349 +++++ .../translators/documentables/DriClashAwareName.kt | 13 + .../documentables/PageContentBuilder.kt | 781 ++++++++++ .../documentables/briefFromContentNodes.kt | 62 + .../dokka/base/utils/CollectionExtensions.kt | 16 + .../dokka/base/utils/alphabeticalOrder.kt | 11 + .../org.jetbrains.dokka.plugability.DokkaPlugin | 5 + .../dokka/docs/javadoc/EnumValueOf.java.template | 12 + .../dokka/docs/javadoc/EnumValues.java.template | 8 + .../dokka/docs/kdoc/EnumEntries.kt.template | 3 + .../dokka/docs/kdoc/EnumValueOf.kt.template | 4 + .../dokka/docs/kdoc/EnumValues.kt.template | 3 + .../src/main/resources/dokka/format/gfm.properties | 6 + .../resources/dokka/format/html-as-java.properties | 6 + .../main/resources/dokka/format/html.properties | 6 + .../dokka/format/java-layout-html.properties | 6 + .../main/resources/dokka/format/jekyll.properties | 6 + .../dokka/format/kotlin-website-html.properties | 6 + .../resources/dokka/format/markdown.properties | 6 + .../resources/dokka/images/anchor-copy-button.svg | 8 + .../src/main/resources/dokka/images/arrow_down.svg | 7 + .../src/main/resources/dokka/images/burger.svg | 9 + .../src/main/resources/dokka/images/copy-icon.svg | 7 + .../dokka/images/copy-successful-icon.svg | 7 + .../resources/dokka/images/footer-go-to-link.svg | 7 + .../main/resources/dokka/images/go-to-top-icon.svg | 8 + .../src/main/resources/dokka/images/homepage.svg | 5 + .../src/main/resources/dokka/images/logo-icon.svg | 14 + .../images/nav-icons/abstract-class-kotlin.svg | 26 + .../dokka/images/nav-icons/abstract-class.svg | 20 + .../dokka/images/nav-icons/annotation-kotlin.svg | 13 + .../dokka/images/nav-icons/annotation.svg | 7 + .../dokka/images/nav-icons/class-kotlin.svg | 13 + .../resources/dokka/images/nav-icons/class.svg | 7 + .../dokka/images/nav-icons/enum-kotlin.svg | 13 + .../main/resources/dokka/images/nav-icons/enum.svg | 7 + .../dokka/images/nav-icons/exception-class.svg | 7 + .../dokka/images/nav-icons/field-value.svg | 10 + .../dokka/images/nav-icons/field-variable.svg | 10 + .../resources/dokka/images/nav-icons/function.svg | 7 + .../dokka/images/nav-icons/interface-kotlin.svg | 13 + .../resources/dokka/images/nav-icons/interface.svg | 7 + .../resources/dokka/images/nav-icons/object.svg | 13 + .../dokka/images/nav-icons/typealias-kotlin.svg | 13 + .../main/resources/dokka/images/theme-toggle.svg | 7 + .../inbound-link-resolver/dokka-default.properties | 6 + .../java-layout-html.properties | 6 + .../dokka/inbound-link-resolver/javadoc.properties | 6 + .../src/main/resources/dokka/scripts/clipboard.js | 56 + .../resources/dokka/scripts/navigation-loader.js | 95 ++ .../dokka/scripts/platform-content-handler.js | 400 +++++ .../src/main/resources/dokka/scripts/prism.js | 22 + .../scripts/symbol-parameters-wrapper_deferred.js | 64 + .../resources/dokka/styles/font-jb-sans-auto.css | 36 + .../main/resources/dokka/styles/logo-styles.css | 9 + .../src/main/resources/dokka/styles/prism.css | 217 +++ .../src/main/resources/dokka/styles/style.css | 1513 ++++++++++++++++++ .../src/main/resources/dokka/templates/base.ftl | 44 + .../resources/dokka/templates/includes/footer.ftl | 7 + .../resources/dokka/templates/includes/header.ftl | 31 + .../dokka/templates/includes/page_metadata.ftl | 6 + .../templates/includes/source_set_selector.ftl | 9 + .../AbortGracefullyOnMissingDocumentablesTest.kt | 22 + .../plugin-base/src/test/kotlin/basic/DRITest.kt | 351 +++++ .../src/test/kotlin/basic/DokkaBasicTests.kt | 46 + .../src/test/kotlin/basic/FailOnWarningTest.kt | 128 ++ .../src/test/kotlin/basic/LoggerTest.kt | 48 + .../kotlin/content/ContentInDescriptionTest.kt | 142 ++ .../src/test/kotlin/content/HighlightingTest.kt | 83 + .../annotations/ContentForAnnotationsTest.kt | 351 +++++ .../content/annotations/FileLevelJvmNameTest.kt | 115 ++ .../content/annotations/JavaDeprecatedTest.kt | 144 ++ .../content/annotations/KotlinDeprecatedTest.kt | 401 +++++ .../kotlin/content/annotations/SinceKotlinTest.kt | 350 +++++ .../content/exceptions/ContentForExceptions.kt | 439 ++++++ .../content/functions/ContentForBriefTest.kt | 388 +++++ .../content/functions/ContentForConstructors.kt | 53 + .../content/inheritors/ContentForInheritorsTest.kt | 499 ++++++ .../kotlin/content/params/ContentForParamsTest.kt | 1529 ++++++++++++++++++ .../ContentForClassWithParamsAndPropertiesTest.kt | 272 ++++ .../content/receiver/ContentForReceiverTest.kt | 61 + .../content/samples/ContentForSamplesTest.kt | 207 +++ .../content/seealso/ContentForSeeAlsoTest.kt | 866 +++++++++++ .../signatures/ConstructorsSignaturesTest.kt | 469 ++++++ .../content/signatures/ContentForSignaturesTest.kt | 515 ++++++ .../kotlin/content/typealiases/TypealiasTest.kt | 83 + .../src/test/kotlin/enums/JavaEnumsTest.kt | 75 + .../src/test/kotlin/enums/KotlinEnumsTest.kt | 471 ++++++ .../src/test/kotlin/expect/AbstractExpectTest.kt | 109 ++ .../src/test/kotlin/expect/ExpectGenerator.kt | 17 + .../src/test/kotlin/expect/ExpectTest.kt | 28 + .../src/test/kotlin/expect/ExpectUtils.kt | 32 + .../test/kotlin/expectActuals/ExpectActualsTest.kt | 179 +++ .../test/kotlin/filter/DeprecationFilterTest.kt | 264 ++++ .../test/kotlin/filter/EmptyPackagesFilterTest.kt | 70 + .../src/test/kotlin/filter/JavaFileFilterTest.kt | 40 + .../test/kotlin/filter/JavaVisibilityFilterTest.kt | 308 ++++ .../filter/KotlinArrayDocumentableReplacerTest.kt | 211 +++ .../src/test/kotlin/filter/VisibilityFilterTest.kt | 755 +++++++++ .../src/test/kotlin/issues/IssuesTest.kt | 59 + .../kotlin/linkableContent/LinkableContentTest.kt | 418 +++++ .../test/kotlin/linking/EnumValuesLinkingTest.kt | 142 ++ .../AndroidExternalLocationProviderTest.kt | 109 ++ .../DefaultExternalLocationProviderTest.kt | 78 + .../Dokka010ExternalLocationProviderTest.kt | 123 ++ .../locationProvider/DokkaLocationProviderTest.kt | 126 ++ .../JavadocExternalLocationProviderTest.kt | 85 + .../locationProvider/MultiModuleLinkingTest.kt | 74 + .../src/test/kotlin/markdown/KDocTest.kt | 51 + .../src/test/kotlin/markdown/LinkTest.kt | 240 +++ .../src/test/kotlin/markdown/ParserTest.kt | 1633 ++++++++++++++++++++ .../src/test/kotlin/model/ClassesTest.kt | 594 +++++++ .../src/test/kotlin/model/CommentTest.kt | 338 ++++ .../src/test/kotlin/model/ExtensionsTest.kt | 159 ++ .../src/test/kotlin/model/FunctionsTest.kt | 403 +++++ .../src/test/kotlin/model/InheritorsTest.kt | 428 +++++ .../plugin-base/src/test/kotlin/model/JavaTest.kt | 491 ++++++ .../kotlin/model/MultiLanguageInheritanceTest.kt | 365 +++++ .../src/test/kotlin/model/ObjectTest.kt | 43 + .../src/test/kotlin/model/PackagesTest.kt | 123 ++ .../src/test/kotlin/model/PropertyTest.kt | 277 ++++ .../JavaAnnotationsForParametersTest.kt | 181 +++ .../model/annotations/JavaAnnotationsTest.kt | 195 +++ .../KotlinAnnotationsForParametersTest.kt | 105 ++ .../kotlin/multiplatform/BasicMultiplatformTest.kt | 58 + .../src/test/kotlin/packageList/PackageListTest.kt | 69 + .../test/kotlin/pageMerger/PageNodeMergerTest.kt | 465 ++++++ .../src/test/kotlin/parsers/JavadocParserTest.kt | 618 ++++++++ .../src/test/kotlin/renderers/html/BasicTest.kt | 24 + .../test/kotlin/renderers/html/BreadcrumbsTest.kt | 88 ++ .../test/kotlin/renderers/html/CoverPageTest.kt | 51 + .../test/kotlin/renderers/html/CustomFooterTest.kt | 48 + .../test/kotlin/renderers/html/DivergentTest.kt | 316 ++++ .../kotlin/renderers/html/FooterMessageTest.kt | 31 + .../kotlin/renderers/html/FormattingUtilsTest.kt | 86 ++ .../kotlin/renderers/html/GroupWrappingTest.kt | 82 + .../src/test/kotlin/renderers/html/HeaderTest.kt | 102 ++ .../renderers/html/HtmlRenderingOnlyTestBase.kt | 68 + .../test/kotlin/renderers/html/ListStylesTest.kt | 45 + .../kotlin/renderers/html/NavigationIconTest.kt | 292 ++++ .../test/kotlin/renderers/html/NavigationTest.kt | 414 +++++ .../renderers/html/SearchbarDataInstallerTest.kt | 50 + .../renderers/html/SourceSetDependentHintTest.kt | 139 ++ .../kotlin/renderers/html/SourceSetFilterTest.kt | 68 + .../kotlin/renderers/html/TabbedContentTest.kt | 188 +++ .../test/kotlin/renderers/html/TextStylesTest.kt | 113 ++ .../test/kotlin/resourceLinks/ResourceLinksTest.kt | 301 ++++ .../kotlin/signatures/AbstractRenderingTest.kt | 65 + .../kotlin/signatures/DivergentSignatureTest.kt | 73 + .../FunctionalTypeConstructorsSignatureTest.kt | 312 ++++ .../signatures/InheritedAccessorsSignatureTest.kt | 461 ++++++ .../kotlin/signatures/ObviousTypeSkippingTest.kt | 206 +++ .../test/kotlin/signatures/RawHtmlRenderingTest.kt | 70 + .../src/test/kotlin/signatures/SignatureTest.kt | 1035 +++++++++++++ .../kotlin/signatures/VarianceSignatureTest.kt | 108 ++ .../superFields/DescriptorSuperPropertiesTest.kt | 366 +++++ .../test/kotlin/superFields/PsiSuperFieldsTest.kt | 177 +++ .../PageTransformerBuilderTest.kt | 195 +++ ...ntextModuleAndPackageDocumentationReaderTest.kt | 27 + .../transformers/CommentsToContentConverterTest.kt | 484 ++++++ ...textModuleAndPackageDocumentationReaderTest1.kt | 187 +++ ...textModuleAndPackageDocumentationReaderTest3.kt | 61 + .../test/kotlin/transformers/DivisionSwitchTest.kt | 126 ++ ...itedEntriesDocumentableFilterTransfromerTest.kt | 162 ++ ...ntentModuleAndPackageDocumentationReaderTest.kt | 100 ++ .../MergeImplicitExpectActualDeclarationsTest.kt | 386 +++++ ...ackageDocumentationTransformerFunctionalTest.kt | 137 ++ ...leAndPackageDocumentationTransformerUnitTest.kt | 260 ++++ ...sAndInheritedFunctionsDocumentableFilterTest.kt | 229 +++ .../ReportUndocumentedTransformerTest.kt | 927 +++++++++++ .../transformers/SourceLinkTransformerTest.kt | 131 ++ .../kotlin/transformers/SuppressTagFilterTest.kt | 211 +++ ...nfigurationDocumentableFilterTransformerTest.kt | 193 +++ .../test/kotlin/transformers/isExceptionTest.kt | 147 ++ .../kotlin/translators/AccessorMethodNamingTest.kt | 123 ++ .../src/test/kotlin/translators/Bug1341.kt | 48 + ...efaultDescriptorToDocumentableTranslatorTest.kt | 1107 +++++++++++++ .../DefaultPsiToDocumentableTranslatorTest.kt | 1027 ++++++++++++ .../translators/ExternalDocumentablesTest.kt | 144 ++ .../kotlin/translators/JavadocInheritDocsTest.kt | 312 ++++ .../translators/JavadocInheritedDocTagsTest.kt | 252 +++ .../test/kotlin/translators/JavadocParserTest.kt | 208 +++ .../src/test/kotlin/translators/utils.kt | 43 + .../plugin-base/src/test/kotlin/utils/HtmlUtils.kt | 20 + .../src/test/kotlin/utils/ModelUtils.kt | 43 + .../src/test/kotlin/utils/TagsAnnotations.kt | 42 + .../plugin-base/src/test/kotlin/utils/TestUtils.kt | 94 ++ .../src/test/kotlin/utils/contentUtils.kt | 355 +++++ .../src/test/resources/content/samples/samples.kt | 9 + .../test/resources/linkable/includes/include1.md | 14 + .../test/resources/linkable/includes/include11.md | 3 + .../test/resources/linkable/includes/include2.md | 7 + .../linkable/samples/jsMain/kotlin/JsClass.kt | 13 + .../linkable/samples/jsMain/resources/Samples.kt | 14 + .../linkable/samples/jvmMain/kotlin/JvmClass.kt | 13 + .../linkable/samples/jvmMain/resources/Samples.kt | 14 + .../linkable/sources/jsMain/kotlin/JsClass.kt | 7 + .../linkable/sources/jvmMain/kotlin/JvmClass.kt | 7 + .../jvmMain/kotlin/linking/source/JavaEnum.java | 5 + .../jvmMain/kotlin/linking/source/JavaLinker.java | 8 + .../jvmMain/kotlin/linking/source/KotlinEnum.kt | 9 + .../jvmMain/kotlin/linking/source/KotlinLinker.kt | 12 + .../resources/locationProvider/jdk8-package-list | 217 +++ .../locationProvider/multi-module-package-list | 8 + .../resources/locationProvider/old-package-list | 9 + .../resources/locationProvider/stdlib-package-list | 67 + .../commonMain/kotlin/Clock.kt | 19 + .../commonMain/kotlin/House.kt | 28 + .../basicMultiplatformTest/jsMain/kotlin/Clock.kt | 32 + .../jvmAndJsSecondCommonMain/kotlin/Greeter.kt | 14 + .../jvmMain/kotlin/example/Clock.kt | 43 + .../jvmMain/kotlin/example/ClockDays.kt | 19 + .../jvmMain/kotlin/example/HtmlTest.kt | 24 + .../jvmMain/kotlin/example/ParticularClock.kt | 36 + 319 files changed, 45163 insertions(+) create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBase.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBaseConfiguration.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/AnalysisApiDeprecatedError.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/KotlinAnalysisDeprecatedApi.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersDeprecatedAPI.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersFactoriesDeprecatedAPI.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorDescriptorsDeprecatedAPI.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorPsiDeprecatedAPI.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/generation/SingleModuleGeneration.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/DefaultRenderer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/FileWriter.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/OutputWriter.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/PackageListService.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/TabSortingStrategy.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/contentTypeChecking.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlContent.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlRenderer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/NavigationDataProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/NavigationPage.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/SearchbarDataInstaller.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/Tags.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/command/consumers/ImmediateResolutionTagConsumer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/command/consumers/PathToRootConsumer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/command/consumers/ReplaceVersionsConsumer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/command/consumers/ResolveLinkConsumer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/htmlFormatingUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/htmlPreprocessors.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/innerTemplating/DefaultTemplateModelMerger.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/innerTemplating/HtmlTemplater.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/innerTemplating/TemplateModelFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/innerTemplating/TemplateModelMerger.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/shouldRenderSourceSetBubbles.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/pageId.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/preprocessors.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/anchors/AnchorsHint.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/DefaultExternalLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/DefaultExternalLocationProviderFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/Dokka010ExternalLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/ExternalLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/ExternalLocationProviderFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/ExternalLocationProviderFactoryWithCache.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/javadoc/AndroidExternalLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/javadoc/JavadocExternalLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/external/javadoc/JavadocExternalLocationProviderFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/local/DefaultLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/local/DokkaBaseLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/local/DokkaLocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/local/DokkaLocationProviderFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/local/LocationProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/local/LocationProviderFactory.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/shared/ExternalDocumentation.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/shared/LinkFormat.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/shared/PackageList.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/shared/RecognizedLinkFormat.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/resolvers/shared/utils.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/signatures/JvmSignatureUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/signatures/KotlinSignatureProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/signatures/KotlinSignatureUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/signatures/SignatureProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/AddToNavigationCommand.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/AddToSearch.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/AddToSourcesetDependencies.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/Command.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/ImmediateHtmlCommandConsumer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/InsertTemplateExtra.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/PathToRootSubstitutionCommand.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/ProjectNameSubstitutionCommand.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/ReplaceVersionsCommand.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/ResolveLinkCommand.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/templating/jsonMapperForPlugins.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/ActualTypealiasAdder.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/ClashingDriIdentifier.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/DefaultDocumentableMerger.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/DocumentableReplacerTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/DocumentableVisibilityFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/EmptyModulesFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/EmptyPackagesFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/ExtensionExtractorTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/InheritorsExtractorTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/KotlinArrayDocumentableReplacerTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/ObviousFunctionsDocumentableFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/ReportUndocumentedTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/SuppressTagDocumentableFilter.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/SuppressedByConditionDocumentableFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/SuppressedByConfigurationDocumentableFilterTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/documentables/utils.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/DefaultSamplesTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/annotations/SinceKotlinTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/comments/CommentsToContentConverter.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/comments/DocTagToContentConverter.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/merger/FallbackPageMergerStrategy.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/merger/PageMerger.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/merger/PageMergerStrategy.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/merger/SameMethodNamePageMergerStrategy.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/merger/SourceSetMergingPageTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/sourcelinks/SourceLinksTransformer.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/tags/CustomTagContentProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/transformers/pages/tags/SinceKotlinTagContentProvider.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/DefaultDocumentableToPageTranslator.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/DefaultPageCreator.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/DeprecationSectionCreator.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/DescriptionSections.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/DriClashAwareName.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/PageContentBuilder.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/translators/documentables/briefFromContentNodes.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/utils/CollectionExtensions.kt create mode 100644 dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/utils/alphabeticalOrder.kt create mode 100644 dokka-subprojects/plugin-base/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValueOf.java.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/javadoc/EnumValues.java.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumEntries.kt.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValueOf.kt.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/docs/kdoc/EnumValues.kt.template create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/gfm.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/html-as-java.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/java-layout-html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/jekyll.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/kotlin-website-html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/format/markdown.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/anchor-copy-button.svg create mode 100755 dokka-subprojects/plugin-base/src/main/resources/dokka/images/arrow_down.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/burger.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/copy-successful-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/footer-go-to-link.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/go-to-top-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/homepage.svg create mode 100755 dokka-subprojects/plugin-base/src/main/resources/dokka/images/logo-icon.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/abstract-class.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/annotation.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/class.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/enum.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/exception-class.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-value.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/field-variable.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/function.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/interface.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/object.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/nav-icons/typealias-kotlin.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/images/theme-toggle.svg create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/dokka-default.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/java-layout-html.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/inbound-link-resolver/javadoc.properties create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/clipboard.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/navigation-loader.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/platform-content-handler.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/prism.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/scripts/symbol-parameters-wrapper_deferred.js create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/font-jb-sans-auto.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/logo-styles.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/prism.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/styles/style.css create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/base.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/footer.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/header.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/page_metadata.ftl create mode 100644 dokka-subprojects/plugin-base/src/main/resources/dokka/templates/includes/source_set_selector.ftl create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/basic/AbortGracefullyOnMissingDocumentablesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/basic/DRITest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/basic/DokkaBasicTests.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/basic/FailOnWarningTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/basic/LoggerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/ContentInDescriptionTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/HighlightingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/annotations/FileLevelJvmNameTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/annotations/KotlinDeprecatedTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/annotations/SinceKotlinTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/exceptions/ContentForExceptions.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/functions/ContentForBriefTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/functions/ContentForConstructors.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/params/ContentForParamsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/samples/ContentForSamplesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/content/typealiases/TypealiasTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/enums/JavaEnumsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/enums/KotlinEnumsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/expect/AbstractExpectTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/expect/ExpectGenerator.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/expect/ExpectTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/expect/ExpectUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/expectActuals/ExpectActualsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/filter/DeprecationFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/filter/EmptyPackagesFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/filter/JavaFileFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/filter/VisibilityFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/issues/IssuesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/linkableContent/LinkableContentTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/linking/EnumValuesLinkingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/locationProvider/AndroidExternalLocationProviderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/locationProvider/DefaultExternalLocationProviderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/locationProvider/Dokka010ExternalLocationProviderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/locationProvider/DokkaLocationProviderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/locationProvider/JavadocExternalLocationProviderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/locationProvider/MultiModuleLinkingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/markdown/KDocTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/markdown/LinkTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/markdown/ParserTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/ClassesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/CommentTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/ExtensionsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/FunctionsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/InheritorsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/JavaTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/ObjectTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/PackagesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/PropertyTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/packageList/PackageListTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/parsers/JavadocParserTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/BasicTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/BreadcrumbsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/CoverPageTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/CustomFooterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/DivergentTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/FooterMessageTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/GroupWrappingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/HeaderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/ListStylesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/NavigationIconTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/NavigationTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/SearchbarDataInstallerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/SourceSetFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/TabbedContentTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/renderers/html/TextStylesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/AbstractRenderingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/DivergentSignatureTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/ObviousTypeSkippingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/RawHtmlRenderingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/SignatureTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/signatures/VarianceSignatureTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformerBuilders/PageTransformerBuilderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/AbstractContextModuleAndPackageDocumentationReaderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest1.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/ContextModuleAndPackageDocumentationReaderTest3.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/DivisionSwitchTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/InvalidContentModuleAndPackageDocumentationReaderTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerUnitTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/SuppressTagFilterTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/SuppressedByConfigurationDocumentableFilterTransformerTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/transformers/isExceptionTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/AccessorMethodNamingTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/Bug1341.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/ExternalDocumentablesTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/JavadocInheritDocsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/JavadocParserTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/translators/utils.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/utils/HtmlUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/utils/ModelUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/utils/TagsAnnotations.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/utils/TestUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/test/kotlin/utils/contentUtils.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/content/samples/samples.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/includes/include1.md create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/includes/include11.md create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/includes/include2.md create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/samples/jsMain/kotlin/JsClass.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/samples/jsMain/resources/Samples.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/samples/jvmMain/kotlin/JvmClass.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/samples/jvmMain/resources/Samples.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/sources/jsMain/kotlin/JsClass.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linkable/sources/jvmMain/kotlin/JvmClass.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linking/jvmMain/kotlin/linking/source/JavaEnum.java create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linking/jvmMain/kotlin/linking/source/JavaLinker.java create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linking/jvmMain/kotlin/linking/source/KotlinEnum.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/linking/jvmMain/kotlin/linking/source/KotlinLinker.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/locationProvider/jdk8-package-list create mode 100644 dokka-subprojects/plugin-base/src/test/resources/locationProvider/multi-module-package-list create mode 100644 dokka-subprojects/plugin-base/src/test/resources/locationProvider/old-package-list create mode 100644 dokka-subprojects/plugin-base/src/test/resources/locationProvider/stdlib-package-list create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/commonMain/kotlin/Clock.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/commonMain/kotlin/House.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/jsMain/kotlin/Clock.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/jvmAndJsSecondCommonMain/kotlin/Greeter.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/jvmMain/kotlin/example/Clock.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/jvmMain/kotlin/example/ClockDays.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/jvmMain/kotlin/example/HtmlTest.kt create mode 100644 dokka-subprojects/plugin-base/src/test/resources/multiplatform/basicMultiplatformTest/jvmMain/kotlin/example/ParticularClock.kt (limited to 'dokka-subprojects/plugin-base/src') diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBase.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBase.kt new file mode 100644 index 00000000..ca86d4d5 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBase.kt @@ -0,0 +1,299 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base + +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.generation.SingleModuleGeneration +import org.jetbrains.dokka.base.renderers.* +import org.jetbrains.dokka.base.renderers.html.* +import org.jetbrains.dokka.base.renderers.html.command.consumers.PathToRootConsumer +import org.jetbrains.dokka.base.renderers.html.command.consumers.ReplaceVersionsConsumer +import org.jetbrains.dokka.base.renderers.html.command.consumers.ResolveLinkConsumer +import org.jetbrains.dokka.base.resolvers.external.DefaultExternalLocationProviderFactory +import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProviderFactory +import org.jetbrains.dokka.base.resolvers.external.javadoc.JavadocExternalLocationProviderFactory +import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProviderFactory +import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory +import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat +import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider +import org.jetbrains.dokka.base.signatures.SignatureProvider +import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer +import org.jetbrains.dokka.base.transformers.documentables.* +import org.jetbrains.dokka.base.transformers.pages.DefaultSamplesTransformer +import org.jetbrains.dokka.base.transformers.pages.annotations.SinceKotlinTransformer +import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter +import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter +import org.jetbrains.dokka.base.transformers.pages.merger.* +import org.jetbrains.dokka.base.transformers.pages.sourcelinks.SourceLinksTransformer +import org.jetbrains.dokka.base.transformers.pages.tags.CustomTagContentProvider +import org.jetbrains.dokka.base.transformers.pages.tags.SinceKotlinTagContentProvider +import org.jetbrains.dokka.base.translators.documentables.DefaultDocumentableToPageTranslator +import org.jetbrains.dokka.generation.Generation +import org.jetbrains.dokka.plugability.* +import org.jetbrains.dokka.renderers.Renderer +import org.jetbrains.dokka.transformers.documentation.* +import org.jetbrains.dokka.transformers.pages.PageTransformer + +@Suppress("unused") +public class DokkaBase : DokkaPlugin() { + + public val preMergeDocumentableTransformer: ExtensionPoint by extensionPoint() + public val pageMergerStrategy: ExtensionPoint by extensionPoint() + public val commentsToContentConverter: ExtensionPoint by extensionPoint() + public val customTagContentProvider: ExtensionPoint by extensionPoint() + public val signatureProvider: ExtensionPoint by extensionPoint() + public val locationProviderFactory: ExtensionPoint by extensionPoint() + public val externalLocationProviderFactory: ExtensionPoint by extensionPoint() + public val outputWriter: ExtensionPoint by extensionPoint() + public val htmlPreprocessors: ExtensionPoint by extensionPoint() + + @Deprecated("It is not used anymore") + public val tabSortingStrategy: ExtensionPoint by extensionPoint() + public val immediateHtmlCommandConsumer: ExtensionPoint by extensionPoint() + + + public val singleGeneration: Extension by extending { + CoreExtensions.generation providing ::SingleModuleGeneration + } + + public val documentableMerger: Extension by extending { + CoreExtensions.documentableMerger providing ::DefaultDocumentableMerger + } + + public val deprecatedDocumentableFilter: Extension by extending { + preMergeDocumentableTransformer providing ::DeprecatedDocumentableFilterTransformer + } + + public val suppressedDocumentableFilter: Extension by extending { + preMergeDocumentableTransformer providing ::SuppressedByConfigurationDocumentableFilterTransformer + } + + public val suppressedBySuppressTagDocumentableFilter: Extension by extending { + preMergeDocumentableTransformer providing ::SuppressTagDocumentableFilter + } + + public val documentableVisibilityFilter: Extension by extending { + preMergeDocumentableTransformer providing ::DocumentableVisibilityFilterTransformer + } + + public val obviousFunctionsVisbilityFilter: Extension by extending { + preMergeDocumentableTransformer providing ::ObviousFunctionsDocumentableFilterTransformer + } + + public val inheritedEntriesVisbilityFilter: Extension by extending { + preMergeDocumentableTransformer providing ::InheritedEntriesDocumentableFilterTransformer + } + + public val kotlinArrayDocumentableReplacer: Extension by extending { + preMergeDocumentableTransformer providing ::KotlinArrayDocumentableReplacerTransformer + } + + public val emptyPackagesFilter: Extension by extending { + preMergeDocumentableTransformer providing ::EmptyPackagesFilterTransformer order { + after( + deprecatedDocumentableFilter, + suppressedDocumentableFilter, + documentableVisibilityFilter, + suppressedBySuppressTagDocumentableFilter, + obviousFunctionsVisbilityFilter, + inheritedEntriesVisbilityFilter, + ) + } + } + + public val emptyModulesFilter: Extension by extending { + preMergeDocumentableTransformer with EmptyModulesFilterTransformer() order { + after(emptyPackagesFilter) + } + } + + public val modulesAndPackagesDocumentation: Extension by extending { + preMergeDocumentableTransformer providing ::ModuleAndPackageDocumentationTransformer + } + + public val actualTypealiasAdder: Extension by extending { + CoreExtensions.documentableTransformer with ActualTypealiasAdder() + } + + public val kotlinSignatureProvider: Extension by extending { + signatureProvider providing ::KotlinSignatureProvider + } + + public val sinceKotlinTransformer: Extension by extending { + CoreExtensions.documentableTransformer providing ::SinceKotlinTransformer applyIf { + SinceKotlinTransformer.shouldDisplaySinceKotlin() + } order { + before(extensionsExtractor) + } + } + + public val inheritorsExtractor: Extension by extending { + CoreExtensions.documentableTransformer with InheritorsExtractorTransformer() + } + + public val undocumentedCodeReporter: Extension by extending { + CoreExtensions.documentableTransformer with ReportUndocumentedTransformer() + } + + public val extensionsExtractor: Extension by extending { + CoreExtensions.documentableTransformer with ExtensionExtractorTransformer() + } + + public val documentableToPageTranslator: Extension by extending { + CoreExtensions.documentableToPageTranslator providing ::DefaultDocumentableToPageTranslator + } + + public val docTagToContentConverter: Extension by extending { + commentsToContentConverter with DocTagToContentConverter() + } + + public val sinceKotlinTagContentProvider: Extension by extending { + customTagContentProvider with SinceKotlinTagContentProvider applyIf { + SinceKotlinTransformer.shouldDisplaySinceKotlin() + } + } + + public val pageMerger: Extension by extending { + CoreExtensions.pageTransformer providing ::PageMerger + } + + public val sourceSetMerger: Extension by extending { + CoreExtensions.pageTransformer providing ::SourceSetMergingPageTransformer + } + + public val fallbackMerger: Extension by extending { + pageMergerStrategy providing { ctx -> FallbackPageMergerStrategy(ctx.logger) } + } + + public val sameMethodNameMerger: Extension by extending { + pageMergerStrategy providing { ctx -> SameMethodNamePageMergerStrategy(ctx.logger) } order { + before(fallbackMerger) + } + } + + public val htmlRenderer: Extension by extending { + CoreExtensions.renderer providing ::HtmlRenderer + } + + public val locationProvider: Extension by extending { + locationProviderFactory providing ::DokkaLocationProviderFactory + } + + public val javadocLocationProvider: Extension by extending { + externalLocationProviderFactory providing ::JavadocExternalLocationProviderFactory + } + + public val dokkaLocationProvider: Extension by extending { + externalLocationProviderFactory providing ::DefaultExternalLocationProviderFactory + } + + public val fileWriter: Extension by extending { + outputWriter providing ::FileWriter + } + + public val rootCreator: Extension by extending { + htmlPreprocessors with RootCreator applyIf { !delayTemplateSubstitution } + } + + public val defaultSamplesTransformer: Extension by extending { + CoreExtensions.pageTransformer providing ::DefaultSamplesTransformer order { + before(pageMerger) + } + } + + public val sourceLinksTransformer: Extension by extending { + htmlPreprocessors providing ::SourceLinksTransformer order { after(rootCreator) } + } + + public val navigationPageInstaller: Extension by extending { + htmlPreprocessors providing ::NavigationPageInstaller order { after(rootCreator) } + } + + public val scriptsInstaller: Extension by extending { + htmlPreprocessors providing ::ScriptsInstaller order { after(rootCreator) } + } + + public val stylesInstaller: Extension by extending { + htmlPreprocessors providing ::StylesInstaller order { after(rootCreator) } + } + + public val assetsInstaller: Extension by extending { + htmlPreprocessors with AssetsInstaller order { after(rootCreator) } applyIf { !delayTemplateSubstitution } + } + + public val customResourceInstaller: Extension by extending { + htmlPreprocessors providing { ctx -> CustomResourceInstaller(ctx) } order { + after(stylesInstaller) + after(scriptsInstaller) + after(assetsInstaller) + } + } + + public val packageListCreator: Extension by extending { + htmlPreprocessors providing { + PackageListCreator(it, RecognizedLinkFormat.DokkaHtml) + } order { after(rootCreator) } + } + + public val sourcesetDependencyAppender: Extension by extending { + htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } + } + + public val resolveLinkConsumer: Extension by extending { + immediateHtmlCommandConsumer with ResolveLinkConsumer + } + public val replaceVersionConsumer: Extension by extending { + immediateHtmlCommandConsumer providing ::ReplaceVersionsConsumer + } + public val pathToRootConsumer: Extension by extending { + immediateHtmlCommandConsumer with PathToRootConsumer + } + public val baseSearchbarDataInstaller: Extension by extending { + htmlPreprocessors providing ::SearchbarDataInstaller order { after(sourceLinksTransformer) } + } + + // + @Suppress("DEPRECATION_ERROR") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val kotlinAnalysis: ExtensionPoint by extensionPoint() + + @Suppress("DEPRECATION_ERROR") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val externalDocumentablesProvider: ExtensionPoint by extensionPoint() + + @Suppress("DEPRECATION_ERROR") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val externalClasslikesTranslator: ExtensionPoint by extensionPoint() + + @Suppress("DeprecatedCallableAddReplaceWith") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val descriptorToDocumentableTranslator: org.jetbrains.dokka.plugability.Extension + get() = throw org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError() + + @Suppress("DeprecatedCallableAddReplaceWith") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val psiToDocumentableTranslator: org.jetbrains.dokka.plugability.Extension + get() = throw org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError() + + @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val defaultKotlinAnalysis: org.jetbrains.dokka.plugability.Extension + get() = throw org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError() + + @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val defaultExternalDocumentablesProvider: org.jetbrains.dokka.plugability.Extension + get() = throw org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError() + + @Suppress("DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") + @Deprecated(message = org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val defaultExternalClasslikesTranslator: org.jetbrains.dokka.plugability.Extension + get() = throw org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError() + // + + @OptIn(DokkaPluginApiPreview::class) + override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement = + PluginApiPreviewAcknowledgement +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBaseConfiguration.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBaseConfiguration.kt new file mode 100644 index 00000000..34195f65 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/DokkaBaseConfiguration.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base + +import org.jetbrains.dokka.plugability.ConfigurableBlock +import java.io.File +import java.time.Year + +public data class DokkaBaseConfiguration( + var customStyleSheets: List = defaultCustomStyleSheets, + var customAssets: List = defaultCustomAssets, + var separateInheritedMembers: Boolean = separateInheritedMembersDefault, + var footerMessage: String = defaultFooterMessage, + var mergeImplicitExpectActualDeclarations: Boolean = mergeImplicitExpectActualDeclarationsDefault, + var templatesDir: File? = defaultTemplatesDir, + var homepageLink: String? = null, +) : ConfigurableBlock { + public companion object { + public val defaultFooterMessage: String = "© ${Year.now().value} Copyright" + public val defaultCustomStyleSheets: List = emptyList() + public val defaultCustomAssets: List = emptyList() + public const val separateInheritedMembersDefault: Boolean = false + public const val mergeImplicitExpectActualDeclarationsDefault: Boolean = false + public val defaultTemplatesDir: File? = null + } +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/AnalysisApiDeprecatedError.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/AnalysisApiDeprecatedError.kt new file mode 100644 index 00000000..52280b3e --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/AnalysisApiDeprecatedError.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.deprecated + +import org.jetbrains.dokka.InternalDokkaApi + +// TODO all API that mentions this message or error can be removed in Dokka >= 2.1 + +internal const val ANALYSIS_API_DEPRECATION_MESSAGE = + "Dokka's Analysis API has been reworked. Please, see the following issue for details and migration options: " + + "https://github.com/Kotlin/dokka/issues/3099" + +@InternalDokkaApi +public class AnalysisApiDeprecatedError : Error(ANALYSIS_API_DEPRECATION_MESSAGE) diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/KotlinAnalysisDeprecatedApi.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/KotlinAnalysisDeprecatedApi.kt new file mode 100644 index 00000000..1d9e7e9f --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/KotlinAnalysisDeprecatedApi.kt @@ -0,0 +1,77 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("PackageDirectoryMismatch", "FunctionName", "UNUSED_PARAMETER", "unused", "DEPRECATION_ERROR", + "DeprecatedCallableAddReplaceWith", "unused" +) + +package org.jetbrains.dokka.analysis + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaSourceSetID +import org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE +import org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.utilities.DokkaLogger +import java.io.Closeable + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public abstract class KotlinAnalysis( + private val parent: KotlinAnalysis? = null +) : Closeable { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public operator fun get(key: DokkaConfiguration.DokkaSourceSet): AnalysisContext = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public operator fun get(key: DokkaSourceSetID): AnalysisContext = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + protected abstract fun find(sourceSetID: DokkaSourceSetID): AnalysisContext? +} + +public class AnalysisContext(environment: Any, facade: Any, private val analysisEnvironment: Any) : Closeable { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val environment: Any get() = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public val facade: Any get() = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public operator fun component1(): Any = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public operator fun component2(): Any = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + override fun close() { throw AnalysisApiDeprecatedError() } +} + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public class DokkaAnalysisConfiguration(public val ignoreCommonBuiltIns: Boolean = false) + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public fun KotlinAnalysis(context: DokkaContext): KotlinAnalysis = throw AnalysisApiDeprecatedError() + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public fun KotlinAnalysis( + sourceSets: List, + logger: DokkaLogger, + analysisConfiguration: DokkaAnalysisConfiguration = DokkaAnalysisConfiguration() +): KotlinAnalysis = throw AnalysisApiDeprecatedError() + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public fun ProjectKotlinAnalysis( + sourceSets: List, + logger: DokkaLogger, + analysisConfiguration: DokkaAnalysisConfiguration = DokkaAnalysisConfiguration() +): KotlinAnalysis = throw AnalysisApiDeprecatedError() + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public fun SamplesKotlinAnalysis( + sourceSets: List, + logger: DokkaLogger, + projectKotlinAnalysis: KotlinAnalysis, + analysisConfiguration: DokkaAnalysisConfiguration = DokkaAnalysisConfiguration() +): KotlinAnalysis = throw AnalysisApiDeprecatedError() + diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersDeprecatedAPI.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersDeprecatedAPI.kt new file mode 100644 index 00000000..55b1daab --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersDeprecatedAPI.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("PackageDirectoryMismatch", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith", "unused") + +package org.jetbrains.dokka.base.parsers + +import org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE +import org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.doc.DocTag +import org.jetbrains.dokka.model.doc.DocumentationNode +import org.jetbrains.dokka.model.doc.TagWrapper + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public abstract class Parser { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public open fun parseStringToDocNode(extractedString: String): DocTag = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public open fun preparse(text: String): String = throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public open fun parseTagWithBody(tagName: String, content: String): TagWrapper = throw AnalysisApiDeprecatedError() +} + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public open class MarkdownParser( + private val externalDri: (String) -> DRI?, + private val kdocLocation: String?, +) : Parser() { + public companion object { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public fun parseFromKDocTag( + @Suppress("UNUSED_PARAMETER") kDocTag: Any?, + @Suppress("UNUSED_PARAMETER") externalDri: (String) -> DRI?, + @Suppress("UNUSED_PARAMETER") kdocLocation: String?, + @Suppress("UNUSED_PARAMETER") parseWithChildren: Boolean = true + ): DocumentationNode = throw AnalysisApiDeprecatedError() + } +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersFactoriesDeprecatedAPI.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersFactoriesDeprecatedAPI.kt new file mode 100644 index 00000000..7b84803c --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/ParsersFactoriesDeprecatedAPI.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("DeprecatedCallableAddReplaceWith", "PackageDirectoryMismatch", "unused") + +package org.jetbrains.dokka.base.parsers.factories + +import org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE +import org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.doc.DocTag + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public object DocTagsFromStringFactory { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public fun getInstance( + @Suppress("UNUSED_PARAMETER") name: String, + @Suppress("UNUSED_PARAMETER") children: List = emptyList(), + @Suppress("UNUSED_PARAMETER") params: Map = emptyMap(), + @Suppress("UNUSED_PARAMETER") body: String? = null, + @Suppress("UNUSED_PARAMETER") dri: DRI? = null, + ): DocTag = throw AnalysisApiDeprecatedError() +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorDescriptorsDeprecatedAPI.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorDescriptorsDeprecatedAPI.kt new file mode 100644 index 00000000..87d82ccf --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorDescriptorsDeprecatedAPI.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("PackageDirectoryMismatch", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith", "unused") + +package org.jetbrains.dokka.base.translators.descriptors + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE +import org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.DClasslike +import org.jetbrains.dokka.model.DModule +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public fun interface ExternalDocumentablesProvider { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public fun findClasslike(dri: DRI, sourceSet: DokkaConfiguration.DokkaSourceSet): DClasslike? +} + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public class DefaultExternalDocumentablesProvider( + @Suppress("UNUSED_PARAMETER") context: DokkaContext +) : ExternalDocumentablesProvider { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + override fun findClasslike(dri: DRI, sourceSet: DokkaConfiguration.DokkaSourceSet): DClasslike = + throw AnalysisApiDeprecatedError() +} + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public fun interface ExternalClasslikesTranslator { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + public fun translateClassDescriptor(descriptor: Any, sourceSet: DokkaConfiguration.DokkaSourceSet): DClasslike +} + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public class DefaultDescriptorToDocumentableTranslator( + private val context: DokkaContext +) : AsyncSourceToDocumentableTranslator, ExternalClasslikesTranslator { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + override suspend fun invokeSuspending(sourceSet: DokkaConfiguration.DokkaSourceSet, context: DokkaContext, ): DModule = + throw AnalysisApiDeprecatedError() + + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + override fun translateClassDescriptor(descriptor: Any, sourceSet: DokkaConfiguration.DokkaSourceSet): DClasslike = + throw AnalysisApiDeprecatedError() +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorPsiDeprecatedAPI.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorPsiDeprecatedAPI.kt new file mode 100644 index 00000000..1906a7b1 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/deprecated/TranslatorPsiDeprecatedAPI.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("PackageDirectoryMismatch", "DeprecatedCallableAddReplaceWith", "unused") + +package org.jetbrains.dokka.base.translators.psi + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.base.deprecated.ANALYSIS_API_DEPRECATION_MESSAGE +import org.jetbrains.dokka.base.deprecated.AnalysisApiDeprecatedError +import org.jetbrains.dokka.model.DModule +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator + +@Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) +public class DefaultPsiToDocumentableTranslator( + @Suppress("UNUSED_PARAMETER") context: DokkaContext, +) : AsyncSourceToDocumentableTranslator { + @Deprecated(message = ANALYSIS_API_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR) + override suspend fun invokeSuspending( + sourceSet: DokkaConfiguration.DokkaSourceSet, + context: DokkaContext, + ): DModule = throw AnalysisApiDeprecatedError() +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/generation/SingleModuleGeneration.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/generation/SingleModuleGeneration.kt new file mode 100644 index 00000000..8ea109b9 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/generation/SingleModuleGeneration.kt @@ -0,0 +1,131 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.generation + +import kotlinx.coroutines.* +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaException +import org.jetbrains.dokka.Timer +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.generation.Generation +import org.jetbrains.dokka.generation.exitGenerationGracefully +import org.jetbrains.dokka.model.DModule +import org.jetbrains.dokka.pages.RootPageNode +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.query +import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator +import org.jetbrains.dokka.utilities.parallelMap +import org.jetbrains.dokka.utilities.report + +public class SingleModuleGeneration(private val context: DokkaContext) : Generation { + + override fun Timer.generate() { + report("Validity check") + validityCheck(context) + + // Step 1: translate sources into documentables & transform documentables (change internally) + report("Creating documentation models") + val modulesFromPlatforms = createDocumentationModels() + + report("Transforming documentation model before merging") + val transformedDocumentationBeforeMerge = transformDocumentationModelBeforeMerge(modulesFromPlatforms) + + report("Merging documentation models") + val transformedDocumentationAfterMerge = mergeDocumentationModels(transformedDocumentationBeforeMerge) + ?: exitGenerationGracefully("Nothing to document") + + report("Transforming documentation model after merging") + val transformedDocumentation = transformDocumentationModelAfterMerge(transformedDocumentationAfterMerge) + + // Step 2: Generate pages & transform them (change internally) + report("Creating pages") + val pages = createPages(transformedDocumentation) + + report("Transforming pages") + val transformedPages = transformPages(pages) + + // Step 3: Rendering + report("Rendering") + render(transformedPages) + + report("Running post-actions") + runPostActions() + + reportAfterRendering() + } + + override val generationName: String = "documentation for ${context.configuration.moduleName}" + + /** + * Implementation note: it runs in a separated single thread due to existing support of coroutines (see #2936) + */ + @OptIn(DelicateCoroutinesApi::class, ExperimentalCoroutinesApi::class) + public fun createDocumentationModels(): List = newSingleThreadContext("Generating documentable model").use { coroutineContext -> // see https://github.com/Kotlin/dokka/issues/3151 + runBlocking(coroutineContext) { + context.configuration.sourceSets.parallelMap { sourceSet -> translateSources(sourceSet, context) }.flatten() + .also { modules -> if (modules.isEmpty()) exitGenerationGracefully("Nothing to document") } + } + } + + + public fun transformDocumentationModelBeforeMerge(modulesFromPlatforms: List): List { + return context.plugin() + .query { preMergeDocumentableTransformer } + .fold(modulesFromPlatforms) { acc, t -> t(acc) } + } + + public fun mergeDocumentationModels(modulesFromPlatforms: List): DModule? = + context.single(CoreExtensions.documentableMerger).invoke(modulesFromPlatforms) + + public fun transformDocumentationModelAfterMerge(documentationModel: DModule): DModule = + context[CoreExtensions.documentableTransformer].fold(documentationModel) { acc, t -> t(acc, context) } + + public fun createPages(transformedDocumentation: DModule): RootPageNode = + context.single(CoreExtensions.documentableToPageTranslator).invoke(transformedDocumentation) + + public fun transformPages(pages: RootPageNode): RootPageNode = + context[CoreExtensions.pageTransformer].fold(pages) { acc, t -> t(acc) } + + public fun render(transformedPages: RootPageNode) { + context.single(CoreExtensions.renderer).render(transformedPages) + } + + public fun runPostActions() { + context[CoreExtensions.postActions].forEach { it() } + } + + public fun validityCheck(context: DokkaContext) { + val (preGenerationCheckResult, checkMessages) = context[CoreExtensions.preGenerationCheck].fold( + Pair(true, emptyList()) + ) { acc, checker -> checker() + acc } + if (!preGenerationCheckResult) throw DokkaException( + "Pre-generation validity check failed: ${checkMessages.joinToString(",")}" + ) + } + + public fun reportAfterRendering() { + context.unusedPoints.takeIf { it.isNotEmpty() }?.also { + context.logger.info("Unused extension points found: ${it.joinToString(", ")}") + } + + context.logger.report() + + if (context.configuration.failOnWarning && (context.logger.warningsCount > 0 || context.logger.errorsCount > 0)) { + throw DokkaException( + "Failed with warningCount=${context.logger.warningsCount} and errorCount=${context.logger.errorsCount}" + ) + } + } + + private suspend fun translateSources(sourceSet: DokkaConfiguration.DokkaSourceSet, context: DokkaContext) = + context[CoreExtensions.sourceToDocumentableTranslator].parallelMap { translator -> + when (translator) { + is AsyncSourceToDocumentableTranslator -> translator.invokeSuspending(sourceSet, context) + else -> translator.invoke(sourceSet, context) + } + } +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/DefaultRenderer.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/DefaultRenderer.kt new file mode 100644 index 00000000..eed7794e --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/DefaultRenderer.kt @@ -0,0 +1,257 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers + +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking +import org.jetbrains.dokka.DokkaException +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.resolvers.local.LocationProvider +import org.jetbrains.dokka.model.DisplaySourceSet +import org.jetbrains.dokka.pages.* +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.querySingle +import org.jetbrains.dokka.renderers.Renderer +import org.jetbrains.dokka.transformers.pages.PageTransformer + +public abstract class DefaultRenderer( + protected val context: DokkaContext +) : Renderer { + + protected val outputWriter: OutputWriter = context.plugin().querySingle { outputWriter } + + protected lateinit var locationProvider: LocationProvider + private set + + protected open val preprocessors: Iterable = emptyList() + + public abstract fun T.buildHeader(level: Int, node: ContentHeader, content: T.() -> Unit) + public abstract fun T.buildLink(address: String, content: T.() -> Unit) + public abstract fun T.buildList( + node: ContentList, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) + + public abstract fun T.buildLineBreak() + public open fun T.buildLineBreak(node: ContentBreakLine, pageContext: ContentPage) { + buildLineBreak() + } + + public abstract fun T.buildResource(node: ContentEmbeddedResource, pageContext: ContentPage) + public abstract fun T.buildTable( + node: ContentTable, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) + + public abstract fun T.buildText(textNode: ContentText) + public abstract fun T.buildNavigation(page: PageNode) + + public abstract fun buildPage(page: ContentPage, content: (T, ContentPage) -> Unit): String + public abstract fun buildError(node: ContentNode) + + public open fun T.buildPlatformDependent( + content: PlatformHintedContent, + pageContext: ContentPage, + sourceSetRestriction: Set? + ) { + buildContentNode(content.inner, pageContext) + } + + public open fun T.buildGroup( + node: ContentGroup, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) { + wrapGroup(node, pageContext) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } } + } + + public open fun T.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) { + node.children.forEach { it.build(this, pageContext) } + } + + public open fun T.wrapGroup(node: ContentGroup, pageContext: ContentPage, childrenCallback: T.() -> Unit) { + childrenCallback() + } + + public open fun T.buildText( + nodes: List, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) { + nodes.forEach { it.build(this, pageContext, sourceSetRestriction) } + } + + public open fun T.buildCodeBlock(code: ContentCodeBlock, pageContext: ContentPage) { + code.children.forEach { it.build(this, pageContext) } + } + + public open fun T.buildCodeInline(code: ContentCodeInline, pageContext: ContentPage) { + code.children.forEach { it.build(this, pageContext) } + } + + public open fun T.buildHeader( + node: ContentHeader, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) { + buildHeader(node.level, node) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } } + } + + public open fun ContentNode.build( + builder: T, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) { + builder.buildContentNode(this, pageContext, sourceSetRestriction) + } + + public fun T.buildContentNode( + node: ContentNode, + pageContext: ContentPage, + sourceSetRestriction: DisplaySourceSet + ) { + buildContentNode(node, pageContext, setOf(sourceSetRestriction)) + } + + public open fun T.buildContentNode( + node: ContentNode, + pageContext: ContentPage, + sourceSetRestriction: Set? = null + ) { + if (sourceSetRestriction.isNullOrEmpty() || node.sourceSets.any { it in sourceSetRestriction }) { + when (node) { + is ContentText -> buildText(node) + is ContentHeader -> buildHeader(node, pageContext, sourceSetRestriction) + is ContentCodeBlock -> buildCodeBlock(node, pageContext) + is ContentCodeInline -> buildCodeInline(node, pageContext) + is ContentDRILink -> buildDRILink(node, pageContext, sourceSetRestriction) + is ContentResolvedLink -> buildResolvedLink(node, pageContext, sourceSetRestriction) + is ContentEmbeddedResource -> buildResource(node, pageContext) + is ContentList -> buildList(node, pageContext, sourceSetRestriction) + is ContentTable -> buildTable(node, pageContext, sourceSetRestriction) + is ContentGroup -> buildGroup(node, pageContext, sourceSetRestriction) + is ContentBreakLine -> buildLineBreak(node, pageContext) + is PlatformHintedContent -> buildPlatformDependent(node, pageContext, sourceSetRestriction) + is ContentDivergentGroup -> buildDivergent(node, pageContext) + is ContentDivergentInstance -> buildDivergentInstance(node, pageContext) + else -> buildError(node) + } + } + } + + public open fun T.buildDRILink( + node: ContentDRILink, + pageContext: ContentPage, + sourceSetRestriction: Set? + ) { + locationProvider.resolve(node.address, node.sourceSets, pageContext)?.let { address -> + buildLink(address) { + buildText(node.children, pageContext, sourceSetRestriction) + } + } ?: buildText(node.children, pageContext, sourceSetRestriction) + } + + public open fun T.buildResolvedLink( + node: ContentResolvedLink, + pageContext: ContentPage, + sourceSetRestriction: Set? + ) { + buildLink(node.address) { + buildText(node.children, pageContext, sourceSetRestriction) + } + } + + public open fun T.buildDivergentInstance(node: ContentDivergentInstance, pageContext: ContentPage) { + node.before?.build(this, pageContext) + node.divergent.build(this, pageContext) + node.after?.build(this, pageContext) + } + + public open fun buildPageContent(context: T, page: ContentPage) { + context.buildNavigation(page) + page.content.build(context, page) + } + + public open suspend fun renderPage(page: PageNode) { + val path by lazy { + locationProvider.resolve(page, skipExtension = true) + ?: throw DokkaException("Cannot resolve path for ${page.name}") + } + when (page) { + is ContentPage -> outputWriter.write(path, buildPage(page) { c, p -> buildPageContent(c, p) }, ".html") + is RendererSpecificPage -> when (val strategy = page.strategy) { + is RenderingStrategy.Copy -> outputWriter.writeResources(strategy.from, path) + is RenderingStrategy.Write -> outputWriter.write(path, strategy.text, "") + is RenderingStrategy.Callback -> outputWriter.write(path, strategy.instructions(this, page), ".html") + is RenderingStrategy.DriLocationResolvableWrite -> outputWriter.write( + path, + strategy.contentToResolve { dri, sourcesets -> + locationProvider.resolve(dri, sourcesets) + }, + "" + ) + is RenderingStrategy.PageLocationResolvableWrite -> outputWriter.write( + path, + strategy.contentToResolve { pageToLocate, context -> + locationProvider.resolve(pageToLocate, context) + }, + "" + ) + RenderingStrategy.DoNothing -> Unit + } + else -> throw AssertionError( + "Page ${page.name} cannot be rendered by renderer as it is not renderer specific nor contains content" + ) + } + } + + private suspend fun renderPages(root: PageNode) { + coroutineScope { + renderPage(root) + + root.children.forEach { + launch { renderPages(it) } + } + } + } + + override fun render(root: RootPageNode) { + val newRoot = preprocessors.fold(root) { acc, t -> t(acc) } + + locationProvider = + context.plugin().querySingle { locationProviderFactory }.getLocationProvider(newRoot) + + runBlocking(Dispatchers.Default) { + renderPages(newRoot) + } + } + + protected fun ContentDivergentGroup.groupDivergentInstances( + pageContext: ContentPage, + beforeTransformer: (ContentDivergentInstance, ContentPage, DisplaySourceSet) -> String, + afterTransformer: (ContentDivergentInstance, ContentPage, DisplaySourceSet) -> String + ): Map> = + children.flatMap { instance -> + instance.sourceSets.map { sourceSet -> + Pair(instance, sourceSet) to Pair( + beforeTransformer(instance, pageContext, sourceSet), + afterTransformer(instance, pageContext, sourceSet) + ) + } + }.groupBy( + Pair::second, + Pair::first + ) +} + +internal typealias SerializedBeforeAndAfter = Pair +internal typealias InstanceWithSource = Pair + +public fun ContentPage.sourceSets(): Set = this.content.sourceSets diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/FileWriter.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/FileWriter.kt new file mode 100644 index 00000000..1a1c3b42 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/FileWriter.kt @@ -0,0 +1,109 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers + +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.sync.Mutex +import kotlinx.coroutines.sync.withLock +import kotlinx.coroutines.withContext +import org.jetbrains.dokka.plugability.DokkaContext +import java.io.File +import java.io.IOException +import java.net.URI +import java.nio.file.* + +public class FileWriter( + public val context: DokkaContext +): OutputWriter { + private val createdFiles: MutableSet = mutableSetOf() + private val createdFilesMutex = Mutex() + private val jarUriPrefix = "jar:file:" + private val root = context.configuration.outputDir + + override suspend fun write(path: String, text: String, ext: String) { + if (checkFileCreated(path)) return + + try { + val dir = Paths.get(root.absolutePath, path.dropLastWhile { it != '/' }).toFile() + withContext(Dispatchers.IO) { + dir.mkdirsOrFail() + Files.write(Paths.get(root.absolutePath, "$path$ext"), text.lines()) + } + } catch (e: Throwable) { + context.logger.error("Failed to write $this. ${e.message}") + e.printStackTrace() + } + } + + private suspend fun checkFileCreated(path: String): Boolean = createdFilesMutex.withLock { + if (createdFiles.contains(path)) { + context.logger.error("An attempt to write ${root}/$path several times!") + return true + } + createdFiles.add(path) + return false + } + + override suspend fun writeResources(pathFrom: String, pathTo: String) { + if (javaClass.getResource(pathFrom)?.toURI()?.toString()?.startsWith(jarUriPrefix) == true) { + copyFromJar(pathFrom, pathTo) + } else { + copyFromDirectory(pathFrom, pathTo) + } + } + + + private suspend fun copyFromDirectory(pathFrom: String, pathTo: String) { + val dest = Paths.get(root.path, pathTo).toFile() + val uri = javaClass.getResource(pathFrom)?.toURI() + val file = uri?.let { File(it) } ?: File(pathFrom) + withContext(Dispatchers.IO) { + file.copyRecursively(dest, true) + } + } + + private suspend fun copyFromJar(pathFrom: String, pathTo: String) { + val rebase = fun(path: String) = + "$pathTo/${path.removePrefix(pathFrom)}" + val dest = Paths.get(root.path, pathTo).toFile() + if(dest.isDirectory){ + dest.mkdirsOrFail() + } else { + dest.parentFile.mkdirsOrFail() + } + val uri = javaClass.getResource(pathFrom).toURI() + val fs = getFileSystemForURI(uri) + val path = fs.getPath(pathFrom) + for (file in Files.walk(path).iterator()) { + if (Files.isDirectory(file)) { + val dirPath = file.toAbsolutePath().toString() + withContext(Dispatchers.IO) { + Paths.get(root.path, rebase(dirPath)).toFile().mkdirsOrFail() + } + } else { + val filePath = file.toAbsolutePath().toString() + withContext(Dispatchers.IO) { + Paths.get(root.path, rebase(filePath)).toFile().writeBytes( + this@FileWriter.javaClass.getResourceAsStream(filePath).use { it?.readBytes() } + ?: throw IllegalStateException("Can not get a resource from $filePath") + ) + } + } + } + } + + private fun File.mkdirsOrFail() { + if (!mkdirs() && !exists()) { + throw IOException("Failed to create directory $this") + } + } + + private fun getFileSystemForURI(uri: URI): FileSystem = + try { + FileSystems.newFileSystem(uri, emptyMap()) + } catch (e: FileSystemAlreadyExistsException) { + FileSystems.getFileSystem(uri) + } +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/OutputWriter.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/OutputWriter.kt new file mode 100644 index 00000000..3fdd1802 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/OutputWriter.kt @@ -0,0 +1,11 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers + +public interface OutputWriter { + + public suspend fun write(path: String, text: String, ext: String) + public suspend fun writeResources(pathFrom: String, pathTo: String) +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/PackageListService.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/PackageListService.kt new file mode 100644 index 00000000..3ed6cd21 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/PackageListService.kt @@ -0,0 +1,80 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers + +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.resolvers.shared.LinkFormat +import org.jetbrains.dokka.base.resolvers.shared.PackageList.Companion.DOKKA_PARAM_PREFIX +import org.jetbrains.dokka.base.resolvers.shared.PackageList.Companion.MODULE_DELIMITER +import org.jetbrains.dokka.base.resolvers.shared.PackageList.Companion.SINGLE_MODULE_NAME +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.pages.* +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.querySingle + +public class PackageListService( + public val context: DokkaContext, + public val rootPage: RootPageNode +) { + + public fun createPackageList(module: ModulePage, format: LinkFormat): String { + + val packages = mutableSetOf() + val nonStandardLocations = mutableMapOf() + + val locationProvider = + context.plugin().querySingle { locationProviderFactory }.getLocationProvider(rootPage) + + fun visit(node: PageNode) { + if (node is PackagePage) { + node.name + .takeUnless { name -> name.startsWith("[") && name.endsWith("]") } // Do not include the package name for declarations without one + ?.let { packages.add(it) } + } + + val contentPage = node as? ContentPage + contentPage?.dri?.forEach { dri -> + val nodeLocation = locationProvider.resolve(node, context = module, skipExtension = true) + ?: run { context.logger.error("Cannot resolve path for ${node.name}!"); null } + + if (dri != DRI.topLevel && locationProvider.expectedLocationForDri(dri) != nodeLocation) { + nonStandardLocations[dri.toString()] = "$nodeLocation.${format.linkExtension}" + } + } + + node.children.forEach { visit(it) } + } + + visit(module) + return renderPackageList( + nonStandardLocations = nonStandardLocations, + modules = mapOf(SINGLE_MODULE_NAME to packages), + format = format.formatName, + linkExtension = format.linkExtension + ) + } + + public companion object { + public fun renderPackageList( + nonStandardLocations: Map, + modules: Map>, + format: String, + linkExtension: String + ): String = buildString { + appendLine("$DOKKA_PARAM_PREFIX.format:${format}") + appendLine("$DOKKA_PARAM_PREFIX.linkExtension:${linkExtension}") + nonStandardLocations.map { (signature, location) -> + "$DOKKA_PARAM_PREFIX.location:$signature\u001f$location" + }.sorted().joinTo(this, separator = "\n", postfix = "\n") + + modules.mapNotNull { (module, packages) -> + ("$MODULE_DELIMITER$module\n".takeIf { module != SINGLE_MODULE_NAME }.orEmpty() + + packages.filter(String::isNotBlank).sorted().joinToString(separator = "\n")) + .takeIf { packages.isNotEmpty() } + }.joinTo(this, separator = "\n", postfix = "\n") + } + } +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/TabSortingStrategy.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/TabSortingStrategy.kt new file mode 100644 index 00000000..665b6717 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/TabSortingStrategy.kt @@ -0,0 +1,11 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers + +import org.jetbrains.dokka.pages.ContentNode + +public interface TabSortingStrategy { + public fun sort(tabs: Collection) : List +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/contentTypeChecking.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/contentTypeChecking.kt new file mode 100644 index 00000000..0fcb0efb --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/contentTypeChecking.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers + +import org.jetbrains.dokka.base.renderers.HtmlFileExtensions.imageExtensions +import org.jetbrains.dokka.pages.ContentEmbeddedResource +import java.io.File + +public fun ContentEmbeddedResource.isImage(): Boolean { + return File(address).extension.toLowerCase() in imageExtensions +} + +public val String.URIExtension: String + get() = substringBefore('?').substringAfterLast('.') + +public fun String.isImage(): Boolean = + URIExtension in imageExtensions + +public object HtmlFileExtensions { + public val imageExtensions: Set = setOf("png", "jpg", "jpeg", "gif", "bmp", "tif", "webp", "svg") +} + diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlContent.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlContent.kt new file mode 100644 index 00000000..1ef6e04c --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlContent.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers.html + +import org.jetbrains.dokka.pages.ContentBreakLine +import org.jetbrains.dokka.pages.Style + + +/** + * Html-specific style that represents
tag if used in conjunction with [ContentBreakLine] + */ +internal object HorizontalBreakLineStyle : Style { + // this exists as a simple internal solution to avoid introducing unnecessary public API on content level. + // If you have the need to implement proper horizontal divider (i.e to support `---` markdown element), + // consider removing this and providing proper API for all formats and levels +} diff --git a/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlRenderer.kt b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlRenderer.kt new file mode 100644 index 00000000..083876d5 --- /dev/null +++ b/dokka-subprojects/plugin-base/src/main/kotlin/org/jetbrains/dokka/base/renderers/html/HtmlRenderer.kt @@ -0,0 +1,1013 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package org.jetbrains.dokka.base.renderers.html + +import kotlinx.html.* +import kotlinx.html.stream.createHTML +import org.jetbrains.dokka.DokkaSourceSetID +import org.jetbrains.dokka.Platform +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.renderers.* +import org.jetbrains.dokka.base.renderers.html.command.consumers.ImmediateResolutionTagConsumer +import org.jetbrains.dokka.base.renderers.html.innerTemplating.DefaultTemplateModelFactory +import org.jetbrains.dokka.base.renderers.html.innerTemplating.DefaultTemplateModelMerger +import org.jetbrains.dokka.base.renderers.html.innerTemplating.DokkaTemplateTypes +import org.jetbrains.dokka.base.renderers.html.innerTemplating.HtmlTemplater +import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint +import org.jetbrains.dokka.base.resolvers.local.DokkaBaseLocationProvider +import org.jetbrains.dokka.base.templating.* +import org.jetbrains.dokka.base.transformers.documentables.CallableExtensions +import org.jetbrains.dokka.base.translators.documentables.shouldDocumentConstructors +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.* +import org.jetbrains.dokka.model.properties.PropertyContainer +import org.jetbrains.dokka.model.properties.WithExtraProperties +import org.jetbrains.dokka.pages.* +import org.jetbrains.dokka.pages.HtmlContent +import org.jetbrains.dokka.plugability.* +import org.jetbrains.dokka.transformers.pages.PageTransformer +import org.jetbrains.dokka.utilities.htmlEscape + +internal const val TEMPLATE_REPLACEMENT: String = "###" +internal const val TOGGLEABLE_CONTENT_TYPE_ATTR = "data-togglable" + +public open class HtmlRenderer( + context: DokkaContext +) : DefaultRenderer(context) { + private val sourceSetDependencyMap: Map> = + context.configuration.sourceSets.associate { sourceSet -> + sourceSet.sourceSetID to context.configuration.sourceSets + .map { it.sourceSetID } + .filter { it in sourceSet.dependentSourceSets } + } + + private val templateModelFactories = listOf(DefaultTemplateModelFactory(context)) // TODO: Make extension point + private val templateModelMerger = DefaultTemplateModelMerger() + private val templater = HtmlTemplater(context).apply { + setupSharedModel(templateModelMerger.invoke(templateModelFactories) { buildSharedModel() }) + } + + private var shouldRenderSourceSetTabs: Boolean = false + + override val preprocessors: List = context.plugin().query { htmlPreprocessors } + + /** + * Tabs themselves are created in HTML plugin since, currently, only HTML format supports them. + * [TabbedContentType] is used to mark content that should be inside tab content. + * A tab can display multiple [TabbedContentType]. + * The content style [ContentStyle.TabbedContent] is used to determine where tabs will be generated. + * + * @see TabbedContentType + * @see ContentStyle.TabbedContent + */ + private fun createTabs(pageContext: ContentPage): List { + return when(pageContext) { + is ClasslikePage -> createTabsForClasslikes(pageContext) + is PackagePage -> createTabsForPackage(pageContext) + else -> throw IllegalArgumentException("Page ${pageContext.name} cannot have tabs") + } + } + + private fun createTabsForClasslikes(page: ClasslikePage): List { + val documentables = page.documentables + val csEnum = documentables.filterIsInstance() + val csWithConstructor = documentables.filterIsInstance() + val scopes = documentables.filterIsInstance() + val constructorsToDocumented = csWithConstructor.flatMap { it.constructors } + + val containsRenderableConstructors = constructorsToDocumented.isNotEmpty() && documentables.shouldDocumentConstructors() + val containsRenderableMembers = + containsRenderableConstructors || scopes.any { it.classlikes.isNotEmpty() || it.functions.isNotEmpty() || it.properties.isNotEmpty() } + + @Suppress("UNCHECKED_CAST") + val extensions = (documentables as List>).flatMap { + it.extra[CallableExtensions]?.extensions + ?.filterIsInstance().orEmpty() + } + .distinctBy { it.sourceSets to it.dri } // [Documentable] has expensive equals/hashCode at the moment, see #2620 + return listOfNotNull( + if(!containsRenderableMembers) null else + ContentTab( + "Members", + listOf( + BasicTabbedContentType.CONSTRUCTOR, + BasicTabbedContentType.TYPE, + BasicTabbedContentType.PROPERTY, + BasicTabbedContentType.FUNCTION + ) + ), + if (extensions.isEmpty()) null else ContentTab( + "Members & Extensions", + listOf( + BasicTabbedContentType.CONSTRUCTOR, + BasicTabbedContentType.TYPE, + BasicTabbedContentType.PROPERTY, + BasicTabbedContentType.FUNCTION, + BasicTabbedContentType.EXTENSION_PROPERTY, + BasicTabbedContentType.EXTENSION_FUNCTION + ) + ), + if(csEnum.isEmpty()) null else ContentTab( + "Entries", + listOf( + BasicTabbedContentType.ENTRY + ) + ) + ) + } + + private fun createTabsForPackage(page: PackagePage): List { + val p = page.documentables.single() as DPackage + return listOfNotNull( + if (p.typealiases.isEmpty() && p.classlikes.isEmpty()) null else ContentTab( + "Types", + listOf( + BasicTabbedContentType.TYPE, + ) + ), + if (p.functions.isEmpty()) null else ContentTab( + "Functions", + listOf( + BasicTabbedContentType.FUNCTION, + BasicTabbedContentType.EXTENSION_FUNCTION, + ) + ), + if (p.properties.isEmpty()) null else ContentTab( + "Properties", + listOf( + BasicTabbedContentType.PROPERTY, + BasicTabbedContentType.EXTENSION_PROPERTY, + ) + ) + ) + } + + private fun TagConsumer.prepareForTemplates() = + if (context.configuration.delayTemplateSubstitution || this is ImmediateResolutionTagConsumer) this + else ImmediateResolutionTagConsumer(this, context) + + override fun FlowContent.wrapGroup( + node: ContentGroup, + pageContext: ContentPage, + childrenCallback: FlowContent.() -> Unit + ) { + val additionalClasses = node.style.joinToString(" ") { it.toString().toLowerCase() } + return when { + node.hasStyle(ContentStyle.TabbedContent) -> div(additionalClasses) { + val contentTabs = createTabs(pageContext) + + div(classes = "tabs-section") { + attributes["tabs-section"] = "tabs-section" + contentTabs.forEachIndexed { index, contentTab -> + button(classes = "section-tab") { + if (index == 0) attributes["data-active"] = "" + attributes[TOGGLEABLE_CONTENT_TYPE_ATTR] = + contentTab.tabbedContentTypes.joinToString(",") { it.toHtmlAttribute() } + text(contentTab.text) + } + } + } + div(classes = "tabs-section-body") { + childrenCallback() + } + } + node.hasStyle(ContentStyle.WithExtraAttributes) -> div { + node.extra.extraHtmlAttributes().forEach { attributes[it.extraKey] = it.extraValue } + childrenCallback() + } + node.dci.kind in setOf(ContentKind.Symbol) -> div("symbol $additionalClasses") { + childrenCallback() + } + node.hasStyle(ContentStyle.KDocTag) -> span("kdoc-tag") { childrenCallback() } + node.hasStyle(ContentStyle.Footnote) -> div("footnote") { childrenCallback() } + node.hasStyle(TextStyle.BreakableAfter) -> { + span { childrenCallback() } + wbr { } + } + node.hasStyle(TextStyle.Breakable) -> { + span("breakable-word") { childrenCallback() } + } + node.hasStyle(TextStyle.Span) -> span { childrenCallback() } + node.dci.kind == ContentKind.Symbol -> div("symbol $additionalClasses") { + childrenCallback() + } + node.dci.kind == SymbolContentKind.Parameters -> { + span("parameters $additionalClasses") { + childrenCallback() + } + } + node.dci.kind == SymbolContentKind.Parameter -> { + span("parameter $additionalClasses") { + childrenCallback() + } + } + node.hasStyle(TextStyle.InlineComment) -> div("inline-comment") { childrenCallback() } + node.dci.kind == ContentKind.BriefComment -> div("brief $additionalClasses") { childrenCallback() } + node.dci.kind == ContentKind.Cover -> div("cover $additionalClasses") { //TODO this can be removed + childrenCallback() + } + node.dci.kind == ContentKind.Deprecation -> div("deprecation-content") { childrenCallback() } + node.hasStyle(TextStyle.Paragraph) -> p(additionalClasses) { childrenCallback() } + node.hasStyle(TextStyle.Block) -> div(additionalClasses) { + childrenCallback() + } + node.hasStyle(TextStyle.Quotation) -> blockQuote(additionalClasses) { childrenCallback() } + node.hasStyle(TextStyle.FloatingRight) -> span("clearfix") { span("floating-right") { childrenCallback() } } + node.hasStyle(TextStyle.Strikethrough) -> strike { childrenCallback() } + node.isAnchorable -> buildAnchor( + node.anchor!!, + node.anchorLabel!!, + node.buildSourceSetFilterValues() + ) { childrenCallback() } + node.extra[InsertTemplateExtra] != null -> node.extra[InsertTemplateExtra]?.let { templateCommand(it.command) } + ?: Unit + node.hasStyle(ListStyle.DescriptionTerm) -> DT(emptyMap(), consumer).visit { + this@wrapGroup.childrenCallback() + } + node.hasStyle(ListStyle.DescriptionDetails) -> DD(emptyMap(), consumer).visit { + this@wrapGroup.childrenCallback() + } + node.extra.extraTabbedContentType() != null -> div() { + node.extra.extraTabbedContentType()?.let { attributes[TOGGLEABLE_CONTENT_TYPE_ATTR] = it.value.toHtmlAttribute() } + this@wrapGroup.childrenCallback() + } + else -> childrenCallback() + } + } + + private fun FlowContent.copyButton() = span(classes = "top-right-position") { + span("copy-icon") + copiedPopup("Content copied to clipboard", "popup-to-left") + } + + private fun FlowContent.copiedPopup(notificationContent: String, additionalClasses: String = "") = + div("copy-popup-wrapper $additionalClasses") { + span("copy-popup-icon") + span { + text(notificationContent) + } + } + + override fun FlowContent.buildPlatformDependent( + content: PlatformHintedContent, + pageContext: ContentPage, + sourceSetRestriction: Set? + ) { + buildPlatformDependent( + content.sourceSets.filter { + sourceSetRestriction == null || it in sourceSetRestriction + }.associateWith { setOf(content.inner) }, + pageContext, + content.extra, + content.style + ) + } + + private fun FlowContent.buildPlatformDependent( + nodes: Map>, + pageContext: ContentPage, + extra: PropertyContainer = PropertyContainer.empty(), + styles: Set