Building Flix on Windows ↩
Source code of the Flix project is hosted on Github. Continuous integration relies on Gradle and runs on the runner image ubuntu-latest .
|
🔎 Generating the Flix library using Gradle is fast and simple ! We find a few examples of Gradle commands in the GitHub Actions file
build.yaml
, i.e.clean
,compileTestScala
andtest
.
Currently we can build/run/test the Flix library in three different ways :
Build tool | Build file | Environment(s) |
---|---|---|
cmd.exe |
build.bat |
MS Windows |
sh.exe |
build.sh |
Any a) |
gradle.exe |
build.gradle |
Any |
☛ Unlike other Flix contributors who work exclusively with
build.gradle
we also run our own batch/bash scripts which give us more control over the build process i.e. when dealing with misbehaviors and potential bugs.
Command build.bat run
generates the fat jar file build\libs\flix.jar
and executes it with argument --version
:
> build -verbose run Compile 1 Java source file to directory "build\classes" Compile 253 Scala source files to directory "build\classes" Create Java archive "build\libs\flix.jar" Update archive "build\libs\flix.jar" (Flix sources) Update archive "build\libs\flix.jar" ("C:\opt\scala-2.13.5\lib\scala-library.jar") Update archive "build\libs\flix.jar" ("C:\opt\scala-2.13.5\lib\scala-reflect.jar") Update archive "build\libs\flix.jar" ("lib\org.java_websocket-1.3.9.jar") Update archive "build\libs\flix.jar" ("lib\org.jline-3.5.1.jar") Update archive "build\libs\flix.jar" ("lib\org.json4s-ast-3.5.5.jar") Update archive "build\libs\flix.jar" ("lib\org.json4s-core-3.5.5.jar") Update archive "build\libs\flix.jar" ("lib\org.json4s-native-3.5.5.jar") Update archive "build\libs\flix.jar" ("lib\org.objectweb.asm-9.2.jar") Update archive "build\libs\flix.jar" ("lib\org.parboiled-2.2.1.jar") Update archive "build\libs\flix.jar" ("lib\org.scalactic-3.0.8.jar") Update archive "build\libs\flix.jar" ("lib\org.scalatest-3.0.8.jar") Update archive "build\libs\flix.jar" ("lib\scala.collection.parallel-0.2.0.jar") Update archive "build\libs\flix.jar" ("lib\scala.xml-1.2.0.jar") Update archive "build\libs\flix.jar" ("lib\scopt_2.13-4.0.1.jar") Update archive "build\libs\flix.jar" ("lib\shapeless-2.3.3.jar") Add manifest to archive "build\libs\flix.jar" Execute program file "build\libs\flix.jar" with arguments --version The Flix Programming Language v0.38.0
Command gradle.bat test
runs the test suite (e.g. after updating some source files of our local copy of the Flix Github repository) :
> gradle test --console=plain > Task :clean > Task :compileJava NO-SOURCE > Task :compileScala > Task :processResources NO-SOURCE > Task :classes > Task :compileTestJava NO-SOURCE > Task :compileTestScala > Task :testAll Run starting. Expected test count is: 1267 [...(more details in footnote 1)...] Run completed in 6 minutes, 40 seconds. Total number of tests run: 1267 Suites: completed 34, aborted 0 Tests: succeeded 1267, failed 0, canceled 0, ignored 0, pending 0 All tests passed. > Task :test BUILD SUCCESSFUL in 6m 44s 4 actionable tasks: 2 executed, 2 up-to-date
Command gradle jar
2 generates the Flix Java archive :
> gradle jar BUILD SUCCESSFUL in 3m 7s 2 actionable tasks: 2 executed > where /r . flix*.jar F:\flix\build\libs\flix.jar
🔎 The Flix library generated locally on July 23th 2023, is indeed the same as the corresponding Flix nightly build :
> where /t "%FLIX_HOME%:*.jar" 41028097 4/2/2023 1:03:28 PM C:\opt\flix-0.38.0\flix-2023-07-23.jar 41028263 4/2/2023 5:00:55 PM C:\opt\flix-0.38.0\flix.jar
Footnotes ▴
[1] Console output of command gradle test
↩
-
We observe the extensive code coverage ot the Flix test suite :
> Task :compileJava NO-SOURCE > Task :compileScala UP-TO-DATE > Task :processResources NO-SOURCE > Task :classes UP-TO-DATE > Task :compileTestJava NO-SOURCE > Task :compileTestScala UP-TO-DATE > Task :processTestResources NO-SOURCE > Task :testClasses UP-TO-DATE > Task :testAll Run starting. Expected test count is: 1267 CompilerSuite: - Test.Currying.flix - Test.Dec.Class.flix [...(176 more tests)...] ExperimentalSuite: ExampleSuite: - algebraic-data-types-and-pattern-matching.flix - an-interpreter-for-a-trivial-expression-language.flix [...(56 more tests)...] TestEntryPoint: - Test.IllegalEntryPointArg.Main.01 - Test.IllegalEntryPointArg.Main.02 [...(14 more tests)...] TestInstances: - Test.OverlappingInstance.01 - Test.OverlappingInstance.02 [...(41 more tests)...] TestKinder: - MismatchedTypeParamKind.Implicit.01 - MismatchedTypeParamKind.Implicit.02 [...] TestNamer: - AmbiguousVarOrUse.01 - AmbiguousVarOrUse.02 [...] TestParser: - ParseError.Int.01 - ParseError.Int.02 [...] TestPatExhaustiveness: - Pattern.Literal.Char.01 - Pattern.Literal.Int32.01 [...] TestRedundancy: - HiddenVarSym.Let.01 - HiddenVarSym.Lambda.01 [...] TestRegions: - RegionVarEscapes.01 - RegionVarEscapes.02 TestResolver: - AmbiguousTag.01 - AmbiguousTag.02 [...] TestSafety: - NonPositivelyBoundVariable.01 - NonPositivelyBoundVariable.02 [...] TestStratifier: - Stratification.01 - Stratification.02 [...] TestTyper: - TestLeq01 - TestLeq02 [...] TestWeeder: - DuplicateAnnotation.01 - DuplicateFormal.01 [...] TestBoolFormulaTable: - Minimize.True.01 - Minimize.True.02 [...] TestIncremental: - Incremental.01 - Incremental.02 [...] TestSetUnification: - Test.SetUnification.01 - Test.SetUnification.02 [...] TestUnification: - Substitution.Empty.01 - Substitution.Empty.02 [...(53 more tests)] TestFlixErrors: - HoleError.01 - HoleError.02 TestFormatType: - FormatType.Type.Record.External.01 - FormatType.Record.External.02 [...(43 more tests)] LibrarySuite: - TestApplicative.flix - TestArray.flix [...(59 more tests)] TestPackager: - init - check [...(10 more tests)] TestGraph: - topSort.Cycle.01 - topSort.Cycle.02 [...(5 more tests)] TestResult: - get01 - get02 [...(13 more tests)] TestValidation: - map01 - map02 [...(13 more tests)] TestMain: - init - build [...(27 more tests]] TestTutorials: - interpreter.flix - introduction.flix - lambda-calculus.flix Run completed in 6 minutes, 40 seconds. Total number of tests run: 1267 Suites: completed 34, aborted 0 Tests: succeeded 1267, failed 0, canceled 0, ignored 0, pending 0 All tests passed. > Task :test BUILD SUCCESSFUL in 6m 44s 4 actionable tasks: 2 executed, 2 up-to-date
[2] Gradle compileClasspath
↩
-
We can add a Gradle task "
debug
" to the filebuild.gradle
to display the compile classpath :// Adapted from // https://discuss.gradle.org/t/gradle-cannot-infer-scala-class-path-despite-the-scala-library-being-declared-as-a-compile-dependency/7388/5 task debug { println configurations.compileClasspath.findAll { it.name.endsWith(".jar") } }
> gradle debug > Configure project : [F:\flix\lib\org.java_websocket-1.3.9.jar, F:\flix\lib\org.jline-3.5.1.jar, F:\flix\lib\org.json4s-ast-3.5.5.jar, F:\flix\lib\org.json4s-core-3.5.5.jar, F:\flix\lib\org.json4s-native-3.5.5.jar, F:\flix\lib\org.objectweb.asm-9.2.jar, F:\flix\lib\org.parboiled-2.2.1.jar, F:\flix\lib\org.scalactic-3.0.8.jar, F:\flix\lib\org.scalatest-3.0.8.jar, F:\flix\lib\scala.collection.parallel-0.2.0.jar, F:\flix\lib\scala.xml-1.2.0.jar, F:\flix\lib\scopt_2.13-4.0.1.jar, F:\flix\lib\shapeless-2.3.3.jar, %USERPROFILE%\.gradle\caches\modules-2\files-2.1\org.scala-lang\scala-reflect\2.13.5\8dee4d8c5374920f2db2f5f55d9dd6ecd4194cc\scala-reflect-2.13.5.jar, %USERPROFILE%\.gradle\caches\modules-2\files-2.1\org.scala-lang\scala-library\2.13.5\d0df6e78b6ccb0102cb0395bfa8cb806e9e81b61\scala-library-2.13.5.jar] BUILD SUCCESSFUL in 2s