Merge pull request #9 from ipetkov/install-by-default

`cargoClippy` and `cargoTarpaulin`: change behavior to install cargo artifacts by default
This commit is contained in:
Ivan Petkov 2022-02-13 17:52:39 +00:00 committed by GitHub
commit 9ea3e03efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 9 deletions

View File

@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## Unreleased
* `cargoClippy` and `cargoTarpaulin` will install cargo artifacts by default (or
install an empty `target` directory if there are none). This allows for more
easily chaining derivations if doing so is desired.
- This can be disabled by setting `doInstallCargoArtifacts = false;` in the
derivation
## [0.3.0] - 2022-02-11
### Added

View File

@ -19,6 +19,15 @@ onlyDrvs (lib.makeScope myLib.newScope (self:
src = ./simple;
};
# https://github.com/ipetkov/crane/issues/6
cargoClippyThenBuild = myLib.buildPackage {
src = ./simple;
cargoArtifacts = myLib.cargoClippy {
cargoArtifacts = null;
src = ./simple;
};
};
# https://github.com/ipetkov/crane/issues/6
cargoFmtThenClippy = myLib.cargoClippy {
src = ./simple;

View File

@ -255,9 +255,6 @@ Except where noted below, all derivation attributes are delegated to
* `cargoExtraArgs`: additional flags to be passed in the cargo invocation (e.g.
enabling specific features)
- Default value: `""`
* `doInstallCargoArtifacts`: controls whether cargo's `target` directory should
be copied as an output
- Default value: `false`
#### Native build dependencies
The `clippy` package is automatically appended as a native build input to any

View File

@ -20,9 +20,4 @@ cargoBuild (args // {
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ clippy ];
doCheck = false; # We don't need to run tests to benefit from `cargo check`
# The existence of the build completing without error is enough to ensure
# the checks have passed, so we do not strictly need to install the cargo artifacts.
# However, we allow the caller to retain them if needed.
doInstallCargoArtifacts = args.doInstallCargoArtifacts or false;
})

View File

@ -16,7 +16,6 @@ cargoBuild (args // {
cargoExtraArgs = "${cargoExtraArgs} ${cargoTarpaulinExtraArgs}";
doCheck = false;
doInstallCargoArtifacts = args.doInstallCargoArtifacts or false;
pnameSuffix = "-tarpaulin";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cargo-tarpaulin ];