aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ant
diff options
context:
space:
mode:
authorSimon Ogorodnik <sem-oro@yandex.ru>2016-11-01 02:10:32 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-11-01 14:46:01 +0300
commit769701f99a1aefbc9d385c1938c9c7d3a7b2e38e (patch)
treec3ea4802d9e627c90870808aba9343eb224a114c /core/src/main/kotlin/ant
parent08bcaa257f7b48929af6ee29007dd6f0d7bb1b52 (diff)
downloaddokka-769701f99a1aefbc9d385c1938c9c7d3a7b2e38e.tar.gz
dokka-769701f99a1aefbc9d385c1938c9c7d3a7b2e38e.tar.bz2
dokka-769701f99a1aefbc9d385c1938c9c7d3a7b2e38e.zip
Total build refactoring, prepare for new development iteration
Removed old and useless build helpers Remove old .xml's from .idea and add .idea/shelf to .gitignore build-docs.xml fixed, dokka_version set to 0.9.10
Diffstat (limited to 'core/src/main/kotlin/ant')
-rw-r--r--core/src/main/kotlin/ant/dokka.kt101
1 files changed, 0 insertions, 101 deletions
diff --git a/core/src/main/kotlin/ant/dokka.kt b/core/src/main/kotlin/ant/dokka.kt
deleted file mode 100644
index 38dc543b..00000000
--- a/core/src/main/kotlin/ant/dokka.kt
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.jetbrains.dokka.ant
-
-import org.apache.tools.ant.BuildException
-import org.apache.tools.ant.Project
-import org.apache.tools.ant.Task
-import org.apache.tools.ant.types.Path
-import org.apache.tools.ant.types.Reference
-import org.jetbrains.dokka.DocumentationOptions
-import org.jetbrains.dokka.DokkaGenerator
-import org.jetbrains.dokka.DokkaLogger
-import org.jetbrains.dokka.SourceLinkDefinition
-import java.io.File
-
-class AntLogger(val task: Task): DokkaLogger {
- override fun info(message: String) = task.log(message, Project.MSG_INFO)
- override fun warn(message: String) = task.log(message, Project.MSG_WARN)
- override fun error(message: String) = task.log(message, Project.MSG_ERR)
-}
-
-class AntSourceLinkDefinition(var path: String? = null, var url: String? = null, var lineSuffix: String? = null)
-
-class DokkaAntTask(): Task() {
- var moduleName: String? = null
- var outputDir: String? = null
- var outputFormat: String = "html"
- var jdkVersion: Int = 6
-
- var skipDeprecated: Boolean = false
-
- val compileClasspath: Path by lazy { Path(getProject()) }
- val sourcePath: Path by lazy { Path(getProject()) }
- val samplesPath: Path by lazy { Path(getProject()) }
- val includesPath: Path by lazy { Path(getProject()) }
-
- val antSourceLinks: MutableList<AntSourceLinkDefinition> = arrayListOf()
-
- fun setClasspath(classpath: Path) {
- compileClasspath.append(classpath)
- }
-
- fun setClasspathRef(ref: Reference) {
- compileClasspath.createPath().refid = ref
- }
-
- fun setSrc(src: Path) {
- sourcePath.append(src)
- }
-
- fun setSrcRef(ref: Reference) {
- sourcePath.createPath().refid = ref
- }
-
- fun setSamples(samples: Path) {
- samplesPath.append(samples)
- }
-
- fun setSamplesRef(ref: Reference) {
- samplesPath.createPath().refid = ref
- }
-
- fun setInclude(include: Path) {
- includesPath.append(include)
- }
-
- fun createSourceLink(): AntSourceLinkDefinition {
- val def = AntSourceLinkDefinition()
- antSourceLinks.add(def)
- return def
- }
-
- override fun execute() {
- if (sourcePath.list().size == 0) {
- throw BuildException("At least one source path needs to be specified")
- }
- if (moduleName == null) {
- throw BuildException("Module name needs to be specified")
- }
- if (outputDir == null) {
- throw BuildException("Output directory needs to be specified")
- }
- val sourceLinks = antSourceLinks.map {
- val path = it.path ?: throw BuildException("'path' attribute of a <sourceLink> element is required")
- val url = it.url ?: throw BuildException("'url' attribute of a <sourceLink> element is required")
- SourceLinkDefinition(File(path).canonicalFile.absolutePath, url, it.lineSuffix)
- }
-
- val generator = DokkaGenerator(
- AntLogger(this),
- compileClasspath.list().toList(),
- sourcePath.list().toList(),
- samplesPath.list().toList(),
- includesPath.list().toList(),
- moduleName!!,
- DocumentationOptions(outputDir!!, outputFormat,
- skipDeprecated = skipDeprecated,
- sourceLinks = sourceLinks,
- jdkVersion = jdkVersion)
- )
- generator.generate()
- }
-} \ No newline at end of file