Flix can be built and run from within the IntelliJ IDEA IDE which is useful for working on the compiler and the standard library.
- Clone the Flix GitHub repository.
- Create a fresh project on top of the cloned directory. Choose Scala project and then "IDEA-based". (Do NOT accept "import as Gradle project")
- Ensure that
main/srcis marked as a source directory (right-click -> Mark Dircetory as -> Sources Root). - Ensure that
main/testis marked as a test directory (right-click -> Mark Dircetory as -> Test Sources Root). - Ensure that every jar in
libis added as a library (right-click, "Add as library ...")
Open Main.scala, right-click on def main and select Run 'Main'. This runs the Flix REPL.
To compile and run a Flix file with a main function, right-click on the main function in Main.scala and choose "Modify Run Configuration".
Here enter the file name in the "Program arguments" field.
Flix can also be built with Gradle, but the main developers prefer to build with IntelliJ IDEA.
The Gradle build is used for continuous integration on GitHub.
If you get a java.lang.OutOfMemoryError: Java heap space error, find the setting to increase the heap size. For IDEA projects, this is under Settings -> Build, Execution, Deployment -> Compiler. Directly on "Compiler" there is a field "Shared build processes heap" and under Scala Compiler -> Scala Compiler there is "Maximum heap size". Try out which one you need to increase. 4GB should be enough in each case.