Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Java file extension spelling error and add a test #2604

Merged
merged 1 commit into from Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -571,7 +571,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
fun addSources(sourceDirectories: Iterable<File>) {
sourceDirectories.forEach { directory ->
configuration.addKotlinSourceRoot(directory.path)
if (directory.isDirectory || directory.extension == ".java") {
if (directory.isDirectory || directory.extension == "java") {
configuration.addJavaSourceRoot(directory)
}
}
Expand Down
37 changes: 37 additions & 0 deletions plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt
@@ -0,0 +1,37 @@
package filter

import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals

class JavaFileFilterTest : BaseAbstractTest() {
@Test
fun `java file should be included`() {
val configuration = dokkaConfiguration {
sourceSets {
sourceSet {
skipEmptyPackages = false
sourceRoots = listOf("src/main/java/basic/Test.java")
}
}
}

testInline(
"""
|/src/main/java/basic/Test.java
|package example;
|
|
|
""".trimMargin(),
configuration
) {
preMergeDocumentablesTransformationStage = {
Assertions.assertTrue(
it.first().packages.isNotEmpty()
)
}
}
}
}