An experimental Gradle plugin to build Flix language projects.
To integrate Flix into a Gradle project with other languages, apply the convention plugin jp.skypencil.flix
:
plugins {
`application`
id("jp.skypencil.flix") version "1.1.2"
}
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
configure<FlixExtension> {
sourceSets {
main {
setSrcDirs(["src/main/flix"])
}
test {
setSrcDirs(["src/test/flix"])
}
}
}
Unlike common Flix projects, you need to locate files as follows:
- Source files should be stored under the
src/main/flix
directory. - Test files should be stored under the
src/test/flix
directory.
To build a Flix project created by flix init
command, apply the base plugin jp.skypencil.flix-base
and create necessary tasks individually:
import jp.skypencil.flix.FlixCompile
import jp.skypencil.flix.FlixTest
plugins {
id("jp.skypencil.flix-base") version "1.1.2"
}
val compileFlix = tasks.register<FlixCompile>("compileFlix") {
source = fileTree("src")
destinationDirectory.set(file("build/classes/flix/main"))
}
val testFlix = tasks.register<FlixTest>("testFlix") {
source = fileTree("test")
destinationDirectory.set(file("build/classes/flix/test"))
report.set(file("build/reports/flix/main.txt"))
}
tasks.named<Task>("assemble") { dependsOn(compileFlix) }
tasks.named<Task>("check") { dependsOn(testFlix) }
- No support for resource files such as
src/main/resources
andsrc/test/resources
. - Test reports generated at
build/reports/flix/main.txt
is quite simple.
- integrate with
application
plugin - add
testFlix
task - add a task to make a
.fpkg
file - support the Gradle Java toolchain
- use Gradle worker API to introduce the classloader level separation
- support dependency management (based on an investigation)
- create a JUnit XML file based on test result
Copyright © 2021-2022 Kengo TODA