mpl/build.gradle
developtheweb acb98ae145 Fix examples so all ten parse
- 03: handler clause uses the canonical arrow (↯e ⟹ …, was ↯e ⇒ …)
- 05: give sin/cos a real placeholder body (⊥) — a comment-only body is
  empty and cannot parse
- Run parseExamples on the test runtime classpath; ParseExamples lives in
  the test source set and was never found on main.runtimeClasspath

./gradlew parseExamples now reports 10/10 PASS
2026-07-09 02:54:10 -04:00

56 lines
No EOL
1.4 KiB
Groovy

plugins {
id 'java'
id 'antlr'
}
group = 'com.mpl'
version = '0.1-alpha'
repositories {
mavenCentral()
}
dependencies {
antlr 'org.antlr:antlr4:4.13.1'
implementation 'org.antlr:antlr4-runtime:4.13.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
}
generateGrammarSource {
maxHeapSize = "64m"
// -Werror: any ANTLR warning (e.g. 184, token shadowing) fails the build
arguments += ["-visitor", "-listener", "-Werror", "-package", "com.mpl.parser"]
outputDirectory = file("${project.buildDir}/generated-src/antlr/main/com/mpl/parser")
}
compileJava.dependsOn generateGrammarSource
sourceSets {
main {
antlr {
// The Gradle ANTLR plugin defaults to src/main/antlr; the grammar
// lives in src/main/antlr4 (Maven layout).
srcDirs = ['src/main/antlr4']
}
java {
srcDirs += "${project.buildDir}/generated-src/antlr/main"
}
}
}
test {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}
// ParseExamples lives in the test source set, so the task needs the test
// runtime classpath (with main.runtimeClasspath the class was never found).
task parseExamples(type: JavaExec, dependsOn: testClasses) {
mainClass = 'com.mpl.test.ParseExamples'
classpath = sourceSets.test.runtimeClasspath
args = ['examples']
}