cargoDoc: do not install cargo artifacts by default (#381)

* Also install generated docs
This commit is contained in:
Ivan Petkov 2023-09-03 10:29:13 -07:00 committed by GitHub
parent 80432e1545
commit ecf151658e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -14,7 +14,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
`Cargo.lock` is exactly what is expected (without implicit changes at build
time) but this may end up rejecting builds which were previously passing. To
get the old behavior back, set `cargoExtraArgs = "";`
* Fixed a bug when testing proc macro crates with `cargoNextest` on macO. ([#376](https://github.com/ipetkov/crane/pull/376))
* **Breaking**: `cargoDoc` will no longer install cargo artifacts by default.
Set `doInstallCargoArtifacts = true;` to get the old behavior back.
* `cargoDoc` will now install generated documentation in `$out/share/doc`
* Fixed a bug when testing proc macro crates with `cargoNextest` on macOS.
([#376](https://github.com/ipetkov/crane/pull/376))
## [0.13.1] - 2023-08-22

View File

@ -431,6 +431,7 @@ Except where noted below, all derivation attributes are delegated to
- `CARGO_PROFILE` can be set on the derivation to alter which cargo profile
is selected; setting it to `""` will omit specifying a profile
altogether.
* `doInstallCargoArtifacts` will default to `false` if not specified
* `pnameSuffix` will be set to `"-doc"`
#### Required attributes

View File

@ -15,4 +15,13 @@ mkCargoDerivation (args // {
pnameSuffix = "-doc";
buildPhaseCargoCommand = "cargoWithProfile doc ${cargoExtraArgs} ${cargoDocExtraArgs}";
doInstallCargoArtifacts = args.doInstallCargoArtifacts or false;
# NB: cargo always places docs at the root of the target directory
# even when building in release mode
installPhaseCommand = ''
mkdir -p $out/share
mv "''${CARGO_TARGET_DIR:-target}/doc" $out/share
'';
})