Skip to content

Choose a tag to compare

@tisonkun tisonkun released this 24 Mar 01:48
· 115 commits to main since this release
v5.0.0
7546d07

Full Changelog: v4.0.5...v5.0.0

Rewrite it in Rust, to fully get rid of the Native Image x Docker Image shit.

So all the JVM related distributions have gone now. Namely the alpha Maven plugin, alpha Gradle plugin, and executable JAR. I suppose that fewer people use these distributions and they can still get it from <=v4.

Docker images are not affected. You can still use:

docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v5 format

But now the hawkeye-native image is the same as hawkeye (~28MB).

In addition, you can now install hawkeye via Cargo:

cargo install hawkeye

All the underneath functionality should be the same, except those related to JVM classpath is not a thing now.

It's still possible we distribute this native tool as a Maven plugin / Gradle plugin. Just as Docker written in Golang has the related plugin. But the approach would be quite different and the platform-toolchain classifier is still absent in the Java world, making a challenge to bridge Rust and Java. os-detector may help, but an expose from JVM's reflection would be desired (Not object reflection, I mean, JVM provides APIs to describe itself, including platform, toolchain, and other build/platform info).

Back to HawkEye.

You can use HawkEye in GitHub Actions or in your local machine. HawkEye provides three basic commands:

# check license headers
hawkeye check

# format license headers (auto-fix all files that failed the check)
hawkeye format

# remove license headers
hawkeye remove

You can use -h or --help to list out all config options.

GitHub Actions

The HawkEye GitHub Action enables users to run license header check by HawkEye with a config file.

First of all, add a licenserc.toml file in the root of your project. The simplest config for projects licensed under Apache License 2.0 is as below:

Note The full configurations can be found in the configuration section.

headerPath = "Apache-2.0.txt"

[properties]
inceptionYear = 2023
copyrightOwner = "tison <[email protected]>"

You should change the copyright line according to your information.

To check license headers in GitHub Actions, add a step in your GitHub workflow:

- name: Check License Header
  uses: korandoru/hawkeye@v5

Cargo Install

The hawkeye executable can be installed by:

cargo install hawkeye

Docker

Alpine image (~27MB):

docker run -it --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye check

I'm somewhat rushing in this rewrite so there is still a lot of rooms to improve the experience, performance, and code style. But I'm confident that the most frequent user journey is held and works well.

Enjoy :D