aboutsummaryrefslogtreecommitdiff
path: root/src/main/groovy/frege/gradle/DocTask.groovy
diff options
context:
space:
mode:
authorRene Groeschke <rene@gradle.com>2015-11-21 00:59:06 +0000
committerRene Groeschke <rene@gradle.com>2015-11-21 00:59:30 +0000
commitd47c934650540277c911514d4cf7ddf55a69492a (patch)
tree600a74141be47081049f1441de260f09436d17cb /src/main/groovy/frege/gradle/DocTask.groovy
parentb53817cd366bdd15ec142fc880fe68c7e5ea00a1 (diff)
downloadfrege-gradle-plugin-d47c934650540277c911514d4cf7ddf55a69492a.tar.gz
frege-gradle-plugin-d47c934650540277c911514d4cf7ddf55a69492a.tar.bz2
frege-gradle-plugin-d47c934650540277c911514d4cf7ddf55a69492a.zip
create frege compile task per sourceSet
Diffstat (limited to 'src/main/groovy/frege/gradle/DocTask.groovy')
-rw-r--r--src/main/groovy/frege/gradle/DocTask.groovy83
1 files changed, 0 insertions, 83 deletions
diff --git a/src/main/groovy/frege/gradle/DocTask.groovy b/src/main/groovy/frege/gradle/DocTask.groovy
deleted file mode 100644
index 061ae00..0000000
--- a/src/main/groovy/frege/gradle/DocTask.groovy
+++ /dev/null
@@ -1,83 +0,0 @@
-package frege.gradle
-
-import org.gradle.api.DefaultTask
-import org.gradle.api.internal.file.FileResolver
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputDirectory
-import org.gradle.api.tasks.Optional
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.TaskAction
-import org.gradle.process.internal.DefaultJavaExecAction
-import org.gradle.process.internal.JavaExecAction
-
-class DocTask extends DefaultTask {
-
- /* Usage: java -jar fregec.jar frege.tools.Doc [-v] [-d opt] [-x mod,...] modules ...
- * -v print a message for each processed module
- * -d docdir specify root directory for documentation
- * Documentation for module x.y.Z will be writen to
- * $docdir/x/y/Z.html
- * -cp classpath class path for doc tool
- * -x mod1[,mod2] exclude modules whose name starts with 'mod1' or 'mod2'
- *
- * Modules can be specified in three ways:
- * my.nice.Modul by name, the Java class for this module must be on the class path
- * directory/ all modules that could be loaded if the given directory was on the class path, except exxcluded ones
- * path.jar all modules in the specified JAR file, except excluded ones
- *
- * Example: document base frege distribution without compiler modules
- * java -cp fregec.jar frege.tools.Doc -d doc -x frege.compiler fregec.jar
- *
- */
-
- static String DEFAULT_SRC_DIR = "src/main/frege" // TODO: should this come from a source set?
- static String DEFAULT_DOCS_SUBDIR = "docs/frege" // TODO: should this come from a convention?
-
- Boolean help = false
-
- @Optional
- @InputDirectory
- File sourceDir = new File(project.projectDir, DEFAULT_SRC_DIR).exists() ? new File(project.projectDir, DEFAULT_SRC_DIR) : null
-
- @Optional
- @OutputDirectory
- File targetDir = new File(project.buildDir, DEFAULT_DOCS_SUBDIR)
-
- @Input
- String module = "$project.buildDir/classes/main" // module name or directory or class path. Default is all production modules
-
- @Input @Optional
- String exclude = null
-
- @Input @Optional
- Boolean verbose = null
-
- @TaskAction
- void fregedoc() {
-
- FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultJavaExecAction(fileResolver)
- action.setMain("frege.tools.Doc")
- action.workingDir = sourceDir ?: project.projectDir
- action.standardInput = System.in
- action.standardOutput = System.out
- action.errorOutput = System.err
- action.setClasspath(project.files(project.configurations.compile) + project.files("$project.buildDir/classes/main"))
-
- def args = []
- if (help) {
- args << "-h"
- } else {
- if (verbose) args << '-v'
- args << '-d' << targetDir.absolutePath
- if (exclude) args << '-x' << exclude
- args << module
- }
-
- logger.info("Calling Frege Doc with args: '$args'")
- action.args args
- action.execute()
- }
-
-}
-