aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Perry <maperry78@yahoo.com.au>2015-02-17 00:03:09 +1000
committerMark Perry <maperry78@yahoo.com.au>2015-02-17 00:03:09 +1000
commit922633f241452743ef3ea5238a9f488122519c9a (patch)
tree84d08e672b8a8485571c97844aa93a3865c14aaa /src/main
parent4f32ab3ae5f7f8ef5ef1f5efdc0a5efdeaad8d53 (diff)
downloadfrege-gradle-plugin-922633f241452743ef3ea5238a9f488122519c9a.tar.gz
frege-gradle-plugin-922633f241452743ef3ea5238a9f488122519c9a.tar.bz2
frege-gradle-plugin-922633f241452743ef3ea5238a9f488122519c9a.zip
Compile project if frege source dir is missing
Diffstat (limited to 'src/main')
-rw-r--r--src/main/groovy/org/gradle/frege/FregeTask.groovy17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/groovy/org/gradle/frege/FregeTask.groovy b/src/main/groovy/org/gradle/frege/FregeTask.groovy
index df4f7d6..bed9e2e 100644
--- a/src/main/groovy/org/gradle/frege/FregeTask.groovy
+++ b/src/main/groovy/org/gradle/frege/FregeTask.groovy
@@ -37,17 +37,13 @@ class FregeTask extends DefaultTask {
String module = ""
@Optional @InputDirectory
- File sourceDir = new File(project.projectDir, DEFAULT_SRC_DIR)
+ File sourceDir = new File(project.projectDir, DEFAULT_SRC_DIR).exists() ? new File(project.projectDir, DEFAULT_SRC_DIR) : null
@Optional @OutputDirectory
File outputDir = new File(project.buildDir, DEFAULT_CLASSES_SUBDIR)
@TaskAction
void executeCompile() {
-
- if (! sourceDir.exists() ) {
- throw new StopActionException("Source directory '${sourceDir.absolutePath}' does not exist. Cannot compile Frege code.")
- }
if (! outputDir.exists() ) {
logger.info "Creating output directory '${outputDir.absolutePath}'."
outputDir.mkdirs()
@@ -80,15 +76,20 @@ class FregeTask extends DefaultTask {
if (skipCompile)
args << "-j"
- args << "-sp"
- args << sourceDir.absolutePath
+ if (sourceDir != null) {
+ args << "-sp"
+ args << sourceDir.absolutePath
+ }
args << "-d"
args << outputDir
if (!module && !extraArgs) {
logger.info "no module and no extra args given: compiling all of the sourceDir"
- args << sourceDir.absolutePath
+ if (sourceDir != null) {
+ args << sourceDir.absolutePath
+ }
+
} else if (module) {
logger.info "compiling module '$module'"
args << module