aboutsummaryrefslogtreecommitdiff
path: root/src/main/groovy/frege/gradle/ReplTask.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/ReplTask.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/ReplTask.groovy')
-rw-r--r--src/main/groovy/frege/gradle/ReplTask.groovy39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/main/groovy/frege/gradle/ReplTask.groovy b/src/main/groovy/frege/gradle/ReplTask.groovy
deleted file mode 100644
index 1f570eb..0000000
--- a/src/main/groovy/frege/gradle/ReplTask.groovy
+++ /dev/null
@@ -1,39 +0,0 @@
-package frege.gradle
-
-import org.gradle.api.DefaultTask
-import org.gradle.api.internal.file.FileResolver
-import org.gradle.api.tasks.*
-import org.gradle.process.internal.DefaultJavaExecAction
-import org.gradle.process.internal.JavaExecAction
-
-class ReplTask extends DefaultTask {
-
- static String DEFAULT_SRC_DIR = "src/main/frege" // TODO: should this come from a source set?
- static String DEFAULT_CLASSES_SUBDIR = "classes/main" // TODO: should this come from a convention?
-
- @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_CLASSES_SUBDIR)
-
- @TaskAction
- void openFregeRepl() {
-
- if (sourceDir != null && !sourceDir.exists() ) {
- def currentDir = new File('.')
- logger.info "Intended source dir '${sourceDir.absolutePath}' doesn't exist. Using current dir '${currentDir.absolutePath}' ."
- sourceDir = currentDir
- }
-
- FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultJavaExecAction(fileResolver)
- action.setMain("frege.repl.FregeRepl")
- action.workingDir = sourceDir ?: project.projectDir
- action.standardInput = System.in
- action.setClasspath(project.files(project.configurations.runtime ) + project.files(targetDir.absolutePath))
-
- action.execute()
- }
-
-} \ No newline at end of file