From 5de1d68ca8510f7bc3601c3516ecb111f7abe44b Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Thu, 11 Apr 2019 14:46:58 +0200 Subject: Extract extension names to consts --- runners/gradle-plugin/src/main/kotlin/dokkaTask.kt | 5 +++-- runners/gradle-plugin/src/main/kotlin/main.kt | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'runners') diff --git a/runners/gradle-plugin/src/main/kotlin/dokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/dokkaTask.kt index c95d1039..825830c5 100644 --- a/runners/gradle-plugin/src/main/kotlin/dokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/dokkaTask.kt @@ -183,9 +183,10 @@ open class DokkaTask : DefaultTask() { val gson = GsonBuilder().setPrettyPrinting().create() - val passConfigurationExtension: GradlePassConfigurationImpl? = this.extensions.findByName("passConfiguration") as GradlePassConfigurationImpl + val passConfigurationExtension: GradlePassConfigurationImpl? = this.extensions.findByName( + CONFIGURATION_EXTENSION_NAME) as GradlePassConfigurationImpl? val passConfigurationsContainer by lazy { - (this.extensions.getByName("passConfigurations") as Iterable).toList() + (this.extensions.getByName(MULTIPLATFORM_EXTENSION_NAME) as Iterable).toList() } passConfigurationExtension?.sourceRoots?.addAll(sourceRoots) diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt index 865cba2f..dd216f89 100644 --- a/runners/gradle-plugin/src/main/kotlin/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/main.kt @@ -6,6 +6,9 @@ import java.io.File import java.io.InputStream import java.util.* +internal const val CONFIGURATION_EXTENSION_NAME = "configuration" +internal const val MULTIPLATFORM_EXTENSION_NAME = "multiplatform" + open class DokkaPlugin : Plugin { override fun apply(project: Project) { @@ -18,8 +21,8 @@ open class DokkaPlugin : Plugin { } project.tasks.withType(DokkaTask::class.java) { task -> val passConfiguration = project.container(GradlePassConfigurationImpl::class.java) - task.extensions.add("multiplatform", passConfiguration) - task.extensions.create("configuration", GradlePassConfigurationImpl::class.java, "") + task.extensions.add(MULTIPLATFORM_EXTENSION_NAME, passConfiguration) + task.extensions.create(CONFIGURATION_EXTENSION_NAME, GradlePassConfigurationImpl::class.java, "") } } } -- cgit