Building

July 19, 2020 ยท View on GitHub

Building

We use gradle to build the compiler. It comes with a wrapper script (gradlew or gradlew.bat in the root of the repository) which downloads appropriate version of gradle automatically as long as you have JDK (version >= 11) installed.

Common Gradle Tasks

All gradle tasks are case-insensitive.

CommandDescription
./gradlew :cli:jarDepbuild a jar file which includes all the dependencies which can be found at cli/build/libs.
A short-hand version of this task is ./gradlew jarDep.
./gradlew :cli:copyJarDepbuild jarDep and copy it to the current directory.
A short-hand version of this task is ./gradlew copyJarDep.
./gradlew :api:assemblebuild Arend extension API jar which can be found at api/build/libs.
./gradlew testrun all tests.

On Windows, you may replace ./gradlew with gradlew.

To see the command line options of the application, run java -jar cli-[version]-full.jar --help after running the jarDep task.

Developing in IntelliJ IDEA

Here's an instruction on how to work with gradle projects in IntelliJ IDEA.

You may also need the following plugins:

  • Gradle and Groovy -- bundled plugins, needed for building the project
  • ANTLR v4 grammar for editing the parser
  • Protobuf for editing the serialized protobuf
  • Kotlin for editing the build scripts
  • Arend for editing Arend code

Project Structure

Arend is split into several subprojects:

SubprojectDescription
buildSrcbuilt before the project is built.
This subproject runs the ANTLR parser generator.
parserthe generated ANTLR parser (the generation is done in buildSrc)
protogenerated protobuf classes.
apiopen API for writing Arend extensions.
basethe Arend typechecker.
It depends on api, proto.
clithe CLI frontend of Arend with the ANTLR parser.
It depends on base, parser, api, proto.

The purpose of parser is to avoid introducing the dependency of the ANTLR generator to other subprojects which only requires the generated parser along with a small ANTLR runtime (since it's a dependency of buildSrc instead of parser).

The root project contains all the tests, and it depends on project cli. The tests are based on JUnit 4. If you want to move tests to a separate subproject, we wish you good luck.