#java #toolchain #sdkman #binary-file #filesize #jbang

bin+lib wukong

Wukong is a command-line toolchain for Java with Rust

8 releases

new 0.2.6 Dec 3, 2024
0.2.5 Nov 11, 2024
0.2.4 Oct 29, 2024
0.2.0 Sep 25, 2024
0.1.3 Sep 19, 2024

#927 in Command line utilities

Download history 73/week @ 2024-09-07 161/week @ 2024-09-14 201/week @ 2024-09-21 62/week @ 2024-09-28 164/week @ 2024-10-05 180/week @ 2024-10-12 15/week @ 2024-10-19 120/week @ 2024-10-26 8/week @ 2024-11-02 114/week @ 2024-11-09 15/week @ 2024-11-16 2/week @ 2024-11-23 153/week @ 2024-11-30

285 downloads per month

Apache-2.0

280KB
7K SLoC

Rust 4.5K SLoC // 0.0% comments Shell 2K SLoC // 0.1% comments Just 64 SLoC // 0.3% comments Java 37 SLoC // 0.1% comments Zsh 14 SLoC BASH 13 SLoC Kotlin 3 SLoC // 0.4% comments Groovy 1 SLoC // 0.7% comments

Wukong - Java Toolchain with Rust

Wukong is a Java toolchain written with Rust.

Why write Java toolchain with Rust?

  • startup time matter: Rust is fast, and Java takes ages to start.
  • No environment dependencies: No need to install JDK, Maven, Gradle, etc.
  • Binary file size matter: small size, easy to distribute. GraalVM native-image is not small enough.

Get started

  • Install: cargo binstall wukong. Please run cargo install cargo-binstall first.
  • JBang-rs: ~/.cargo/bin/jbang --help
  • SDKMAN-rs: ~/.cargo/bin/sdk --help
  • jenv-rs: ~/.cargo/bin/jenv --help
  • Maven Toolchains: ~/.cargo/bin/mt --help
  • Maven Repository Search: ~/.cargo/bin/mcs --help

Java Toolchains

SDKMAN-rs

Please add eval $(~/.cargo/bin/sdk init) to your shell profile.

enhancements

  • CI friendly: sdk install -y java for auto-install
  • Silent mode: sdk -q install java
  • Major version support(Temurin by default): sdk install java 17, sdk use java 17

Difference

  • use version: eval $(sdk use java 17)

Maven Toolchains CLI

  • jdks: list all installed JDKs
  • vendors: list all vendors and available JDK versions.
  • list: list JDKs from ~/.m2/toolchains.xml
  • add: add JDK into ~/.m2/toolchains.xml
  • remove: remove JDK from ~/.m2/toolchains.xml

Add JDK

  • list all vendors and jdk versions: mt vendors
  • mt add 21: add JDK 21 from $HOME/.jbang/cache/jdks/21
  • mt add 17.0.4-tem: add JDK from $HOME/.sdk/candidates/java/17.0.4-tem
  • mt add /path/to/java-home: add JDK from /path/to/java-home

direnv integration

Integration with direnv by sdk direnv init:

  • Java Home: .java-version, .sdkmanrc
  • Aut candidate home and path for SDKMAN: .sdkmanrc

References

  • SDKMAN CLI: SDKMAN CLI Native with Rust
  • OneIO: all-in-one convenient IO library for Rust
  • startup-time: Measure startup time of different programming languages

Dependencies

~24–40MB
~700K SLoC