Scripts

June 17, 2026 · View on GitHub

Repository-level build, test, and developer scripts. Module-specific scripts (samples, aot-tester) remain next to their projects.

All build and intermediate outputs go under out/ at the repository root (override with LEANCLR_OUT_ROOT). Source trees under src/ stay clean.

out/
├── cmake/<module>/<Config>-<Arch>/   # CMake build trees & native binaries
└── dotnet/<ProjectName>/<Config>/    # .NET assemblies (see Directory.Build.props)

Clean all outputs: scripts\dev\clean-out.bat (Windows) or ./scripts/dev/clean-out.sh (Unix).

Quick start

TaskLinux / macOSWindows
Build & run all tests./scripts/ci.sh Releasescripts\test\build-all.bat Release then scripts\test\run.bat Release
Build tests only./scripts/build.sh test build Releasescripts\build.bat test build Release
Run tests./scripts/build.sh test run Releasescripts\build.bat test run Release
Build runtime./scripts/build.sh runtime Releasescripts\build.bat runtime Release
Build LeanAOT./scripts/build.sh leanaot [Debug|Release]scripts\build.bat leanaot Debug or Release
Build aot-tester./scripts/build.sh aot-tester [Config] [Arch]scripts\build.bat aot-tester [Config] [Arch]
Generate aot-tester C++./scripts/build.sh aot-tester gen-cppscripts\build.bat aot-tester gen-cpp
Generate aot-tester C++ (posix)./scripts/build.sh aot-tester gen-cpp-posixscripts\build.bat aot-tester gen-cpp-posix
Run aot-tester./scripts/build.sh aot-tester run [Config] [Arch]scripts\build.bat aot-tester run [Config] [Arch]
Build aot-tester (wasm)./scripts/build.sh aot-tester build-wasm [Config]scripts\build.bat aot-tester build-wasm [Config]
Format runtime C++scripts\dev\format-cpp-files.bat
Clean outputs./scripts/dev/clean-out.shscripts\dev\clean-out.bat

Legacy paths under src/tests/ forward to scripts/test/ for compatibility.

Layout

scripts/
├── build.sh / build.bat     # Orchestration entry point
├── ci.sh                    # CI: build + run tests (Linux)
├── test/                    # Unit test build & run
├── runtime/                 # leanclr runtime library (CMake)
├── leanaot/                 # LeanAOT tooling (aot-tester build, …)
├── generator/               # Opcode / icall code generation
├── dev/                     # clean-out, format-cpp-files
└── lib/                     # repo-root, out-dir-init, cmake-dir

Script index

ScriptDescription
ci.shCI entry: test/build-all + test/run
test/build-all.*Build C++ runner + managed test DLLs → stage to runner dlls/
test/basic-tester/build.*Build C++ test runner executable
test/run.*Run out/cmake/tests/basic-tester/<Config>-<Arch>/bin/.../test
runtime/build.*Build leanclrout/cmake/runtime/<Config>-<Arch>/ (Windows: optional sln, shared)
test/aot-tester/build.*Build native aot-tester executable
test/aot-tester/gen_cpp.*Run LeanAOT to generate C++ under src/tests/aot-tester/cpp/
test/aot-tester/gen_cpp_posix.*Generate C++ under src/tests/aot-tester/cpp-posix/ using POSIX BCL (dotnetframework4.x-linux)
test/aot-tester/run.*Build and run aot-tester with AotTests assembly
test/aot-tester/build-wasm.*Build aot-tester with Emscripten → out/cmake/tests/aot-tester/<Config>-wasm/
leanaot/build.*Build LeanAOT → out/dotnet/LeanAOT/<Config>/net8.0/
publish_leanaot.batdotnet publish Release → ../leanclr-unity/LeanCLR~/leanaot/ (sibling repo)
publish_pgo2aot.batdotnet publish Release → ../leanclr4unity/LeanCLR~/pgo2aot/ (sibling repo)
publish_runtime.batMirror src/runtime../leanclr-unity/LeanCLR~/runtime/ (excludes scripts, CMakeLists.txt, 3rd/zlib)
publish_csharp.batSync Profile.cs../leanclr4unity/Runtime/; mirror src/tools/pgo2aot (except Program.cs) → ../leanclr4unity/Runtime/Pgo2Aot/
generator/gen_*.batRegenerate opcode headers and icall JSON
dev/format-cpp-files.batclang-format src/runtime sources
dev/clean-out.*Remove entire out/ directory

Co-located scripts

These invoke CMake/dotnet but write outputs only under out/:

  • src/runtime/build.* — forward to scripts/runtime/
  • src/samples/*/build.* — platform samples
  • src/tests/basic-tester/build.* — forward to scripts/test/basic-tester/
  • src/tools/leanrun/build.* — leanrun tool