Skip to content

Commit

Permalink
cargoDoc: do not install cargo artifacts by default (ipetkov#381)
Browse files Browse the repository at this point in the history
* Also install generated docs
  • Loading branch information
ipetkov authored Sep 3, 2023
1 parent 80432e1 commit ecf1516
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions lib/cargoDoc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
})

0 comments on commit ecf1516

Please sign in to comment.