aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy2
-rw-r--r--src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy20
-rw-r--r--src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy7
-rw-r--r--src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java10
-rw-r--r--src/main/groovy/frege/gradle/plugins/FregePlugin.groovy2
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeCompile.groovy57
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeDoc.groovy2
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy4
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy5
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeRepl.groovy5
10 files changed, 91 insertions, 23 deletions
diff --git a/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy b/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy
index 7415ef1..71d3ea8 100644
--- a/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy
+++ b/src/integTest/groovy/frege/gradle/integtest/fixtures/AbstractFregeIntegrationSpec.groovy
@@ -7,7 +7,7 @@ import org.junit.rules.TemporaryFolder
import spock.lang.Specification
class AbstractFregeIntegrationSpec extends Specification {
- public static final String DEFAULT_FREGE_VERSION = "3.23.370-g898bc8c"
+ public static final String DEFAULT_FREGE_VERSION = "3.24.405"
List<File> pluginClasspath
@Rule
diff --git a/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy
index 2acfa9d..798d333 100644
--- a/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy
+++ b/src/integTest/groovy/frege/gradle/plugins/FregePluginIntegTest.groovy
@@ -3,6 +3,7 @@ import frege.gradle.integtest.fixtures.AbstractFregeIntegrationSpec
import org.gradle.testkit.runner.BuildResult
import spock.lang.Unroll
+import static org.gradle.testkit.runner.TaskOutcome.NO_SOURCE
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
import static org.gradle.testkit.runner.TaskOutcome.UP_TO_DATE
@@ -16,6 +17,12 @@ class FregePluginIntegTest extends AbstractFregeIntegrationSpec {
repositories {
jcenter()
+ flatDir {
+ dirs '${new File(".").absolutePath}/lib'
+ }
+ }
+ compileFrege {
+ classpath = files()
}
"""
}
@@ -31,9 +38,9 @@ class FregePluginIntegTest extends AbstractFregeIntegrationSpec {
when:
def result = run(gradleVersion, "classes")
then:
- result.task(":compileFrege").outcome == UP_TO_DATE
+ result.task(":compileFrege").outcome == NO_SOURCE
where:
- gradleVersion << ["2.8", "2.11", "2.12"]
+ gradleVersion << ["4.0", "5.0", "5.3.1"]
}
@Unroll
@@ -57,12 +64,10 @@ class FregePluginIntegTest extends AbstractFregeIntegrationSpec {
where:
fregeVersion | gradleVersion
- DEFAULT_FREGE_VERSION | "2.12"
+ DEFAULT_FREGE_VERSION | "5.3.1"
+ DEFAULT_FREGE_VERSION | "5.0"
+ DEFAULT_FREGE_VERSION | "4.0"
"3.22.367-g2737683" | "2.12"
- DEFAULT_FREGE_VERSION | "2.9"
- DEFAULT_FREGE_VERSION | "2.8"
- "3.22.367-g2737683" | "2.9"
- "3.22.367-g2737683" | "2.8"
}
private void fregeModule(String modulePath = "src/main/frege/org/frege/HelloFrege.fr") {
@@ -105,6 +110,7 @@ class FregePluginIntegTest extends AbstractFregeIntegrationSpec {
dependencies {
compile "org.frege-lang:frege:$DEFAULT_FREGE_VERSION"
}
+ ext.destinationDir = "docs"
"""
and:
diff --git a/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy b/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy
index 1d01552..2f2b9d4 100644
--- a/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy
+++ b/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy
@@ -17,7 +17,12 @@ class FregeCompileIntegTest extends AbstractFregeIntegrationSpec {
import frege.gradle.tasks.FregeCompile
- repositories { jcenter() }
+ repositories {
+ jcenter()
+ flatDir {
+ dirs '${new File(".").absolutePath}/lib'
+ }
+ }
configurations { frege {} }
diff --git a/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java b/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java
index f45dae4..59fe46e 100644
--- a/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java
+++ b/src/main/groovy/frege/gradle/plugins/FregeBasePlugin.java
@@ -15,8 +15,10 @@ 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> {
@@ -63,16 +65,20 @@ public class FregeBasePlugin implements Plugin<Project> {
String compileTaskName = sourceSet.getCompileTaskName("frege");
FregeCompile compile = project.getTasks().create(compileTaskName, FregeCompile.class);
compile.setModule(project.file(defaultSourcePath).getAbsolutePath());
- javaBasePlugin.configureForSourceSet(sourceSet, compile);
+// 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
index b2ca074..3dd7ccc 100644
--- a/src/main/groovy/frege/gradle/plugins/FregePlugin.groovy
+++ b/src/main/groovy/frege/gradle/plugins/FregePlugin.groovy
@@ -37,7 +37,7 @@ class FregePlugin implements Plugin<Project> {
fregeDoc.group = 'frege'
fregeDoc.dependsOn "compileFrege" // TODO remove
SourceSet mainSourceSet = project.sourceSets.main
- fregeDoc.module = mainSourceSet.output.classesDir.absolutePath
+ fregeDoc.module = mainSourceSet.output.classesDirs.first().absolutePath
fregeDoc.classpath = mainSourceSet.runtimeClasspath
}
diff --git a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
index 1b32351..ffd6aa3 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
@@ -2,6 +2,7 @@ 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
@@ -10,6 +11,38 @@ 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 {
@@ -24,6 +57,12 @@ class FregeCompile extends AbstractCompile {
@Input
boolean optimize = false
+ @Input
+ boolean strictPats = false
+
+ @Input
+ boolean excludeJavaClasspath = false
+
boolean verbose = false
@Input
@@ -60,6 +99,9 @@ class FregeCompile extends AbstractCompile {
FileCollection fregepath
@Input
+ File destinationDir
+
+ @Input
String mainClass = "frege.compiler.Main"
@Input
@@ -87,7 +129,7 @@ class FregeCompile extends AbstractCompile {
javaExecSpec.args = compilerArgs
javaExecSpec.classpath = FregeCompile.this.classpath
javaExecSpec.main = mainClass
- javaExecSpec.jvmArgs = jvmArgumentsToUse
+ javaExecSpec.jvmArgs = jvmArgumentsToUse as List<String>
javaExecSpec.errorOutput = System.err;
javaExecSpec.standardOutput = System.out;
}
@@ -114,15 +156,22 @@ class FregeCompile extends AbstractCompile {
}
if (inline & !optimize)
args << "-inline"
+ if (strictPats)
+ args << "-strict-pats"
+ if (excludeJavaClasspath)
+ args << "-nocp"
if (make)
args << "-make"
- if (!compileGeneratedJava) args << "-j"
+ if (!compileGeneratedJava)
+ args << "-j"
if (target != "") {
args << "-target"
args << target
}
- if (comments) args << "-comments"
- if (suppressWarnings) args << "-nowarn"
+ if (comments)
+ args << "-comments"
+ if (suppressWarnings)
+ args << "-nowarn"
if (explain != "") {
args << "-explain"
args << explain
diff --git a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
index 30f62c6..ddd7bca 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy
@@ -1,6 +1,5 @@
package frege.gradle.tasks
-import org.apache.commons.io.output.TeeOutputStream
import org.gradle.api.Action
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
@@ -9,6 +8,7 @@ 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 {
diff --git a/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy b/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy
index 6f51218..02edefd 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeNativeGen.groovy
@@ -7,7 +7,7 @@ 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
@@ -37,7 +37,7 @@ class FregeNativeGen extends DefaultTask {
void gen() {
FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultJavaExecAction(fileResolver)
+ JavaExecAction action = new DefaultExecActionFactory(fileResolver).newJavaExecAction()
action.setMain("frege.nativegen.Main")
action.workingDir = project.projectDir
action.standardInput = System.in
diff --git a/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy b/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy
index e06236f..afeacac 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeQuickCheck.groovy
@@ -2,6 +2,7 @@ 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
@@ -60,7 +61,7 @@ class FregeQuickCheck extends DefaultTask {
void runQuickCheck() {
FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultJavaExecAction(fileResolver)
+ JavaExecAction action = new DefaultExecActionFactory(fileResolver).newJavaExecAction()
action.setMain("frege.tools.Quick")
action.standardInput = System.in
@@ -89,4 +90,4 @@ class FregeQuickCheck extends DefaultTask {
action.execute()
}
-} \ No newline at end of file
+}
diff --git a/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy b/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
index 64e0186..693e076 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeRepl.groovy
@@ -3,6 +3,7 @@ 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
@@ -27,7 +28,7 @@ class FregeRepl extends DefaultTask {
}
FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultJavaExecAction(fileResolver)
+ JavaExecAction action = new DefaultExecActionFactory(fileResolver).newJavaExecAction()
action.setMain("frege.repl.FregeRepl")
action.workingDir = sourceDir ?: project.projectDir
action.standardInput = System.in
@@ -36,4 +37,4 @@ class FregeRepl extends DefaultTask {
action.execute()
}
-} \ No newline at end of file
+}