Skip to content

Instantly share code, notes, and snippets.

@KengoTODA
Last active December 16, 2021 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KengoTODA/3598bcd784d2904948fc38e40fef637e to your computer and use it in GitHub Desktop.
Save KengoTODA/3598bcd784d2904948fc38e40fef637e to your computer and use it in GitHub Desktop.
Flix build system

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:

  1. Is it encouraged to deploy .fpkg files onto Maven Central or other registries?

  2. 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, and system 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.

Current idea

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?

References

  1. "The package manager does not yet support dependency resolution" according to Build and Package Management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment