KS compiler is written in Scala language and thus uses SBT for building. It can be compiled in one of 2 ways:

  • generating Java .class files, to be run in JVM

  • generating JavaScript .js file, to be run either inside a browser or in node.js environment

Building for JVM

We use sbt-native-packager to build deployable formats.

Building an universal (.zip) package

  1. sbt compilerJVM/universal:packageBin

  2. Get result in jvm/target/universal/kaitai-struct-compiler-*.zip

Building Debian package

  1. Install prerequisites: sudo -i apt-get install dpkg-deb dpkg-sig dpkg-genchanges lintian fakeroot

  2. sbt compilerJVM/debian:packageBin

  3. Get result in jvm/target/kaitai-struct-compiler_*_all.deb

Building Windows package

  1. Install WIX

  2. sbt compilerJVM/windows:packageBin

  3. Get result in jvm/target/windows/kaitai-struct-compiler.msi

  4. Rename to add version to kaitai-struct-compiler-$VERSION.msi

Building for JavaScript platform

Building to JavaScript platform is done using a Scala.js project. Note that it uses a somewhat different set of dependencies, as they must actually be JavaScript libraries, not Java jars.

  1. Run sbt fastOptJS

  2. Get result in js/target/scala-2.11/kaitai-struct-compiler-fastopt.js

  3. Use this JavaScript file on a website

Publishing a new version

  1. Choose a new version number (WIX imposes harsh requirements for version to look like x.x.x.x) and update it in build.sbt, version := …​, commit

  2. Prepare an entry in RELEASE_NOTES.md, commit

  3. Create version tag:

    • git tag $VERSION

    • git push --tags

  4. Update [main repository](https://github.com/kaitai-io/kaitai_struct)

  5. Create new version at:

  6. Upload:

  7. Publish them all




  • Pump version in setup.py, seek version=

  • python3 setup.py sdist upload

    • (use python3 setup.py sdist upload -r pypitest to publish to testing server)

  • Check that new version appears at https://pypi.python.org/pypi/kaitaistruct/$VERSION

  • git tag $VERSION

  • git push --tags


  • Pump version in lib/kaitai/struct/struct.rb, seek `VERSION = `

  • gem build kaitai-struct.gemspec

  • Test gem (i.e. by installing it to a live system)

  • gem push kaitai-struct-$VERSION.gem

  • git tag $VERSION

  • git push --tags

Adding new language

Don’t forget to update lists of languages: