How it is built
The repository is one Gradle build, in Kotlin Multiplatform.
| Folder | |
|---|---|
language/ | The DSL: lexer, parser, highlighting, checks, completion, outline and folding, and a script as calls, arguments and values, which is what the libraries give. Common Kotlin without dependencies. |
server/ | The language server protocol and the reading of schemas, also in common Kotlin (kotlinx.serialization for the JSON), and per platform a small main that connects it to stdin and stdout, and the reading of a file. |
java/ | The Java library: language/ as one jar for Maven Central, and its tests, in Java. |
npm/ | The npm package: language/ compiled to JavaScript, with the package.json, the types and the tests. |
playground/ | What the playground of the site runs in the browser: the language server of server/, compiled to JavaScript. |
editors/ | The VS Code extension, the IntelliJ plugin, and the grammar and language configuration of the Orca plugin. |
orca-plugin.json | The Orca plugin. Orca wants it at the root of the repository. |
artwork/ | The logo and the wordmark, in the black and yellow of Flock. |
samples/ | example.dsl: the architecture rules of flock-workday, a DSL that the tests also use, and its schema in .dsl/example.json. |
site/ | This site. |
tools/ | lsp-smoke-test.mjs: talks to any build of the server the way an editor does. |
The server
The server does not use lsp4j or any other JVM library, so the same code runs on every target:
| Target | Gradle task | Output |
|---|---|---|
| JVM (Java 17+) | ./gradlew :server:jvmFatJar | server/build/libs/dsl-lsp.jar |
| Node.js | ./gradlew :server:vscodeServer | editors/vscode/server/dsl-lsp.js |
| Linux x64 | ./gradlew :server:linkReleaseExecutableLinuxX64 | server/build/bin/linuxX64/releaseExecutable/dsl-lsp.kexe |
| Linux arm64 | ./gradlew :server:linkReleaseExecutableLinuxArm64 | server/build/bin/linuxArm64/releaseExecutable/dsl-lsp.kexe |
| Windows x64 | ./gradlew :server:linkReleaseExecutableMingwX64 | server/build/bin/mingwX64/releaseExecutable/dsl-lsp.exe |
| macOS arm64 | ./gradlew :server:linkReleaseExecutableMacosArm64 (on a Mac) | server/build/bin/macosArm64/releaseExecutable/dsl-lsp.kexe |
All of them speak the protocol over stdin and stdout, and are the files of a release under another name.
./gradlew build builds and tests everything this machine can build (Kotlin/Native builds the macOS executable on a
Mac only). That includes the IntelliJ plugin, for which Gradle downloads an IntelliJ IDEA of about 1.7 GB;
./gradlew build -x :intellij:build leaves it out.
The libraries
The libraries are built from the same code:
| Library | Gradle task | Output |
|---|---|---|
| Java | ./gradlew :java:jar | java/build/libs/dsl-lang-0.0.0-SNAPSHOT.jar |
| npm | ./gradlew :npm:npmPackage | npm/dist/dsl-lang.js, which completes the package in npm |
./gradlew :java:publishToMavenLocal puts the Java library in ~/.m2, and npm pack ./npm makes the package
of the npm package, to try either in an application before it is released.
The editors
VS Code and IntelliJ IDEA each tell how to build the extension or the plugin and try it without installing it.