aboutsummaryrefslogtreecommitdiff
path: root/src/main/groovy/frege
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/groovy/frege')
-rw-r--r--src/main/groovy/frege/gradle/DefaultFregeSourceSet.java31
-rw-r--r--src/main/groovy/frege/gradle/FregeSourceDirectorySet.groovy26
-rw-r--r--src/main/groovy/frege/gradle/FregeSourceSet.java8
-rw-r--r--src/main/groovy/frege/gradle/FregeSourceSetDirectoryFactory.groovy30
-rw-r--r--src/main/groovy/frege/gradle/FregeSourceSetOutputs.groovy7
-rw-r--r--src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java87
-rw-r--r--src/main/groovy/frege/gradle/plugins/FregePlugin.groovy44
-rw-r--r--src/main/groovy/frege/gradle/plugins/FregePluginExtension.groovy11
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeCompile.groovy214
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeDoc.groovy86
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy61
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy93
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeRepl.groovy40
13 files changed, 0 insertions, 738 deletions
diff --git a/src/main/groovy/frege/gradle/DefaultFregeSourceSet.java b/src/main/groovy/frege/gradle/DefaultFregeSourceSet.java
deleted file mode 100644
index a1650a1..0000000
--- a/src/main/groovy/frege/gradle/DefaultFregeSourceSet.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package frege.gradle;
-
-import groovy.lang.Closure;
-import org.gradle.api.file.SourceDirectorySet;
-import org.gradle.util.ConfigureUtil;
-
-public class DefaultFregeSourceSet implements FregeSourceSet {
- private final SourceDirectorySet frege;
- private final SourceDirectorySet allFrege;
-
- public DefaultFregeSourceSet(String displayName, FregeSourceSetDirectoryFactory sourceSetFactory) {
- this.frege = sourceSetFactory.newSourceSetDirectory(String.format("%s Frege source", new Object[]{displayName}));
- this.frege.getFilter().include(new String[]{"**/*.fr"});
- this.allFrege = sourceSetFactory.newSourceSetDirectory(String.format("%s Frege source", new Object[]{displayName}));
- this.allFrege.source(this.frege);
- this.allFrege.getFilter().include(new String[]{"**/*.fr"});
- }
-
- public SourceDirectorySet getFrege() {
- return this.frege;
- }
-
- public FregeSourceSet frege(Closure configureClosure) {
- ConfigureUtil.configure(configureClosure, this.getFrege());
- return this;
- }
-
- public SourceDirectorySet getAllFrege() {
- return this.allFrege;
- }
-}
diff --git a/src/main/groovy/frege/gradle/FregeSourceDirectorySet.groovy b/src/main/groovy/frege/gradle/FregeSourceDirectorySet.groovy
deleted file mode 100644
index 35110f5..0000000
--- a/src/main/groovy/frege/gradle/FregeSourceDirectorySet.groovy
+++ /dev/null
@@ -1,26 +0,0 @@
-package frege.gradle
-
-import org.gradle.api.file.FileTree
-import org.gradle.api.tasks.util.PatternFilterable
-
-interface FregeSourceDirectorySet extends PatternFilterable {
- def String getName()
-
- def FregeSourceDirectorySet srcDir(Object srcPath)
-
- def FregeSourceDirectorySet srcDirs(Object... srcPaths)
-
- def Set<File> getSrcDirs()
-
- def FregeSourceDirectorySet setSrcDirs(Iterable<?> srcPaths)
-
- def FileTree getFiles()
-
- def PatternFilterable getFilter()
-
- def FregeSourceSetOutputs getOutput()
-
- def String getGeneratorTaskName()
-
- boolean contains(File file)
-} \ No newline at end of file
diff --git a/src/main/groovy/frege/gradle/FregeSourceSet.java b/src/main/groovy/frege/gradle/FregeSourceSet.java
deleted file mode 100644
index 27654f1..0000000
--- a/src/main/groovy/frege/gradle/FregeSourceSet.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package frege.gradle;
-
-import org.gradle.api.file.SourceDirectorySet;
-
-public interface FregeSourceSet {
- SourceDirectorySet getFrege();
- SourceDirectorySet getAllFrege();
-}
diff --git a/src/main/groovy/frege/gradle/FregeSourceSetDirectoryFactory.groovy b/src/main/groovy/frege/gradle/FregeSourceSetDirectoryFactory.groovy
deleted file mode 100644
index 96abc8f..0000000
--- a/src/main/groovy/frege/gradle/FregeSourceSetDirectoryFactory.groovy
+++ /dev/null
@@ -1,30 +0,0 @@
-package frege.gradle
-
-import org.gradle.api.file.SourceDirectorySet
-import org.gradle.api.internal.file.DefaultSourceDirectorySet
-import org.gradle.api.internal.file.FileResolver
-import org.gradle.api.internal.file.SourceDirectorySetFactory
-import org.gradle.api.internal.project.ProjectInternal
-import org.gradle.util.GradleVersion
-
-public class FregeSourceSetDirectoryFactory {
- private final boolean useFactory;
- private final FileResolver fileResolver
- private final ProjectInternal project
-
- public FregeSourceSetDirectoryFactory(ProjectInternal project, FileResolver fileResolver) {
- this.fileResolver = fileResolver
- this.project = project
- this.useFactory = GradleVersion.current().compareTo(GradleVersion.version("2.12")) >= 0;
-
- }
-
- public SourceDirectorySet newSourceSetDirectory(String displayName) {
- if (useFactory) {
- SourceDirectorySetFactory factory = project.getServices().get(SourceDirectorySetFactory.class);
- return factory.create(displayName);
- } else {
- return new DefaultSourceDirectorySet(displayName, fileResolver);
- }
- }
-}
diff --git a/src/main/groovy/frege/gradle/FregeSourceSetOutputs.groovy b/src/main/groovy/frege/gradle/FregeSourceSetOutputs.groovy
deleted file mode 100644
index 07e90a3..0000000
--- a/src/main/groovy/frege/gradle/FregeSourceSetOutputs.groovy
+++ /dev/null
@@ -1,7 +0,0 @@
-package frege.gradle
-
-import org.gradle.api.file.FileCollection
-
-interface FregeSourceSetOutputs {
- FileCollection getDirs()
-} \ No newline at end of file
diff --git a/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java b/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java
deleted file mode 100644
index 59fe46e..0000000
--- a/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package frege.gradle.plugins;
-
-import frege.gradle.DefaultFregeSourceSet;
-import frege.gradle.FregeSourceSetDirectoryFactory;
-import frege.gradle.tasks.FregeCompile;
-import org.gradle.api.Action;
-import org.gradle.api.Plugin;
-import org.gradle.api.Project;
-import org.gradle.api.file.FileTreeElement;
-import org.gradle.api.internal.file.FileResolver;
-import org.gradle.api.internal.plugins.DslObject;
-import org.gradle.api.internal.project.ProjectInternal;
-import org.gradle.api.internal.tasks.DefaultSourceSet;
-import org.gradle.api.plugins.JavaBasePlugin;
-import org.gradle.api.plugins.JavaPluginConvention;
-import org.gradle.api.specs.Spec;
-import org.gradle.api.tasks.SourceSet;
-import org.gradle.internal.classpath.DefaultClassPath;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.util.concurrent.Callable;
-
-public class FregeBasePlugin implements Plugin<Project> {
- private FileResolver fileResolver;
-
- private static String EXTENSION_NAME = "frege";
- private FregePluginExtension fregePluginExtension;
- private Project project;
-
- @Inject
- public FregeBasePlugin(FileResolver fileResolver) {
- this.fileResolver = fileResolver;
- }
-
- @Override
- public void apply(final Project project) {
- // Workaround to build proper jars on Windows, see https://github.com/Frege/frege-gradle-plugin/issues/9
- this.project = project;
- System.setProperty("file.encoding", "UTF-8");
- project.getPluginManager().apply(JavaBasePlugin.class);
- fregePluginExtension = project.getExtensions().create(EXTENSION_NAME, FregePluginExtension.class);
- JavaBasePlugin javaBasePlugin = project.getPlugins().getPlugin(JavaBasePlugin.class);
- configureSourceSetDefaults(javaBasePlugin);
- }
-
-
- private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) {
- project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(new Action<SourceSet>() {
- public void execute(final SourceSet sourceSet) {
- FregeSourceSetDirectoryFactory factory = new FregeSourceSetDirectoryFactory((ProjectInternal) project, fileResolver);
- final DefaultFregeSourceSet fregeSourceSet = new DefaultFregeSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), factory);
- new DslObject(sourceSet).getConvention().getPlugins().put("frege", fregeSourceSet);
-
- final String defaultSourcePath = String.format("src/%s/frege", sourceSet.getName());
- fregeSourceSet.getFrege().srcDir(defaultSourcePath);
- sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() {
- public boolean isSatisfiedBy(FileTreeElement element) {
- return fregeSourceSet.getFrege().contains(element.getFile());
- }
- });
- sourceSet.getAllJava().source(fregeSourceSet.getFrege());
- sourceSet.getAllSource().source(fregeSourceSet.getFrege());
-
- String compileTaskName = sourceSet.getCompileTaskName("frege");
- FregeCompile compile = project.getTasks().create(compileTaskName, FregeCompile.class);
- compile.setModule(project.file(defaultSourcePath).getAbsolutePath());
-// javaBasePlugin.configureForSourceSet(sourceSet, compile);
- compile.getConventionMapping().map("fregepath", new Callable() {
- public Object call() throws Exception {
- return sourceSet.getCompileClasspath();
- }
- });
- compile.dependsOn(sourceSet.getCompileJavaTaskName());
- compile.setDescription(String.format("Compiles the %s Frege source.", sourceSet.getName()));
- compile.setSource(fregeSourceSet.getFrege());
-
-// compile.setClasspath(sourceSet.getCompileClasspath());
-// compile.setDestinationDir((File)null);
-
-
- project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName);
- sourceSet.compiledBy(compile);
- }
- });
- }
-}
diff --git a/src/main/groovy/frege/gradle/plugins/FregePlugin.groovy b/src/main/groovy/frege/gradle/plugins/FregePlugin.groovy
deleted file mode 100644
index 3dd7ccc..0000000
--- a/src/main/groovy/frege/gradle/plugins/FregePlugin.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-package frege.gradle.plugins
-import frege.gradle.tasks.FregeDoc
-import frege.gradle.tasks.FregeNativeGen
-import frege.gradle.tasks.FregeQuickCheck
-import frege.gradle.tasks.FregeRepl
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.tasks.SourceSet
-
-class FregePlugin implements Plugin<Project> {
-
- Project project
-
- void apply(Project project) {
- this.project = project
-
- project.plugins.apply(FregeBasePlugin)
- project.plugins.apply("java")
-
- def replTask = project.task('fregeRepl', type: FregeRepl, group: 'frege', dependsOn: 'compileFrege')
- replTask.outputs.upToDateWhen { false } // always run, regardless of up to date checks
-
- def checkTask = project.task('fregeQuickCheck', type: FregeQuickCheck, group: 'frege', dependsOn: 'testClasses')
- checkTask.outputs.upToDateWhen { false } // always run, regardless of up to date checks
-
- project.tasks.test.dependsOn("fregeQuickCheck")
-
-
- configureFregeDoc()
-
- project.task('fregeNativeGen', type: FregeNativeGen, group: 'frege')
-
- }
-
- def configureFregeDoc() {
- FregeDoc fregeDoc = project.tasks.create('fregeDoc', FregeDoc)
- fregeDoc.group = 'frege'
- fregeDoc.dependsOn "compileFrege" // TODO remove
- SourceSet mainSourceSet = project.sourceSets.main
- fregeDoc.module = mainSourceSet.output.classesDirs.first().absolutePath
- fregeDoc.classpath = mainSourceSet.runtimeClasspath
- }
-
-}
diff --git a/src/main/groovy/frege/gradle/plugins/FregePluginExtension.groovy b/src/main/groovy/frege/gradle/plugins/FregePluginExtension.groovy
deleted file mode 100644
index ae180ec..0000000
--- a/src/main/groovy/frege/gradle/plugins/FregePluginExtension.groovy
+++ /dev/null
@@ -1,11 +0,0 @@
-package frege.gradle.plugins
-
-/**
- * Created by mperry on 6/02/2015.
- */
-class FregePluginExtension {
-
-
- String key1
-
-}
diff --git a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
deleted file mode 100644
index d619158..0000000
--- a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
+++ /dev/null
@@ -1,214 +0,0 @@
-package frege.gradle.tasks
-
-import groovy.transform.TypeChecked
-import org.gradle.api.Action
-import org.gradle.api.file.Directory
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.Optional
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.tasks.compile.AbstractCompile
-import org.gradle.process.JavaExecSpec
-
-/* Compiler flags as of 3.25.84
-
--d directory target directory for *.java and *.class files
--fp classpath where to find imported frege packages
--enc charset charset for source code files, standard is UTF-8
--enc DEFAULT platform default charset for source code files
--target n.m generate code for java version n.m, also passed to javac
--nocp exclude java classpath from -fp
--hints print more detailed error messages and warnings
--inline inline functions where possible
--strict-pats check patterns in multi-argument functions strictly from left to right
--comments generate commented code
--explain i[-j] print some debugging output from type checker
- regarding line(s) i (to j). May help to understand
- inexplicable type errors better.
--nowarn don't print warnings (not recommended)
--v verbose mode on
--make build outdated or missing imports
--sp srcpath look for source files in srcpath, default is .
--target x.y generate code for java version x.y, default is the
- version of the JVM the compiler is running in.
--j do not run the java compiler
--ascii do not use →, ⇒, ∀ and ∷ when presenting types,
- and use ascii characters for java generics variables
--greek make greek type variables
--fraktur make 𝖋𝖗𝖆𝖐𝖙𝖚𝖗 type variables
--latin make latin type variables
-
-*/
-
-
-
-@TypeChecked
-class FregeCompile extends AbstractCompile {
-
- FileCollection classpath
-
- @Input
- String stackSize = "4m"
-
- @Input
- boolean hints = false
-
- @Input
- boolean optimize = false
-
- @Input
- boolean strictPats = false
-
- @Input
- boolean excludeJavaClasspath = false
-
- boolean verbose = false
-
- @Input
- boolean inline = true
-
- @Input
- boolean make = true
-
- @Input
- boolean compileGeneratedJava = true
-
- @Input
- String target = ""
-
- @Input
- boolean comments = false
-
- @Input
- boolean suppressWarnings = false
-
- @Input
- String explain = ""
-
- @Input
- String extraArgs = ""
-
- @Input
- String allArgs = "" // this is an option to overrule all other settings
-
- @Input
- String module = ""
-
- @Optional @InputFiles
- FileCollection fregepath
-
- @Input
- File destinationDir
-
- @Input
- String mainClass = "frege.compiler.Main"
-
- @Input
- List<String> allJvmArgs = []
-
- @Input
- String encoding = ""
-
- @Input
- String prefix = ""
-
- List<File> sourcePaths = []
-
- // @Override // spurious compile error
- @TaskAction
- protected void compile() {
- def jvmArgumentsToUse = allJvmArgs.empty ? ["-Xss$stackSize"] : new ArrayList<String>(allJvmArgs)
- def compilerArgs = allArgs ? allArgs.split().toList() : assembleArguments()
-
- logger.info("Calling Frege compiler with compilerArgs: '$compilerArgs'")
- //TODO integrate with gradle compiler daemon infrastructure and skip internal execution
- project.javaexec(new Action<JavaExecSpec>() {
- @Override
- void execute(JavaExecSpec javaExecSpec) {
- javaExecSpec.args = compilerArgs
- javaExecSpec.classpath = FregeCompile.this.classpath
- javaExecSpec.main = mainClass
- javaExecSpec.jvmArgs = jvmArgumentsToUse as List<String>
- javaExecSpec.errorOutput = System.err;
- javaExecSpec.standardOutput = System.out;
- }
- });
-
- }
-
- public FregeCompile source(Object... sources) {
- super.source(sources);
- // track directory roots
- for (Object source : sources) {
- sourcePaths.add(project.file(source))
- }
- return this;
- }
-
- protected List<String> assembleArguments() {
- List args = []
- if (hints)
- args << "-hints"
- if (optimize) {
- args << "-O"
- args << "-inline"
- }
- if (inline & !optimize)
- args << "-inline"
- if (strictPats)
- args << "-strict-pats"
- if (excludeJavaClasspath)
- args << "-nocp"
- if (make)
- args << "-make"
- if (!compileGeneratedJava)
- args << "-j"
- if (target != "") {
- args << "-target"
- args << target
- }
- if (comments)
- args << "-comments"
- if (suppressWarnings)
- args << "-nowarn"
- if (explain != "") {
- args << "-explain"
- args << explain
- }
- if (verbose)
- args << "-v"
-
-
- if (fregepath != null && !fregepath.isEmpty()) {
- args << "-fp"
- args << fregepath.files.collect { f -> f.absolutePath }.join(File.pathSeparator)
- }
-
- if (sourcePaths != null && !sourcePaths.isEmpty()) {
- args << "-sp"
- args << sourcePaths.collect { d -> d.absolutePath }.join(File.pathSeparator)
- }
-
- if (encoding != "") {
- args << "-enc"
- args << encoding
- }
-
- if (prefix != "") {
- args << "-prefix"
- args << prefix
- }
-
- args << "-d"
- args << getDestinationDir().absolutePath
-
- if (!module.isEmpty()) {
- logger.info "compiling module '$module'"
- args << module
- } else {
- args = (args + extraArgs.split().toList()).toList()
- }
- args
- }
-}
diff --git a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
deleted file mode 100644
index ddd7bca..0000000
--- a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
+++ /dev/null
@@ -1,86 +0,0 @@
-package frege.gradle.tasks
-
-import org.gradle.api.Action
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.Optional
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.TaskAction
-import org.gradle.internal.impldep.org.apache.commons.io.output.TeeOutputStream
-import org.gradle.process.JavaExecSpec
-
-class FregeDoc extends DefaultTask {
-
- /* Usage: java -jar fregec.jar frege.tools.Doc [-v] [-d opt] [-x mod,...] modules ...
- * -v print a message for each processed module
- * -d docdir specify root directory for documentation
- * Documentation for module x.y.Z will be writen to
- * $docdir/x/y/Z.html
- * -cp classpath class path for doc tool
- * -x mod1[,mod2] exclude modules whose name starts with 'mod1' or 'mod2'
- *
- * Modules can be specified in three ways:
- * my.nice.Modul by name, the Java class for this module must be on the class path
- * directory/ all modules that could be loaded if the given directory was on the class path, except exxcluded ones
- * path.jar all modules in the specified JAR file, except excluded ones
- *
- * Example: document base frege distribution without compiler modules
- * java -cp fregec.jar frege.tools.Doc -d doc -x frege.compiler fregec.jar
- *
- */
-
- static String DEFAULT_DOCS_SUBDIR = "docs/frege" // TODO: should this come from a convention?
-
- @Optional
- @OutputDirectory
- File targetDir = new File(project.buildDir, DEFAULT_DOCS_SUBDIR)
-
- @Input
- String module // module name or directory or class path. Default is all production modules
-
- @Input
- @Optional
- String exclude = null
-
- @Input
- @Optional
- Boolean verbose = null
-
- FileCollection classpath
-
- @TaskAction
- void fregedoc() {
- ByteArrayOutputStream berr = new ByteArrayOutputStream()
- def teeOutputStream = new TeeOutputStream(System.err, berr)
- def result = project.javaexec(new Action<JavaExecSpec>() {
- @Override
- void execute(JavaExecSpec javaExecSpec) {
- if (verbose) {
- javaExecSpec.args '-v'
- }
- javaExecSpec.args '-d', targetDir.absolutePath
- if (exclude) {
- javaExecSpec.args '-x', exclude
- }
- javaExecSpec.args(module)
- javaExecSpec.main = "frege.tools.Doc"
- javaExecSpec.workingDir = project.projectDir
- javaExecSpec.standardInput = System.in
- javaExecSpec.standardOutput = System.out
- javaExecSpec.errorOutput = teeOutputStream
- javaExecSpec.classpath = this.classpath
-
- javaExecSpec.ignoreExitValue = true
- }
- })
-
- //Workaround for failing with java sources. should result in exit value 0 anyway.
- def berrString = berr.toString()
- if (result.exitValue !=0 && !berrString.contains("there were errors for")) {
- throw new GradleException("Non zero exit value running FregeDoc.");
- }
- }
-}
-
diff --git a/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy b/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy
deleted file mode 100644
index 02edefd..0000000
--- a/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy
+++ /dev/null
@@ -1,61 +0,0 @@
-package frege.gradle.tasks
-
-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 org.gradle.process.internal.DefaultExecActionFactory
-import org.gradle.process.internal.DefaultJavaExecAction
-import org.gradle.process.internal.JavaExecAction
-
-class FregeNativeGen extends DefaultTask {
-
- /*
- * Example from https://github.com/Frege/frege-native-gen:
- * java -cp /path/to/guava-15.0.jar:lib/frege-YY.jar:frege-native-gen-XX.jar frege.nativegen.Main com.google.common.collect.ImmutableCollection
- */
-
- // help not currently supported by native gen tool
- Boolean help = false
-
- @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")
-
-
- @TaskAction
- void gen() {
-
- FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultExecActionFactory(fileResolver).newJavaExecAction()
- 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 = []
- if (help) {
- args << "-h"
- } else {
- args << className
- args << typesFile.absolutePath
- }
- logger.info("Calling Frege NativeGen with args: '$args'")
- action.args args
- action.execute()
- }
-
-
-}
diff --git a/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy b/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy
deleted file mode 100644
index afeacac..0000000
--- a/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy
+++ /dev/null
@@ -1,93 +0,0 @@
-package frege.gradle.tasks
-import org.gradle.api.DefaultTask
-import org.gradle.api.internal.file.FileResolver
-import org.gradle.api.tasks.TaskAction
-import org.gradle.process.internal.DefaultExecActionFactory
-import org.gradle.process.internal.DefaultJavaExecAction
-import org.gradle.process.internal.JavaExecAction
-
-class FregeQuickCheck 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.
-
- */
-
- Boolean verbose = true
- Boolean listAvailable = false
- Boolean help = false
- Integer num = 100
- List<String> includePredicates
- List<String> excludePredicates
- String moduleName
- String moduleDirectory
- String moduleJar
- List<String> classpathDirectories = ["$project.buildDir/classes/main", "$project.buildDir/classes/test"]
- String moduleDir = "$project.buildDir/classes/test"
- List<String> allJvmArgs = []
-
- @TaskAction
- void runQuickCheck() {
-
- FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultExecActionFactory(fileResolver).newJavaExecAction()
- action.setMain("frege.tools.Quick")
-
- action.standardInput = System.in
- action.standardOutput = System.out
- action.errorOutput = System.err
-
- def f = project.files(classpathDirectories.collect { s -> new File(s) })
- action.setClasspath(project.files(project.configurations.compile).plus(project.files(project.configurations.testRuntime)).plus(f))
-
-
- project.configurations.testRuntime.each { println it }
-
- def args = []
- if (help) {
-
- } else {
- if (verbose) args << "-v"
- if (listAvailable) args << "-l"
- if (!allJvmArgs.isEmpty()) {
- action.setJvmArgs(allJvmArgs)
- }
- args = args + [moduleDir]
- }
- logger.info("Calling Frege QuickCheck with args: '$args'")
- action.args args
- action.execute()
- }
-
-}
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()
- }
-
-}