diff options
author | ingo <ingo.kegel@ej-technologies.com> | 2016-01-03 16:25:21 +0100 |
---|---|---|
committer | ingo <ingo.kegel@ej-technologies.com> | 2016-01-03 16:25:21 +0100 |
commit | e0c6c1a58ff09e657d41f2bca6943486cb877f25 (patch) | |
tree | b36cbcf152b2eb9a622f64d309fc6af16c6e5de3 /dokka-gradle-plugin/src/main | |
parent | 6b0263f65a320116c0b84349a02221f780b8a0d8 (diff) | |
download | dokka-e0c6c1a58ff09e657d41f2bca6943486cb877f25.tar.gz dokka-e0c6c1a58ff09e657d41f2bca6943486cb877f25.tar.bz2 dokka-e0c6c1a58ff09e657d41f2bca6943486cb877f25.zip |
dokka gradle tasks now know when they are up-to-date.
Diffstat (limited to 'dokka-gradle-plugin/src/main')
-rw-r--r-- | dokka-gradle-plugin/src/main/kotlin/main.kt | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/dokka-gradle-plugin/src/main/kotlin/main.kt b/dokka-gradle-plugin/src/main/kotlin/main.kt index a107260e..28600a6b 100644 --- a/dokka-gradle-plugin/src/main/kotlin/main.kt +++ b/dokka-gradle-plugin/src/main/kotlin/main.kt @@ -4,10 +4,10 @@ import groovy.lang.Closure import org.gradle.api.DefaultTask import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.file.FileCollection import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.plugins.JavaPluginConvention -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.TaskAction +import org.gradle.api.tasks.* import org.jetbrains.dokka.DokkaGenerator import org.jetbrains.dokka.SourceLinkDefinition import java.io.File @@ -28,12 +28,18 @@ public open class DokkaTask : DefaultTask() { description = "Generates dokka documentation for Kotlin" } + @Input var moduleName: String = "" + @Input var outputFormat: String = "html" var outputDirectory: String = "" + @Input var processConfigurations: ArrayList<String> = arrayListOf("compile") + @Input var includes: ArrayList<String> = arrayListOf() + @Input var linkMappings: ArrayList<LinkMapping> = arrayListOf() + @Input var samples: ArrayList<String> = arrayListOf() fun linkMapping(closure: Closure<Any?>) { @@ -54,10 +60,7 @@ public open class DokkaTask : DefaultTask() { @TaskAction fun generate() { val project = project - val javaPluginConvention = project.convention.getPlugin(JavaPluginConvention::class.java) - - val sourceSets = javaPluginConvention.sourceSets?.findByName(SourceSet.MAIN_SOURCE_SET_NAME) - val sourceDirectories = sourceSets?.allSource?.srcDirs?.filter { it.exists() } ?: emptyList() + val sourceDirectories = getSourceDirectories() val allConfigurations = project.configurations val classpath = @@ -84,6 +87,19 @@ public open class DokkaTask : DefaultTask() { ).generate() } + fun getSourceDirectories(): List<File> { + val javaPluginConvention = project.convention.getPlugin(JavaPluginConvention::class.java) + val sourceSets = javaPluginConvention.sourceSets?.findByName(SourceSet.MAIN_SOURCE_SET_NAME) + return sourceSets?.allSource?.srcDirs?.filter { it.exists() } ?: emptyList() + } + + @InputFiles + @SkipWhenEmpty + fun getIncludedFiles() : FileCollection = project.files(getSourceDirectories().map { project.fileTree(it) }) + + @OutputDirectory + fun getOutputDirectoryAsFile() : File = project.file(outputDirectory) + } public open class LinkMapping { |