aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDierk Koenig <dierk.koenig@canoo.com>2015-02-24 01:08:54 +0100
committerDierk Koenig <dierk.koenig@canoo.com>2015-02-24 01:08:54 +0100
commit91d37b288290b99993cdeccbca653af87dbfcad8 (patch)
tree1544d0886404c784250729c813ad15bd16914404 /src
parentb563f27267f9fee7756284feb60797c04e6316cf (diff)
downloadfrege-gradle-plugin-91d37b288290b99993cdeccbca653af87dbfcad8.tar.gz
frege-gradle-plugin-91d37b288290b99993cdeccbca653af87dbfcad8.tar.bz2
frege-gradle-plugin-91d37b288290b99993cdeccbca653af87dbfcad8.zip
we now have two repl tasks to choose from :-)
Diffstat (limited to 'src')
-rw-r--r--src/main/groovy/frege/gradle/FregePlugin.groovy7
-rw-r--r--src/main/groovy/frege/gradle/FregeReplTask.groovy (renamed from src/main/groovy/org/gradle/frege/FregeReplTask.groovy)27
2 files changed, 6 insertions, 28 deletions
diff --git a/src/main/groovy/frege/gradle/FregePlugin.groovy b/src/main/groovy/frege/gradle/FregePlugin.groovy
index e2777ed..1ce9eaa 100644
--- a/src/main/groovy/frege/gradle/FregePlugin.groovy
+++ b/src/main/groovy/frege/gradle/FregePlugin.groovy
@@ -14,11 +14,12 @@ class FregePlugin implements Plugin<Project> {
}
project.tasks.classes.dependsOn("compileFrege")
- def oFR = project.task('openFregeRepl', type: FregeReplTask, group: 'Runtime', dependsOn: 'classes')
- oFR.outputs.upToDateWhen { false }
+ def replTask = project.task('fregeRepl', type: FregeReplTask, group: 'Tools', dependsOn: 'classes')
+ replTask.outputs.upToDateWhen { false } // always run, regardless of up to date checks
- project.task('fregeRepl', type: ReplTask)
+// project.task('fregeRepl', type: ReplTask) // we can now choose
+
project.task('fregeNativeGen', type: NativeGenTask)
}
diff --git a/src/main/groovy/org/gradle/frege/FregeReplTask.groovy b/src/main/groovy/frege/gradle/FregeReplTask.groovy
index 03ac78d..50d8026 100644
--- a/src/main/groovy/org/gradle/frege/FregeReplTask.groovy
+++ b/src/main/groovy/frege/gradle/FregeReplTask.groovy
@@ -1,4 +1,4 @@
-package org.gradle.frege
+package frege.gradle
import org.gradle.api.DefaultTask
import org.gradle.api.internal.file.FileResolver
@@ -13,46 +13,23 @@ class FregeReplTask extends DefaultTask {
static String DEFAULT_SRC_DIR = "src/main/frege" // TODO: should this come from a source set?
@Optional @InputDirectory
- File replDir
-
- @Optional @InputDirectory
File sourceDir = new File(project.projectDir, DEFAULT_SRC_DIR)
@TaskAction
void openFregeRepl() {
- if (! replDir) replDir = new File(System.properties.'user.home'.toString(), "/.frege/repl")
-
- def replJarFileNames = []
-
- if (! replDir.exists() ) {
- throw new StopActionException("REPL installation directory '${replDir.absolutePath}' does not exist. Cannot start the REPL.")
- }
-
- replDir.eachFileRecurse { file ->
- if (file.name ==~ /^(frege-|ecj-|jline).*\.jar$/) {
- replJarFileNames << file.absolutePath
- }
- }
- logger.debug "repl installation jar file names are ${replJarFileNames}"
-
- if (replJarFileNames.size() < 6) {
- throw new StopActionException("Found only ${replJarFileNames.size()} jars in REPL installation directory '${replDir.absolutePath}'. Cannot start the REPL.")
- }
-
if (! 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
action.standardInput = System.in
- action.setClasspath(project.files(project.configurations.compile , *replJarFileNames))
+ action.setClasspath(project.files(project.configurations.compile ))
action.execute()
}