To integrate the Flix language into existing JVM language projects, I want to try to make a Gradle plugin to build, test, and package source codes written in Flix. To judge its possibility, and design its API, I want to ask the following questions:
-
Is it encouraged to deploy
.fpkg
files onto Maven Central or other registries?- I guess it is not. The latest
Packager
provides an installation mechanism which relies on GitHub project. - Probably the Flix is going to provide a golang-like module system? If so, is there any file to manage dependencies like
go.mod
?
- I guess it is not. The latest
-
Will Flix build system supports multiple kinds of dependnecy scope?
- Java build tools such as Maven and Gradle provides
compile
,runtime
,provided
,api
,implementation
,test
, andsystem
etc. - It is complex but valuable to minimize API surface and to stop depending on test harness (e.g. JUnit, JMockit) in production code.
- For me, it seems that Flix is not considering the scope separation for now.
- Java build tools such as Maven and Gradle provides
If my hypothesis is correct, design for Gradle plugin will be like below:
plugins {
id("jp.skypencil.flix")
}
configure<FlixExtension> {
compilerVersion.set("0.25.0")
sourceSets {
main {
flix {
setSrcDirs(listOf("src/main/flix"))
}
}
test {
flix {
setSrcDirs(listOf("src/test/flix"))
}
}
}
// Do not use Gradle built-in dependency management, because we do not rely on registries like Maven Central.
dependencies {
require("owner/repo@v1.2.3") // or "owner:repo:v1.2.3" like Maven?
require(files("lib/*.fpkg")) // for migration
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of("17"))
}
}
defaultTasks("compileFlix", "testFlix", "jar", "fpkg")
// todo: Does `src/main/java` depends on `src/main/flix`, or opposite?
- "The package manager does not yet support dependency resolution" according to Build and Package Management