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

bin+lib wukong

Wukong is a command-line toolchain for Java with Rust

7 releases

0.2.5 Nov 11, 2024
0.2.4 Oct 29, 2024
0.2.0 Sep 25, 2024
0.1.3 Sep 19, 2024

#865 in Command line utilities

Download history 80/week @ 2024-09-09 183/week @ 2024-09-16 184/week @ 2024-09-23 54/week @ 2024-09-30 170/week @ 2024-10-07 181/week @ 2024-10-14 4/week @ 2024-10-21 128/week @ 2024-10-28 124/week @ 2024-11-11

262 downloads per month

Apache-2.0

270KB
7K SLoC

Rust 4.5K SLoC // 0.0% comments Shell 2K SLoC // 0.1% comments Just 60 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 --version
  • SDKMAN-rs: ~/.cargo/bin/sdk --version
  • jenv-rs: ~/.cargo/bin/jenv --version
  • Maven Toolchains: ~/.cargo/bin/mt --version

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

~22–40MB
~667K SLoC