exa/Justfile
Benjamin Sago 5ca3548bb1 Inline the library into the binary
This commit removes the library portion of exa. Cargo now only builds a binary.

The original intent was for exa to have its own internal library, and have the binary just call the library. This is usually done for code cleanliness reasons: it separates the code that implements the purpose of the program (the "plumbing") from the code that the user interacts with (the "porcelain"), ensuring a well-defined interface between the two.

However, in exa, this split was in completely the wrong place. Logging was handled in the binary, but option parsing was handled in the library. The library could theoretically print to any Writer ("for testing", it said), but it's far easier to run integration tests by executing the binary than to change the code to handle unit tests, so this abstraction isn't gaining us anything.

I've also had several people ask me if exa should be packaged for Linux distributions as a library, or just a binary. Clearly, this is confusing!

In several of my other Rust projects, I've done this better, with the command-line option parsing and log printing done on the binary side. It also turns out that you don't need to have a [lib] section in the Cargo.toml, so that's gone too.
2020-10-10 01:43:42 +01:00

35 lines
704 B
Makefile

all: build test
all-release: build-release test-release
# compiles the exa binary
@build:
cargo build
# compiles the exa binary (in release mode)
@build-release:
cargo build --release --verbose
# compiles the exa binary with every combination of feature flags
build-features:
cargo hack build --feature-powerset
# runs unit tests
@test:
cargo test --all -- --quiet
# runs unit tests (in release mode)
@test-release:
cargo test --release --all --verbose
# runs unit tests with every combination of feature flags
test-features:
cargo hack test --feature-powerset -- --quiet
# prints versions of the necessary build tools
@versions:
rustc --version
cargo --version