Skip to content

Commit

Permalink
Fixed Java file extension spelling error and add a test (#2604)
Browse files Browse the repository at this point in the history
Co-authored-by: nfl <[email protected]>
  • Loading branch information
2017398956 and 2017398956 authored Aug 11, 2022
1 parent 732f8aa commit a7c3113
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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()
)
}
}
}
}

0 comments on commit a7c3113

Please sign in to comment.