diff options
author | Dierk Koenig <dierk.koenig@canoo.com> | 2015-02-24 02:05:20 +0100 |
---|---|---|
committer | Dierk Koenig <dierk.koenig@canoo.com> | 2015-02-24 02:06:29 +0100 |
commit | eb6934c39cf00d92ae657896c504fa17ac6bfc5a (patch) | |
tree | 593b3802568ecf68a853eb562e7c6bb908314a69 | |
parent | 91d37b288290b99993cdeccbca653af87dbfcad8 (diff) | |
download | frege-gradle-plugin-eb6934c39cf00d92ae657896c504fa17ac6bfc5a.tar.gz frege-gradle-plugin-eb6934c39cf00d92ae657896c504fa17ac6bfc5a.tar.bz2 frege-gradle-plugin-eb6934c39cf00d92ae657896c504fa17ac6bfc5a.zip |
first step into quickcheck integration. It works on "inline" checks but not yet with tests from src/test. Those are not yet automatically compiled.
-rw-r--r-- | src/main/groovy/frege/gradle/FregePlugin.groovy | 3 | ||||
-rw-r--r-- | src/main/groovy/frege/gradle/FregeQuickCheckTask.groovy | 62 | ||||
-rw-r--r-- | todo.txt | 2 |
3 files changed, 66 insertions, 1 deletions
diff --git a/src/main/groovy/frege/gradle/FregePlugin.groovy b/src/main/groovy/frege/gradle/FregePlugin.groovy index 1ce9eaa..259bffa 100644 --- a/src/main/groovy/frege/gradle/FregePlugin.groovy +++ b/src/main/groovy/frege/gradle/FregePlugin.groovy @@ -17,6 +17,9 @@ class FregePlugin implements Plugin<Project> { def replTask = project.task('fregeRepl', type: FregeReplTask, group: 'Tools', dependsOn: 'classes') replTask.outputs.upToDateWhen { false } // always run, regardless of up to date checks + def checkTask = project.task('quickCheck', type: FregeQuickCheckTask, group: 'Tools', dependsOn: 'classes') + checkTask.outputs.upToDateWhen { false } // always run, regardless of up to date checks + // project.task('fregeRepl', type: ReplTask) // we can now choose diff --git a/src/main/groovy/frege/gradle/FregeQuickCheckTask.groovy b/src/main/groovy/frege/gradle/FregeQuickCheckTask.groovy new file mode 100644 index 0000000..31f7d27 --- /dev/null +++ b/src/main/groovy/frege/gradle/FregeQuickCheckTask.groovy @@ -0,0 +1,62 @@ +package frege.gradle + +import org.gradle.api.DefaultTask +import org.gradle.api.internal.file.FileResolver +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.Optional +import org.gradle.api.tasks.TaskAction +import org.gradle.process.internal.DefaultJavaExecAction +import org.gradle.process.internal.JavaExecAction + +class FregeQuickCheckTask extends DefaultTask { + + // more options to consider: +/* + Looks up quick check predicates in the given modules and tests them. + + [Usage:] java -cp fregec.jar frege.tools.Quick [ option ... ] modulespec ... + + Options: + + - -v print a line for each pedicate that passed + - -n num run _num_ tests per predicate, default is 100 + - -p pred1,pred2,... only test the given predicates + - -x pred1,pred2,... do not test the given predicates + - -l just print the names of the predicates available. + + Ways to specify modules: + + - module the module name (e.g. my.great.Module), will be lookup up in + the current class path. + - dir/ A directory path. The directory is searched for class files, + and for each class files an attempt is made to load it as if + the given directory was in the class path. The directory must + be the root of the classes contained therein, otherwise the + classes won't get loaded. + - path-to.jar A jar or zip file is searched for class files, and for each + class file found an attempt is made to load it as if the + jar was in the class path. + + The number of passed/failed tests is reported. If any test failed or other + errors occured, the exit code will be non zero. + + The code will try to heat up your CPU by running tests on all available cores. + This should be faster on multi-core computers than running the tests + sequentially. It makes it feasable to run more tests per predicate. + + */ + @TaskAction + void runQuickCheck() { + + FileResolver fileResolver = getServices().get(FileResolver.class) + JavaExecAction action = new DefaultJavaExecAction(fileResolver) + action.setMain("frege.tools.Quick") + action.setClasspath(project.files(project.configurations.testRuntime)) + + project.configurations.testRuntime.each { println it } + + action.args("$project.buildDir/classes/main/") // test all in build dir and below build/classes/test/ + action.execute() + } + +}
\ No newline at end of file @@ -1,2 +1,2 @@ -- add task for QuickCheck +- make a compileTestFrege with the respective task dependencies - add task for FregeDoc
\ No newline at end of file |