Skip to content

Commit f271673

Browse files
committed
only apply JavaAdapter once
1 parent e095e33 commit f271673

File tree

1 file changed

+8
-9
lines changed
  • dokka-runners/dokka-gradle-plugin/src/main/kotlin/adapters

1 file changed

+8
-9
lines changed

dokka-runners/dokka-gradle-plugin/src/main/kotlin/adapters/JavaAdapter.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,13 @@ abstract class JavaAdapter @Inject constructor(
4646

4747
val dokkaExtension = project.extensions.getByType<DokkaExtension>()
4848

49-
// wait for the Java plugin to be applied
50-
project.plugins.withType<JavaBasePlugin>().configureEach {
51-
val java = project.extensions.getByType<JavaPluginExtension>()
52-
val sourceSets = project.extensions.getByType<SourceSetContainer>()
49+
val java = project.extensions.getByType<JavaPluginExtension>()
50+
val sourceSets = project.extensions.getByType<SourceSetContainer>()
5351

54-
detectJavaToolchainVersion(dokkaExtension, java)
52+
detectJavaToolchainVersion(dokkaExtension, java)
5553

56-
val isConflictingPluginPresent = isConflictingPluginPresent(project)
57-
registerDokkaSourceSets(dokkaExtension, sourceSets, isConflictingPluginPresent)
58-
}
54+
val isConflictingPluginPresent = isConflictingPluginPresent(project)
55+
registerDokkaSourceSets(dokkaExtension, sourceSets, isConflictingPluginPresent)
5956
}
6057

6158
/** Fetch the toolchain, and use the language version as Dokka's jdkVersion */
@@ -145,7 +142,9 @@ abstract class JavaAdapter @Inject constructor(
145142
&& name.startsWith(MAIN_SOURCE_SET_NAME)
146143

147144
internal fun applyTo(project: Project) {
148-
project.pluginManager.apply(type = JavaAdapter::class)
145+
project.plugins.withType<JavaBasePlugin>().all {
146+
project.pluginManager.apply(type = JavaAdapter::class)
147+
}
149148
}
150149
}
151150
}

0 commit comments

Comments
 (0)