diff options
author | Dierk Koenig <dierk.koenig@canoo.com> | 2020-06-23 11:57:12 +0200 |
---|---|---|
committer | Dierk Koenig <dierk.koenig@canoo.com> | 2020-06-28 15:47:10 +0200 |
commit | 739d5007295f578e033209ddeb05351b81ae4dd0 (patch) | |
tree | 6201f355868dda09d838234e8f663bfad5c832f6 | |
parent | 874490ffa3dfb3380960b7c02923f1fac7a79b9a (diff) | |
download | frege-gradle-plugin-739d5007295f578e033209ddeb05351b81ae4dd0.tar.gz frege-gradle-plugin-739d5007295f578e033209ddeb05351b81ae4dd0.tar.bz2 frege-gradle-plugin-739d5007295f578e033209ddeb05351b81ae4dd0.zip |
compiles and runs with frege-3.25.84.jar and Gradle 5.0
18 files changed, 144 insertions, 67 deletions
diff --git a/build.gradle b/build.gradle index 86b5a4a..8d58aea 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,8 @@ apply from: 'gradle/integTest.gradle' defaultTasks "build" -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 ext { baseVersion = "0.9" @@ -17,34 +17,34 @@ ext { projectVersion = baseVersion + (isSnapshot ? snapshotAppendix : "") projectGroup = "org.frege-lang" - fregeBaseVersion = "3.23.288" - fregeClassifier = "-gaa3af0c" + fregeBaseVersion = "3.25.84" + fregeClassifier = "" fregeVersion = "$fregeBaseVersion$fregeClassifier" // work around https://issues.gradle.org/browse/GRADLE-3281 // fixed in 0.9.3 https://plugins.gradle.org/plugin/com.gradle.plugin-publish - def home = new File(System.getProperty("user.home")) - def propfile = new File(home, ".gradle/gradle.properties") - if (propfile.exists()) { - props = new Properties() - propfile.withReader { - props.load(it) - def keyName = "gradle.publish.key" - def key = props.getProperty(keyName) - if (key == null) { - println "No key named $keyName found in ${propfile.absolutePath}" - } - def secretName = "gradle.publish.secret" - def secret = props.getProperty(secretName) - if (secret == null) { - println "No key named $secretName found in ${propfile.absolutePath}" - } - if (key != null && secret != null) { - System.setProperty "gradle.publish.key", props.'gradle.publish.key' - System.setProperty "gradle.publish.secret", props.'gradle.publish.secret' - } - } - } else println "cannot find '$propfile.absolutePath'" +// def home = new File(System.getProperty("user.home")) +// def propfile = new File(home, ".gradle/gradle.properties") +// if (propfile.exists()) { +// props = new Properties() +// propfile.withReader { +// props.load(it) +// def keyName = "gradle.publish.key" +// def key = props.getProperty(keyName) +// if (key == null) { +// println "No key named $keyName found in ${propfile.absolutePath}" +// } +// def secretName = "gradle.publish.secret" +// def secret = props.getProperty(secretName) +// if (secret == null) { +// println "No key named $secretName found in ${propfile.absolutePath}" +// } +// if (key != null && secret != null) { +// System.setProperty "gradle.publish.key", props.'gradle.publish.key' +// System.setProperty "gradle.publish.secret", props.'gradle.publish.secret' +// } +// } +// } else println "cannot find '$propfile.absolutePath'" } apply from: "gradle/sonatype.gradle" @@ -55,6 +55,10 @@ group = projectGroup repositories { mavenLocal() mavenCentral() + + flatDir { + dirs 'lib' + } } dependencies { diff --git a/gradle.properties b/gradle.properties index 7349a1d..493b0ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,3 +3,6 @@ signingEnabled = false sonatypeUsername = incorrectUsername sonatypePassword = incorrectPassword + +#(all,none,summary) +org.gradle.warning.mode=all diff --git a/gradle/integTest.gradle b/gradle/integTest.gradle index ebf31b7..b1baf13 100644 --- a/gradle/integTest.gradle +++ b/gradle/integTest.gradle @@ -12,7 +12,7 @@ configurations { task integTest(type: Test) { shouldRunAfter 'test' - testClassesDir = sourceSets.integTest.output.classesDir + testClassesDirs = sourceSets.integTest.output.classesDirs classpath = sourceSets.integTest.runtimeClasspath } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex ba3586f..f6b961f 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d7ce6db..d07a839 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu May 05 22:54:51 CEST 2016 +#Thu Apr 04 17:17:55 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f6d5974..e95643d 100644..100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -49,7 +49,6 @@ goto fail @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
diff --git a/lib/frege-3.25.84.jar b/lib/frege-3.25.84.jar Binary files differnew file mode 100644 index 0000000..a0090fc --- /dev/null +++ b/lib/frege-3.25.84.jar 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 +} |