Skip to content

Developing ClojureCLR

David Miller edited this page Aug 27, 2024 · 7 revisions

Developing ClojureCLR

For development work, you will need the .NET SDK of your choice and whatever C# development tools make you happy.

The repo is at https://github.com/clojure/clojure-clr.

We'll assume you can get the code up in your development environment of choice. Building should be straightforward.

Project layout

Clojure/Clojure.sln points to the various projects that make up ClojureCLR, all located in the Clojure subdirectory.

  • Clojure -- contains the data structures, compiler, runtime support that make up the backbone of the project.
  • Clojure.Source -- contains Clojure source such as core.clj that provide the rest of the Clojure environment.
  • Clojure.Main -- REPL for .NET 6.0, and .NET 8.0
  • Clojure.Main461 -- REPL targeting .NET Framework 4.6.1.
  • Clojure.Compile -- program that compiles Clojure source files specified on the command line. Framework 4.6.1 only.
  • Clojure.Tests -- contains the Clojure source for tests of the Clojure environment
  • Csharp.Tests -- NUnit tests for some of the basic data structures and runtime support.

Tasks

You can build the solution and run the NUnit tests by any method you like. Running the Clojure tests and performing other tasks is best done via MSBuild. Your working directory should be /Clojure.

MSBuild.exe build.proj -t:<Task> <arguments>

The tasks you should know about:

  • -t:Build
  • -t:Rebuild
  • -t:DeepClean # gets rid of the artifacts that even
  • -t:Test -p:TestTargetFramework=X # where X is one of net462, net6.0, or net8.0 (default) -- runs most of the Clojure tests
  • -t:TestGen -p:TestTargetFramework=X # where X is one of net462, net6.0, or net8.0 (default) -- runs the Clojure 'generative' tests

On any of these, you can specify

-p:Configuration=Debug
-p:Configuration=Release

Debug is the default.

The value for -p:DirectLinking can be either "true" or "false". This controls whether direct (static) linking is used in the build.

See docs/Preparing-a-release.md if you want to learn about building Nuget packages or zipfiles for distribution.