diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-09-11 16:45:11 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-09-11 16:45:11 +0200 |
commit | 757f72db456cf4dd12b0cfdbf312752d5951f166 (patch) | |
tree | e616cee86448fc9ae12c9cf67f27abecef0755f1 /gradle-plugin | |
parent | e67ee4136f69ad2c8ef65c4978465f43717517d2 (diff) | |
download | dokka-757f72db456cf4dd12b0cfdbf312752d5951f166.tar.gz dokka-757f72db456cf4dd12b0cfdbf312752d5951f166.tar.bz2 dokka-757f72db456cf4dd12b0cfdbf312752d5951f166.zip |
M13 code cleanup
Diffstat (limited to 'gradle-plugin')
-rw-r--r-- | gradle-plugin/src/main/kotlin/main.kt | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/gradle-plugin/src/main/kotlin/main.kt b/gradle-plugin/src/main/kotlin/main.kt index 418af00f..e56b2371 100644 --- a/gradle-plugin/src/main/kotlin/main.kt +++ b/gradle-plugin/src/main/kotlin/main.kt @@ -15,29 +15,29 @@ import java.util.ArrayList public open class DokkaPlugin : Plugin<Project> { override fun apply(project: Project) { - val ext = project.getExtensions().create("dokka", javaClass<DokkaExtension>()) - project.getTasks().create("dokka", javaClass<DokkaTask>()) + val ext = project.extensions.create("dokka", DokkaExtension::class.java) + project.tasks.create("dokka", DokkaTask::class.java) - ext.moduleName = project.getName() - ext.outputDirectory = File(project.getBuildDir(), "dokka").getAbsolutePath() + ext.moduleName = project.name + ext.outputDirectory = File(project.buildDir, "dokka").absolutePath } } public open class DokkaTask : DefaultTask() { init { - setGroup(JavaBasePlugin.DOCUMENTATION_GROUP) - setDescription("Generates dokka documentation for Kotlin") + group = JavaBasePlugin.DOCUMENTATION_GROUP + description = "Generates dokka documentation for Kotlin" } - TaskAction + @TaskAction fun generate() { - val project = getProject() - val conf = getProject().getExtensions().getByType(javaClass<DokkaExtension>()) - val javaPluginConvention = getProject().getConvention().getPlugin(javaClass<JavaPluginConvention>()) + val project = project + val conf = project.extensions.getByType(DokkaExtension::class.java) + val javaPluginConvention = project.convention.getPlugin(JavaPluginConvention::class.java) - val sourceSets = javaPluginConvention.getSourceSets()?.findByName(SourceSet.MAIN_SOURCE_SET_NAME) - val sourceDirectories = sourceSets?.getAllSource()?.getSrcDirs()?.filter { it.exists() } ?: emptyList() - val allConfigurations = getProject().getConfigurations() + val sourceSets = javaPluginConvention.sourceSets?.findByName(SourceSet.MAIN_SOURCE_SET_NAME) + val sourceDirectories = sourceSets?.allSource?.srcDirs?.filter { it.exists() } ?: emptyList() + val allConfigurations = project.configurations val classpath = conf.processConfigurations @@ -45,20 +45,20 @@ public open class DokkaTask : DefaultTask() { .flatMap { it } if (sourceDirectories.isEmpty()) { - getLogger().warn("No source directories found: skipping dokka generation") + logger.warn("No source directories found: skipping dokka generation") return } DokkaGenerator( - DokkaGradleLogger(getLogger()), - classpath.map { it.getAbsolutePath() }, - sourceDirectories.map { it.getAbsolutePath() }, + DokkaGradleLogger(logger), + classpath.map { it.absolutePath }, + sourceDirectories.map { it.absolutePath }, conf.samples, conf.includes, conf.moduleName, conf.outputDirectory, conf.outputFormat, - conf.linkMappings.map { SourceLinkDefinition(project.file(it.dir).getAbsolutePath(), it.url, it.suffix) }, + conf.linkMappings.map { SourceLinkDefinition(project.file(it.dir).absolutePath, it.url, it.suffix) }, false ).generate() } @@ -76,7 +76,7 @@ public open class DokkaExtension { fun linkMapping(closure: Closure<Any?>) { val mapping = LinkMapping() - closure.setDelegate(mapping) + closure.delegate = mapping closure.call() if (mapping.dir.isEmpty()) { |