Building
What you need
Section titled “What you need”- Rust, installed with rustup, using the GNU toolchain (
stable-x86_64-pc-windows-gnu). Visual Studio is not needed. - Python 3 with Pillow, only for the icon scripts and the fuzz test.
%USERPROFILE%\.cargo\bin must be on your PATH. A new terminal picks this up after Rust is installed.
The steps
Section titled “The steps”From a terminal in G:\KarakStudio:
cargo build --releasecopy /y target\release\KarakStudio.exe "dist\Karak Studio.exe"python set_icon.py "dist\Karak Studio.exe"build.bat does the same three things.
The icon step must be repeated after every build, because a fresh build has no icon inside the file. The app must be closed while its exe is replaced.
Things that will break the build
Section titled “Things that will break the build”- Do not run
cargo updatewithout a package name.Cargo.lockpinslibloading 0.8.5,parking_lot 0.12.3,parking_lot_core 0.9.10,arboard 3.4.1andwebbrowser 1.0.1. Newer versions of these need a tool (dlltooltogether with an assembler) that this toolchain does not fully provide. .cargo\config.tomlcontains absolute paths: to the toolchain’s bundleddlltool.exe, and toG:/KarakStudio/linklibs. If the project moves, or Rust is installed for a different user, edit them.linklibs\shlwapi.dllis a copy of the Windows file. The linker reads it to learn the names of its functions. The finished app uses the real one in Windows.
Rebuilding the practice programs
Section titled “Rebuilding the practice programs”cd practicecargo build --releasecopy /y target\release\*.exe ..\src\practice\Then rebuild the main app. The practice project uses no standard library, starts at its own start function, and is optimised for size so that loops stay simple to read. core::hint::black_box is used in a few places to stop the compiler from working answers out in advance; without it the lessons disappear from the compiled code.
After changing a practice program, check that its hints and solution in src\practice.rs still describe what the compiler produced. Open the new exe in the app and read the check function.
Changing the icon
Section titled “Changing the icon”python make_icon.py sheet icon-options.png draws all options on one sheetpython make_icon.py pick D writes src\icon.rgba and icon.icoThen rebuild and run set_icon.py.