aboutsummaryrefslogtreecommitdiff
path: root/src/main/groovy/frege/gradle/tasks
diff options
context:
space:
mode:
authorRene Groeschke <rene@gradle.com>2015-12-14 22:56:51 +0100
committerRene Groeschke <rene@gradle.com>2015-12-14 23:21:11 +0100
commit7fb3f43096fa6b142eb059e1eeaca79abcaa3009 (patch)
tree69c098b1c37495c77b29d66eefe5376f7117facd /src/main/groovy/frege/gradle/tasks
parentfcac60e0205340ed303ee58781e2d697e5630b90 (diff)
downloadfrege-gradle-plugin-7fb3f43096fa6b142eb059e1eeaca79abcaa3009.tar.gz
frege-gradle-plugin-7fb3f43096fa6b142eb059e1eeaca79abcaa3009.tar.bz2
frege-gradle-plugin-7fb3f43096fa6b142eb059e1eeaca79abcaa3009.zip
seme more coverage and work on frege doc task.
TODO fix fregedoc task for mixed java + frege sources
Diffstat (limited to 'src/main/groovy/frege/gradle/tasks')
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeDoc.groovy66
1 files changed, 29 insertions, 37 deletions
diff --git a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
index 7ac49a7..af4b924 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
@@ -1,14 +1,13 @@
package frege.gradle.tasks
+import org.gradle.api.Action
import org.gradle.api.DefaultTask
-import org.gradle.api.internal.file.FileResolver
+import org.gradle.api.file.FileCollection
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
+import org.gradle.process.JavaExecSpec
class FregeDoc extends DefaultTask {
@@ -30,53 +29,46 @@ class FregeDoc extends DefaultTask {
*
*/
- 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
+ String module // module name or directory or class path. Default is all production modules
- @Input @Optional
+ @Input
+ @Optional
String exclude = null
- @Input @Optional
+ @Input
+ @Optional
Boolean verbose = null
+ FileCollection classpath
+
@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()
+ def result = project.javaexec(new Action<JavaExecSpec>() {
+ @Override
+ void execute(JavaExecSpec javaExecSpec) {
+ if (verbose) {
+ javaExecSpec.args '-v'
+ }
+ javaExecSpec.args '-d', targetDir.absolutePath
+ if (exclude) {
+ javaExecSpec.args '-x', exclude
+ }
+ javaExecSpec.args(module)
+ javaExecSpec.main = "frege.tools.Doc"
+ javaExecSpec.workingDir = project.projectDir
+ javaExecSpec.standardInput = System.in
+ javaExecSpec.standardOutput = System.out
+ javaExecSpec.errorOutput = System.err
+ javaExecSpec.classpath = this.classpath
+ }
+ })
}
}