aboutsummaryrefslogtreecommitdiff
path: root/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
diff options
context:
space:
mode:
authorThibault Gagnaux <tgagnaux@gmail.com>2021-06-28 11:10:10 +0200
committerThibault Gagnaux <tgagnaux@gmail.com>2021-06-28 11:10:10 +0200
commitf3d085304bad105e65ce0c77f25ae59161fd8776 (patch)
tree92988ca069de5c6cdce67a18971d9ccfb3b0ef85 /src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
parent3be7e4219a15c0939f929c7c0836273f78e3a4f5 (diff)
downloadfrege-gradle-plugin-f3d085304bad105e65ce0c77f25ae59161fd8776.tar.gz
frege-gradle-plugin-f3d085304bad105e65ce0c77f25ae59161fd8776.tar.bz2
frege-gradle-plugin-f3d085304bad105e65ce0c77f25ae59161fd8776.zip
Inits branch with a simple groovy test
Diffstat (limited to 'src/main/groovy/frege/gradle/tasks/FregeRepl.groovy')
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeRepl.groovy40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy b/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
deleted file mode 100644
index 693e076..0000000
--- a/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
+++ /dev/null
@@ -1,40 +0,0 @@
-package frege.gradle.tasks
-
-import org.gradle.api.DefaultTask
-import org.gradle.api.internal.file.FileResolver
-import org.gradle.api.tasks.*
-import org.gradle.process.internal.DefaultExecActionFactory
-import org.gradle.process.internal.DefaultJavaExecAction
-import org.gradle.process.internal.JavaExecAction
-
-class FregeRepl 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 DefaultExecActionFactory(fileResolver).newJavaExecAction()
- 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()
- }
-
-}