Commit Graph

109 Commits

Author SHA1 Message Date
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
Ivan Petkov
66303545d7
Update flake.lock (#382)
Flake lock file updates:

• Updated input 'flake-utils':
    'github:numtide/flake-utils/919d646de7be200f3bf08cb76ae1f09402b6f9b4' (2023-07-11)
  → 'github:numtide/flake-utils/f9e7cf818399d17d347f847525c5a5a8032e4e44' (2023-08-23)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5068bc8fe943bde3c446326da8d0ca9c93d5a682' (2023-08-07)
  → 'github:NixOS/nixpkgs/e7f35e03abd06a2faef6684d0de813370e13bda8' (2023-09-02)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/b520a3889b24aaf909e287d19d406862ced9ffc9' (2023-08-07)
  → 'github:oxalica/rust-overlay/98ccb73e6eefc481da6039ee57ad8818d1ca8d56' (2023-09-03)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-03 12:04:55 -07:00
Rebecca Turner
7b92b595c9
Add devshell helper (#378) 2023-09-03 10:33:10 -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
Ivan Petkov
ff2e879b26
update all Cargo.locks (#364)
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/4a56ce9727a0c5478a836a0d8a8f641c5b9a3d5f' (2023-08-02)
  → 'github:NixOS/nixpkgs/5068bc8fe943bde3c446326da8d0ca9c93d5a682' (2023-08-07)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/99df4908445be37ddb2d332580365fce512a7dcf' (2023-08-03)
  → 'github:oxalica/rust-overlay/b520a3889b24aaf909e287d19d406862ced9ffc9' (2023-08-07)
2023-08-11 00:13:17 +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
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
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
Ivan Petkov
2f8dd307c5
checks: Update libc branch (#328) 2023-05-19 00:12:15 +00:00
Leonardo Eugênio
dd77ba5f6c
fix: incremental compilation in trunk examples, set target using env var (#316) 2023-05-03 17:24:02 +00: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
Ivan Petkov
54b63c8eae
chore: update all Cargo.locks (#304) 2023-04-16 21:28:36 +00:00
Ivan Petkov
aab6d4f865
vendorMultipleCargoDeps: fix deduplication logic (#289)
* We should ignore the package.dependencies array since it can cause
  problems
2023-04-02 23:46:24 +00:00
Ivan Petkov
f491bee4f9
Add support for building standard library crates (#287)
* vendorCargoRegistries: accept `registries` from the caller if specified
* Add vendorMultipleCargoDeps
2023-04-02 17:57:17 +00:00
Ivan Petkov
72fa29510a
chore: bump all Cargo.locks (#280) 2023-03-26 06:21:21 +00:00
Ivan Petkov
ec69da6973
vendorCargoDeps: skip checking for cargoConfigs if src not set (#278) 2023-03-22 04:57:14 +00:00
figsoda
77435dad14
feat: add cargoLockParsed option (#270)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-03-20 00:33:17 +00:00
figsoda
475de74fa2
feat: add cargoLlvmCov (#267)
* 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>
2023-03-19 23:44:14 +00:00
Roman Volosatovs
5291dd0aa7
feat: add support for bindeps feature (#258)
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>
2023-03-06 17:24:21 -08:00
Ivan Petkov
6fb400ec63
crateNameFromCargoToml: warn when values can't be found (#237) 2023-02-12 00:39:43 +00:00
Felix Schröter
2b866abbdd
ignore non-json lines in cargoBuildLog (#234)
Fixes issues with non-json values in cargoBuildLog: rust-lang/cargo#8179
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-02-11 13:27:11 -08:00
Ivan Petkov
7e2e5b3cc1
chore: bump all Cargo.lock files (#230) 2023-02-07 23:47:42 +00:00
Ivan Petkov
00564437f3
Properly handle workspace inheritance in git dependencies (#224)
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.
2023-01-21 16:46:32 -08:00
Ivan Petkov
b13963c8c1
chore: bump some git deps in Cargo.locks (#221) 2023-01-11 02:57:33 +00:00
Ivan Petkov
0144134311
chore: bump all Cargo.locks (#219) 2023-01-07 01:47:45 +00:00
Ivan Petkov
cb0c042a27
docs: make example code for nested workspaces more universal (#215) 2023-01-06 03:07:21 +00:00
Ivan Petkov
42e2fab6bc
Make it easier to build workspaces not at source root (#212) 2023-01-05 04:46:43 +00:00
Ivan Petkov
18ef99b1e0
inheritCargoArtifactsHook: preserve executable bit of build scripts (#206)
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)
2023-01-04 02:53:38 +00:00
Ivan Petkov
a4d70a26e7
Add Crane book (#199) 2022-12-26 14:27:13 -08:00
Ivan Petkov
70fcce8db0
mkDummySrc: try to use the same output name as original source (#190) 2022-12-20 20:50:22 -08:00
Ivan Petkov
ea271bdc05
ci: test against 22.11 and stop testing 22.05 (#179) 2022-12-01 20:12:55 -08:00
Ivan Petkov
2b0be4c1c4
mkDummySrc: work with uefi targets by default, and allow downstream customization (#174)
* 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
2022-11-28 03:23:35 +00:00
Ivan Petkov
c61d98aaea
mkDummySrc: properly import core (#172) 2022-11-21 01:12:39 +00:00
Ivan Petkov
35fd8fcbb0
Run nixpkgs-fmt 2022-11-20 16:28:49 -08:00
Ivan Petkov
2ce1a3313e
Eliminate dead code (#148) 2022-10-23 23:20:22 +00:00
Ivan Petkov
6b864957e1
checks: add tests for building crates using workspace inheritance (#147) 2022-10-23 22:56:18 +00:00
Roman Volosatovs
097afacc53
mkDummySrc: support freestanding targets (#126)
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2022-10-19 02:13:38 +00:00
Ivan Petkov
17f4ff6ad7 buildPackage: use mkCargoDerivation instead of cargoBuild 2022-10-09 12:56:21 -10:00
Ivan Petkov
f27d6dd45d cargoTarpaulin: require that cargoArtifacts are specified 2022-10-09 11:33:57 -10:00
Ivan Petkov
0b71f12fc7
Add cargoTest for running crate tests (#132) 2022-10-09 21:00:17 +00:00
Ivan Petkov
22f971a126
mkDummySrc: fix handling of build scripts (#122)
* 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)
2022-09-28 02:05:06 +00:00
Ivan Petkov
21e627606c
mkDummySrc: allow running a custom script after dummification is done (#116) 2022-09-27 06:25:09 +00:00
Ivan Petkov
1428f3ae64
Update flake deps (#121) 2022-09-26 21:52:38 -07:00
Ivan Petkov
06b1f7bd80
Improve stripping references to vendored sources (#120)
* Also add removeReferencesToVendoredSourcesHook
2022-09-24 23:45:56 +00:00