diff options
author | Dierk Koenig <dierk.koenig@canoo.com> | 2015-03-20 21:32:21 +0100 |
---|---|---|
committer | Dierk Koenig <dierk.koenig@canoo.com> | 2015-03-20 21:32:21 +0100 |
commit | d6ffec57dd65ff1335610db9093fa0e0df38f270 (patch) | |
tree | 041c7c3632e178ea608c5eab926b2c65b17e7778 /src/main/groovy | |
parent | a4371486a2f82cfc8307e4c53c19b72a3aa08ef3 (diff) | |
download | frege-gradle-plugin-d6ffec57dd65ff1335610db9093fa0e0df38f270.tar.gz frege-gradle-plugin-d6ffec57dd65ff1335610db9093fa0e0df38f270.tar.bz2 frege-gradle-plugin-d6ffec57dd65ff1335610db9093fa0e0df38f270.zip |
completing the NativeGenTask with support for setting the input and output file
Diffstat (limited to 'src/main/groovy')
-rw-r--r-- | src/main/groovy/frege/gradle/NativeGenTask.groovy | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/main/groovy/frege/gradle/NativeGenTask.groovy b/src/main/groovy/frege/gradle/NativeGenTask.groovy index 44b5847..94f2fec 100644 --- a/src/main/groovy/frege/gradle/NativeGenTask.groovy +++ b/src/main/groovy/frege/gradle/NativeGenTask.groovy @@ -1,23 +1,47 @@ package frege.gradle import org.gradle.api.DefaultTask +import org.gradle.api.internal.file.FileResolver +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Optional +import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction -import frege.nativegen.* +import org.gradle.process.internal.DefaultJavaExecAction +import org.gradle.process.internal.JavaExecAction -/** - * Created by MarkPerry on 18/02/2015. - */ class NativeGenTask extends DefaultTask { - String filename = "types.properties" + @Optional + @InputFile + File typesFile = new File(project.projectDir, "types.properties") + + @Input + String className = null + + @Optional + @OutputFile + File outputFile = new File(project.buildDir, "generated/frege/NativeGenOutput.fr") - String clazz = null @TaskAction void gen() { - frege.nativegen.Main.main([clazz] as String[]) + FileResolver fileResolver = getServices().get(FileResolver.class) + JavaExecAction action = new DefaultJavaExecAction(fileResolver) + action.setMain("frege.nativegen.Main") + action.workingDir = project.projectDir + action.standardInput = System.in + action.standardOutput = outputFile.newOutputStream() + action.errorOutput = System.err + action.setClasspath(project.files(project.configurations.compile) + project.files("$project.buildDir/classes/main")) + + def args = [] + args << className + args << typesFile.absolutePath + action.args args + action.execute() } |