This makes it possible to evaluate crane in a nixos test without network
as well as allow to backup all fetched input derivations properly in a
binary cache, whereas fetchGit will fallback to downloading from a
repository, which also requires a `git` binary to be present.
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
For example, commands which extract a tarball should be cached (i.e
should use `runCommand` not `runCommandLocal`) because it allows builds
to download the unpacked result instead of having to write both to the
store
With Cargo 1.68.0, sparse registries were made stable. With sparse
registries, index metadata is stored in an HTTP api rather than in
a git repository.
As relevant to Crane, the relevant changes are mostly that registries
do not always start with `registry+` and mostly start with `registry+`
or `sparse+` depending on whether the registry is sparse or not.
This PR adjusts the core of Crane to differentiate between `registry`
and `sparse`, and adds a new sparse registry factory to make things
easy.
---------
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
For projects using version != 2021 and resolver = 2, the resolver
information needs to be kept or otherwise the dependency build might
fail.
---------
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
[Trunk](https://trunkrs.dev) is a tool that allow you to build web apps
using Rust and webassembly, including compiling scss, and distributing
other assets.
Adds `craneLib.buildTrunkPackage`, a function that builds a Trunk
project returning a directory with the resulting dist files for that
project
---------
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
* feat: add cargoLlvmCov
* cargoHelperFunctionsHook: prefer `--release` over `--profile release`
Some tools (e.g. cargo-llvm-cov) don't understand `--profile release` as
an alias for `--release`, so `cargoWithProfile` should prefer passing
`--release` when `$CARGO_PROFILE` == "release"
---------
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
Write a `main.rs` to `src/bin/dummy` within the generated dummy source,
rather than `src/main.rs` to account for `illegalBin` test case
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Crates from git repos are vendored in a flattened directory where each crate shows up at the root of the vendor directory. Since the vendoring step effectively breaks workspace structures, any crates which use workspace inheritance (e.g. package.version.workspace = true will fail to resolve.
To work around this we inspect the crate's workspace manifest (if it exists) and attempt to manually merge the values while copying the contents to the vendor directory.
Using `cp --no-preserve mode` ends up losing the executable bit of
previously compiled build scripts. Instead we should ignore the file
ownership, and subsequently make the files writable (since the store is
read only)
* mkDummySrc: also include `no_std` attrs for target_os = uefi
* buildDepsOnly: only check with `--all-targets` if doCheck enabled
* mkDummySrc: allow customizing dummy Rust file contents
* Instead of injecting our own dummy `build.rs` file, we will patch the
`Cargo.toml` files to specify a build script in the Nix store
* This allow cargo to notice the difference (i.e. changed build script
path) where it could not before (due to nix enforcing that all sources
always have the same timestamp)