Commit Graph

202 Commits

Author SHA1 Message Date
Vetle Brænd
865458e532
vendorMultipleCargoDeps: use backwards compatible groupBy (#546)
* builtins.groupBy is not included until nix version 2.5 and is only
  used as an optimization. Using lib.groupBy will retain compatibility
  with older versions of nix.
2024-03-08 19:53:46 +00:00
greaka
81c393c776
fix: allow registries in vendorMultipleCargoDeps as documented (#540)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-03-05 03:53:19 +00:00
Ivan Petkov
f2926e34a1
chore: replace overrideScope' with overrideScope (#517) 2024-02-08 03:38:28 +00:00
Ivan Petkov
c7bb4ed1f3
cleanCargoToml: strip out [lints] definitions when cleaning (#516) 2024-02-08 03:34:33 +00:00
Ivan Petkov
7d5b46c17d
Update docs (#514)
* vendorCargoDeps: update error message to hint towards staging Cargo.lock
* crateNameFromCargoToml: update docs to note directory are not crawled
2024-02-04 19:31:22 +00:00
Ivan Petkov
c5a3c5dac3
crane-utils: bump dependencies (#508) 2024-01-28 19:22:09 +00:00
Ivan Petkov
960d350770
vendorCargoDeps: manually splice packages to avoid cross build issues (#507)
* Source vendoring is passed as a standalone attribute to
  `mkCargoDerivation`, meaning it does not automagically get spliced
  with the correct local/cross system inputs (i.e. what would happen if
  it was a `depsBuildBuild` entry)
* To fix this we need to make sure that `vendorCargoDeps` and all of its
  transitive dependencies always use `runCommand` (and friends) from
  their `pkgsBuildBuild` equivalent. This should always be safe to do
  (even for cross-builds) since this amounts to building up a bunch of
  sources which will be read by the build system
* Unfortunately I had to manually specify `pkgsBuildBuild.whatever` in
  multiple places as I could not get things to work by messing with the
  `callPackage` definition. Perhaps we should be using
  `makeScopeWithSplicing'` instead of `makeScope` when constructing the
  library, but I couldn't get it working (and I couldn't find any decent
  docs on how to use it online) so this will make do for the time being.
2024-01-28 19:08:44 +00:00
Charles Hall
0327ca9d77
force buildDepsOnly to produce out only (#493)
This allows multi-output derivations using e.g. `buildPackage` to work.
Without this change, they fail to build because Nix thinks
`buildDepsOnly` is supposed to produce mulitple outputs too, but it
doesn't.

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-01-27 17:52:30 +00:00
Adam Curtis
751290c945
fix: add #[allow(unused_extern_crates)] to dummy.rs (#501) 2024-01-27 02:36:30 +00:00
Leonardo Eugênio
2a5136f14a
buildTrunkPackage: Add "wasm-bindgen-cli" argument (#363) 2023-12-20 08:24:53 -08:00
Ivan Petkov
c53a8c071d
buildDepsOnly: pass --no-run to cargo test by default (#470) 2023-11-30 00:43:47 +00:00
danjl1100
faf6a81da1
buildTrunkPackage - separately export and declare shell variables (SC2155) (#458)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-11-26 18:28:14 +00:00
Ivan Petkov
f1c2fe6716
installCargoArtifactsHook: allow specifying additional zstd args (#450) 2023-11-05 20:34:43 +00:00
Ivan Petkov
2b1203872d
chore: clean up some dead code warnings (#449) 2023-11-05 18:42:08 +00:00
Ivan Petkov
418ec86477
mkDummySrc: fix cleaning to work with Nix store overrides (#448)
* Turns out if a build is invoked with `--store` then the source
  cleaning filter will observe paths rooted at the alternative store
  which breaks out previous string handling (and results in incorrectly
  ignoring files which should be included)
2023-11-05 18:32:24 +00:00
Ivan Petkov
758ae44222
installCargoArtifactsHook: change default installation mode to use-zstd (#442) 2023-10-20 22:28:41 +00:00
Aidan Gauland
f8f1b3fc5b
cargoLib.cargoDeny: init (#440)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-10-20 21:45:03 +00:00
Ivan Petkov
c97a0c0d83
feature: incremental zstd mode (#398)
---------

Co-authored-by: Dawid Ciężarkiewicz <dpc@dpc.pw>
2023-10-17 19:30:35 -07:00
Ivan Petkov
eb5034b6ee
replaceCargoLockHook: run as prePatchHook not postUnpack (#434) 2023-10-17 03:31:33 +00:00
Ivan Petkov
f2b70c85d5
devShell: add clippy and rustfmt from the current toolchain (#432) 2023-10-17 00:24:15 +00:00
Ivan Petkov
deec116f40
crateNameFromCargoToml: add hint for finding the source of the warning (#429) 2023-10-15 21:56:40 +00:00
simonzkl
47f84c5b60
removeReferencesToVendoredSources: sign aarch64-darwin binaries (#418)
---------

Co-authored-by: Simon Zlender <simonz@btcx.com>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-10-15 20:09:08 +00:00
Ivan Petkov
9d6bf09d32
chore: clean up some dead code 2023-10-15 11:38:35 -07:00
ISibboI
a8b2251989
Make cached cargo artifacts writable in buildPackage when using use-zstd (#413)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-10-15 19:08:32 +00:00
Ivan Petkov
4dcf584de1
mkCargoDerivation: replace Cargo.lock with contents of cargoLock (#425)
* The vendoring helpers already accept a `cargoLock` override, so
  automatically linking it in the derivation (if set) makes it a bit
  easier without having the caller manually do the link themselves
2023-10-15 01:42:24 +00:00
Ivan Petkov
ce0a13f8ba
cargoAudit: ignore yanked crates by default (#423)
* Checking for yanked crates requires network access (to ping the
  crates.io index) which won't work from inside the sandbox
2023-10-14 21:50:48 +00:00
Dawid Ciężarkiewicz
0da36bc7dd
fix: cargo docs breaking in buildDepsOnly of workspaces (#410) 2023-10-03 18:59:04 -07:00
Marijan Petričević
a863ce3c79
fix #404 - lib/cargoTarpaulin: lowercase --out xml argument (#405) 2023-10-01 11:22:09 -07:00
Ivan Petkov
67f100acc0
buildPackage: fix issue with inheriting default depsOnly artifacts (#397) 2023-09-23 23:23:33 +00:00
Jörg Thalheim
16f5732c14
allow to pass outputHashes to crane (#266)
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>
2023-09-22 04:08:53 +00:00
Ivan Petkov
8b4f7a4dab
various: switch to using runCommand to improve caching (#384)
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
2023-09-04 00:33:25 +00:00
Rebecca Turner
7b92b595c9
Add devshell helper (#378) 2023-09-03 10:33:10 -07:00
Ivan Petkov
ecf151658e
cargoDoc: do not install cargo artifacts by default (#381)
* Also install generated docs
2023-09-03 10:29:13 -07:00
Rebecca Turner
174604795d
Add workaround for cargo-nextest bug (#376)
Prevents this error:

```
(...)
dyld: Library not loaded: @rpath/libtest-77ee8c29c330e4a3.dylib
  Referenced from: /private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a
  Reason: image not found
error: creating test list failed
Caused by:
  for `hdk_derive::proc-macro/hdk_derive`, running command `/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a --list --format terse` failed
Caused by:
  command ["/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a", "--list", "--format", "terse"] exited with code <signal 6>
Error: Process completed with exit code 104.
```

https://github.com/nextest-rs/nextest/issues/267
2023-08-30 23:44:00 +00:00
Ivan Petkov
43db881168
various: change cargoExtraArgs defaults to include --locked (#373) 2023-08-27 19:17:58 +00:00
Ivan Petkov
7809d36971
downloadCargoPackageFromGit: resolve symlinks in crate directory (#367) 2023-08-12 01:26:37 +00:00
Leonardo Eugênio
1b8653ad52
Trunk: use native dart-sass (#360)
Replace the javascript version of dart-sass with a native binary version.
Should improve built times and reduce disk usage.

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-08-11 00:38:14 +00:00
Ivan Petkov
8b08e96c9a
inheritCargoArtifactsHook: fix doNotLinkInheritedArtifacts handling (#357)
* This ensures that when doNotLinkInheritedArtifacts is set, artifact
  symlinks are deeply resolved
2023-07-07 23:28:38 +00:00
Ivan Petkov
33cfcdf33b
Fix tests to run on darwin (#348) 2023-06-29 23:50:17 +00:00
Ivan Petkov
116b32c30b
inheritCargoArtifactsHook: allow disabling symlink behavior (#345) 2023-06-21 01:13:46 +00:00
Ivan Petkov
bd65e0e473
inheritCargoArtifactsHook: symlink dependency rlib and rmeta files (#344)
* cargoTarpaulin: do not clean by default

---------

Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
Co-authored-by: Philipp Mildenberger <philipp.mildenberger@artfabrik.at>
2023-06-19 21:50:17 +00:00
Roman Volosatovs
9f6e7286c5
fix: do not install bindep artifacts by default (#298)
- Add support for installing crates utilizing `bindeps` feature
by only installing binaries of workspace packages

---------

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-06-18 23:41:59 +00:00
James Baker
75f7d715f8
Natively support sparse registries (#324)
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>
2023-06-13 02:03:18 +00:00
Ivan Petkov
057d95721e
Add support for installing dylib crate types (#340)
---------

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Roman Volosatovs <rvolosatovs@riseup.net>
2023-06-08 01:00:25 +00:00
Uosis
3acc7230ee
Clean install hooks from buildDepsOnly invocation (#334)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-06-07 05:38:53 +00:00
Quentin
bff08cbecc
fix(Trunk): Set the wasm-opt version as expected by Trunk (#338)
Trunk expect a version number with this specific format: "version_{num}"
2023-06-06 20:54:50 -07:00
Leonardo Eugênio
35110cccf2
fix: Strip store references in buildTrunkPackage (#330)
The output of buildTrunkPackage should never have runtime dependencies.
Not only are they redundant but they also increase the closure greatly.
2023-05-25 02:17:57 +00:00
Antti Keränen
99de890b6e
Keep "resolver" when cleaning Cargo.toml (#327)
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>
2023-05-18 21:03:02 -07:00
Leonardo Eugênio
7d74bfafea
fix: building trunk projects that use sass, add test (#314) 2023-05-02 17:23:35 -07:00
Leonardo Eugênio
db21a44eb0
Trunk support (#299)
[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>
2023-04-29 12:34:39 -07:00