Skip to content

Developing ClojureCLR

dmiller edited this page Dec 11, 2014 · 7 revisions

For development work, you will need:

  • .Net 4.0
  • Optional: Visual Studio 2010 or 2012 (Express edition not supported)
  • NuGet installed in VS for package management

You can check out the repo from the ClojureCLR Github site -- https://github.com/clojure/clojure-clr -- or, better yet, fork the project and go from there.

Tips

  • Build products are placed in the bin\ subdirectory. We support Debug and Release builds for .NET 3.5 and 4.0.
  • Make Clojure.Main your startup project.
  • If you want to run the compiler (Clojure.Compile) under the debugger, find the post-compile step on the Clojure.Compile project and copy the list of files there to the command-line args for debugging if you want to debug compiling the core .clj files.
  • The Clojure compiler looks for the Clojure libraries in either a) the current directory, b) the GAC, or c) another directory specified by the environment variable CLOJURE_LOAD_PATH. If your libraries aren't in one of these three places, it will balk.

Building

If you are using Visual Studio, you should be able to figure this out.

It is also possible to build from the command-line. This likely will be necessary if you are developing under Mono.

MSBuild.exe build.proj /target:XXX /p:Configuration="Debug 3.5" /p:Platform="Any CPU"

If you are compiling under Mono, use

xbuild build.proj /target:XXX /p:Configuration="Debug 3.5" /p:Platform="Any CPU" /p:Runtime="Mono"

The value for /p:Configuration can be any of

  • “Debug 3.5”
  • “Release 3.5”
  • “Debug 4.0”
  • “Release 4.0”

The value for /targetcan be any of

  • Build — just build the designated configuration
  • Test — build and run the clojure test suite. This includes compiling various genclass and protocols needed for the testing. Does not do generative tests.
  • TestGen — Same as Test except it runs the generative tests.
  • Dist — build and copy to the dist\ folder the necessary files to run ClojureCLR (not including the test_clojure files)
  • ILMerge — build an ILMerge'd DLL for distribution

Signing

To sign Clojure.dll, set the environment variable CLOJURE_SNK to the location of your .SNK file.

Testing

Most of the tests that ship with Clojure(JVM) run. Those that don’t make sense on ClojureCLR have been edited out.

There are two ways to run the Clojure test suite, by hand and by command.

By hand

  1. Get a REPL by starting Clojure.Main.
  2. Execute (load "clojure/run_tests_i") and stand back.
  3. When the tests complete, you will be left at the REPL prompt.

By command

  1. Bring up a Visual Studio Command Prompt Window.
  2. Change directory to the root directory for the ClojureCLR solution.
  3. Use MSBuild or xbuild with the target test, using the command-line parameters described above.
Clone this wiki locally