-
Notifications
You must be signed in to change notification settings - Fork 86
Migrate to Dokka 0.10.1 #385
Changes from 7 commits
5c64ff4
e136371
acf51ef
2e9b4eb
3779b16
2409d25
4d200cd
367c4fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
[[contributing-building]] | ||
=== Building from source | ||
|
||
[[contributing-installing-testjar]] | ||
[[contributing-installing-restdocs-testjar]] | ||
==== Install Spring REST Docs test JAR | ||
|
||
The Spring REST Docs test JAR is not published via Maven, but this project relies on it. | ||
|
@@ -19,7 +19,22 @@ mvn install:install-file -Dfile=lib/spring-restdocs-core-${spring-restdocs.versi | |
-Dversion=${spring-restdocs.version} -Dpackaging=test-jar -Dclassifier=test | ||
---- | ||
|
||
[[contributing-building-testjar]] | ||
[[contributing-installing-dokka-testjar]] | ||
==== Install Dokka Core test JAR | ||
|
||
Dokka publishes no test JAR, but the Spring Auto REST Docs Dokka extension uses their test utilities. | ||
If you want to build this project yourself, you need to install the test JAR. | ||
The test JAR is located in the lib folder and can be installed as follow: | ||
|
||
.Bash | ||
[source,bash] | ||
---- | ||
mvn install:install-file -Dfile=lib/dokka-core-${dokka.version}-tests.jar | ||
-DgroupId=org.jetbrains.dokka -DartifactId=dokka-core -Dversion=${dokka.version} | ||
-Dpackaging=jar -Dclassifier=test | ||
---- | ||
|
||
[[contributing-building-restdocs-testjar]] | ||
==== Build Spring REST Docs test JAR | ||
|
||
Building the Spring REST Docs test JAR is not required to build the project, | ||
|
@@ -57,6 +72,49 @@ Afterwards the test JAR is located at | |
`spring-restdocs/spring-restdocs-core/build/libs/spring-restdocs-core-${spring-restdocs.version}-test.jar` | ||
and has to be installed with the Maven command shown in the section above. | ||
|
||
[[contributing-building-dokka-testjar]] | ||
==== Build Dokka Core test JAR | ||
|
||
Building the Dokka core test JAR is not required to build the project, | ||
but if you ever want to upgrade the version of Dokka in this project this step has to be done. | ||
|
||
We use version ${dokka.version} of Dokka in this example. | ||
|
||
Clone and checkout a specific version of Dokka: | ||
|
||
.Bash | ||
[source,bash] | ||
---- | ||
git clone git@github.com:Kotlin/dokka.git | ||
cd dokka | ||
git checkout ${dokka.version} | ||
---- | ||
|
||
Add the following snippted at the end of `core/build.gradle`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. snippet |
||
|
||
[source,groovy] | ||
---- | ||
task testJar(type: Jar) { | ||
classifier = 'tests' | ||
from sourceSets.test.output | ||
} | ||
---- | ||
|
||
To speed the build up and avoid test issues, once can reduce the list ob subprojects in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, by using a spell checker I found more :) |
||
`settings.gradle` to just `core` and `integration`. | ||
|
||
Make sure that the current JDK is 8. | ||
Create the test JAR by running the following command on the top level: | ||
|
||
.Bash | ||
[source,bash] | ||
---- | ||
./gradlew testJar | ||
---- | ||
|
||
Afterwards the test JAR is located at | ||
`core/build/libs/core-${dokka.version}-SNAPSHOT-tests.jar` | ||
|
||
[[contributing-building-build]] | ||
==== Build | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/*- | ||
* #%L | ||
* Spring Auto REST Docs Dokka JSON | ||
* %% | ||
* Copyright (C) 2015 - 2020 Scalable Capital GmbH | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
package capital.scalable.dokka.json | ||
|
||
import com.google.inject.Binder | ||
import com.google.inject.Guice | ||
import com.google.inject.Module | ||
import com.google.inject.name.Names | ||
import com.intellij.openapi.util.io.FileUtil | ||
import org.jetbrains.dokka.Content | ||
import org.jetbrains.dokka.DefaultPackageListService | ||
import org.jetbrains.dokka.DocumentationNode | ||
import org.jetbrains.dokka.DokkaConfiguration | ||
import org.jetbrains.dokka.DokkaConsoleLogger | ||
import org.jetbrains.dokka.DokkaGenerator | ||
import org.jetbrains.dokka.DokkaLogger | ||
import org.jetbrains.dokka.FormatService | ||
import org.jetbrains.dokka.Formats.FormatDescriptor | ||
import org.jetbrains.dokka.Generator | ||
import org.jetbrains.dokka.KotlinLanguageService | ||
import org.jetbrains.dokka.LanguageService | ||
import org.jetbrains.dokka.NodeKind | ||
import org.jetbrains.dokka.NodeLocationAwareGenerator | ||
import org.jetbrains.dokka.PackageListService | ||
import org.jetbrains.dokka.Platform | ||
import org.jetbrains.dokka.Utilities.DokkaRunModule | ||
import org.jetbrains.dokka.Utilities.ServiceLocator | ||
import org.junit.Test | ||
import java.io.File | ||
|
||
class JsonFormatIntegrationTest { | ||
|
||
@Test | ||
fun `Should load descriptor from properties file, bind and use it`() { | ||
DokkaGenerator(DokkaConfigurationImpl(), DokkaConsoleLogger).generate() | ||
} | ||
} | ||
|
||
data class SourceLinkDefinitionImpl(override val path: String, | ||
override val url: String, | ||
override val lineSuffix: String?) : DokkaConfiguration.SourceLinkDefinition { | ||
companion object { | ||
fun parseSourceLinkDefinition(srcLink: String): DokkaConfiguration.SourceLinkDefinition { | ||
val (path, urlAndLine) = srcLink.split('=') | ||
return SourceLinkDefinitionImpl( | ||
File(path).canonicalPath, | ||
urlAndLine.substringBefore("#"), | ||
urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#$it" }) | ||
} | ||
} | ||
} | ||
|
||
class SourceRootImpl(path: String) : DokkaConfiguration.SourceRoot { | ||
override val path: String = File(path).absolutePath | ||
|
||
companion object { | ||
fun parseSourceRoot(sourceRoot: String): DokkaConfiguration.SourceRoot = SourceRootImpl(sourceRoot) | ||
} | ||
} | ||
|
||
data class PackageOptionsImpl(override val prefix: String, | ||
override val includeNonPublic: Boolean = false, | ||
override val reportUndocumented: Boolean = true, | ||
override val skipDeprecated: Boolean = false, | ||
override val suppress: Boolean = false) : DokkaConfiguration.PackageOptions | ||
|
||
class DokkaConfigurationImpl( | ||
override val outputDir: String = "", | ||
override val format: String = "auto-restdocs-json", | ||
override val generateIndexPages: Boolean = false, | ||
override val cacheRoot: String? = null, | ||
override val impliedPlatforms: List<String> = emptyList(), | ||
override val passesConfigurations: List<DokkaConfiguration.PassConfiguration> = listOf(PassConfigurationImpl()) | ||
) : DokkaConfiguration | ||
|
||
class PassConfigurationImpl ( | ||
override val classpath: List<String> = emptyList(), | ||
override val moduleName: String = "", | ||
override val sourceRoots: List<DokkaConfiguration.SourceRoot> = emptyList(), | ||
override val samples: List<String> = emptyList(), | ||
override val includes: List<String> = emptyList(), | ||
override val includeNonPublic: Boolean = false, | ||
override val includeRootPackage: Boolean = false, | ||
override val reportUndocumented: Boolean = false, | ||
override val skipEmptyPackages: Boolean = false, | ||
override val skipDeprecated: Boolean = false, | ||
override val jdkVersion: Int = 6, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 6? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not matter for the test but I changed it to 8 to have it in line with what we actually use. |
||
override val sourceLinks: List<DokkaConfiguration.SourceLinkDefinition> = emptyList(), | ||
override val perPackageOptions: List<DokkaConfiguration.PackageOptions> = emptyList(), | ||
override val externalDocumentationLinks: List<DokkaConfiguration.ExternalDocumentationLink> = emptyList(), | ||
override val languageVersion: String? = null, | ||
override val apiVersion: String? = null, | ||
override val noStdlibLink: Boolean = false, | ||
override val noJdkLink: Boolean = false, | ||
override val suppressedFiles: List<String> = emptyList(), | ||
override val collectInheritedExtensionsFromLibraries: Boolean = false, | ||
override val analysisPlatform: Platform = Platform.DEFAULT, | ||
override val targets: List<String> = emptyList(), | ||
override val sinceKotlin: String? = null | ||
): DokkaConfiguration.PassConfiguration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
\
for multiline command