Commit graph

345 commits

Author SHA1 Message Date
dependabot[bot]
3fb418eaf3 build(deps): bump openssl in /test/fast/openssl/fixtures
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.64 to 0.10.66.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.64...openssl-v0.10.66)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-23 11:37:38 +02:00
Nicolas Mattia
941ce6dc38 Add additionalCargoLock to README 2024-06-18 18:21:15 +02:00
Bouke van der Bijl
65122e08ef Add additionalCargoLock argument
This allows for an extra Cargo.lock, which is useful when using
build-std to ensure the requires crates are available.

Related to: #146
2024-06-18 18:21:15 +02:00
FireFragment
fa19d8c135 Disable openssl test on too old nixpkgs
There on nixpkgs 22 and lower, there is too old Rust to build OpenSSL
2024-05-30 13:12:19 +02:00
FireFragment
1e3718e2d1 Test OpenSSL as a dependency 2024-05-30 13:12:19 +02:00
FireFragment
751f21a49e Add the autoCrateSpecificOverrides option 2024-05-30 13:12:19 +02:00
FireFragment
9ffa3dac85 Remove OpenSSL tip from readme template 2024-05-30 13:12:19 +02:00
FireFragment
f0dc5a7d49 Remove OpenSSL tip from README 2024-05-30 13:12:19 +02:00
FireFragment
aa9a011ee3 Document crate-specific overrides 2024-05-30 13:12:19 +02:00
FireFragment
4d0b369475 Add crate-specific overrides 2024-05-30 13:12:19 +02:00
Andras Slemmer
c503759029 Update build.nix
Co-authored-by: Nicolas Mattia <nicolas@nmattia.com>
2024-04-19 11:58:44 +02:00
exfalso
e7a060f655 Fix .cargo-home/config warning on nightly, bump probe-rs 2024-04-19 11:58:44 +02:00
AxelSilverdew
aeb58d5e8f readme: removed maintainer status 2023-10-27 17:31:12 +02:00
Patryk Wychowaniec
06a99941d7 readme: Add maintainer status 2023-10-24 15:15:14 +02:00
Graham Christensen
636a9b5dd7 Add descriptions so nix flake check passes 2023-10-18 23:23:12 +02:00
Patryk Wychowaniec
3f976d822b Support unused dependencies
Cargo stashes unused patches into a special section of the Cargo.lock
file:

```
[[patch.unused]]
name = "uuid"
version = "1.4.1"
source = "git+https://github.com/uuid-rs/uuid#50f70278de02c106650b8d6deb325dd59b5f2a24"
```

... a section that we, currently, don't read.

Ignoring that section causes the build to fail because even if the patch
is unused, when the source is unavailable, Cargo tries to fetch it
(which, understandably, is not possible inside the sandbox).

This commit extends our logic so that we download both the "used" and
"unused" dependencies.

Closes https://github.com/nix-community/naersk/issues/308.
2023-09-07 12:09:35 +02:00
Patryk Wychowaniec
3aa2c1e1ed readme: Add a section on overrideAttrs
Closes https://github.com/nix-community/naersk/issues/277.
2023-09-07 12:09:25 +02:00
Patryk Wychowaniec
78789c30d6 Fix support for .cargo/config
Before https://github.com/nix-community/naersk/pull/300, our
`builtinz.toTOML` used to return a string representing the serialized
document which was later redirected into a file:

https://github.com/nix-community/naersk/pull/300/files#diff-b6b537316f2d29c8faf178a110366796811d1bc72f694262c7d2efad79aa984bL238

Over that merge request, this was changed to return a path, to make it
consistent with how nixpkgs' formatters work - but I haven't noticed one
place that still _read_ the file instead of returning a path (which was
fine before, since the code did `echo ... > ...`, but is not a correct
thing to do for `cp`).

Closes https://github.com/nix-community/naersk/issues/305.
2023-08-18 11:40:12 +02:00
Jos van den Oever
275010712c Look in [workspace.package] for the version number
Since Rust 1.64.0, a workpackage can define a version number that packages
in the workspace can inherit.
2023-08-16 16:01:06 +02:00
Patryk Wychowaniec
9bbe32cccf fix: Use separate sources for crates.io & Git deps 2023-08-16 11:32:57 +02:00
Patryk Wychowaniec
2593eab3ed code review: Pin nixpkgs to master 2023-08-16 11:32:57 +02:00
Patryk Wychowaniec
93844987ae ci: Bump 2023-08-16 11:32:57 +02:00
Patryk Wychowaniec
0e758b9648 Use custom writeTOML on older nixpkgs 2023-08-16 11:32:57 +02:00
Patryk Wychowaniec
eb2bdf3b0f Use TOML serializer from nixpkgs
Closes https://github.com/nix-community/naersk/issues/263
2023-08-16 11:32:57 +02:00
Patryk Wychowaniec
d9a33d69a9 Use checksums for recreating crates.io's directory
Closes https://github.com/nix-community/naersk/issues/138.
2023-07-26 14:15:29 +02:00
Patryk Wychowaniec
711ebec4c2 readme: Add a section on CMake usage 2023-07-26 14:14:20 +02:00
Patryk Wychowaniec
ad0240bbc9 test/agent-rs: Fix for aarch64-darwin 2023-07-26 14:14:20 +02:00
Patryk Wychowaniec
b03316b734 test/nushell: Fix for aarch64-darwin 2023-07-26 14:14:20 +02:00
Robin Appelman
abca1fb7a6 add 'fmt' mode 2023-07-05 07:14:43 +02:00
Jens Östlund
714e701eb4 Add support for passing options to the Clippy command 2023-07-01 18:32:46 +02:00
Patryk Wychowaniec
a8906d20a9 readme: Add an example of examples
Closes #291.
2023-07-01 18:28:46 +02:00
Frarese
df10963b95 cratesDownloadUrl 2023-06-27 09:54:46 +02:00
Robin Appelman
8507af04eb fix clippy mode 2023-06-12 14:14:47 +02:00
Robin Appelman
fd1b74c213 switch from xOnly to mode option 2023-06-12 14:14:47 +02:00
Robin Appelman
9327600ac6 add option to run cargo check/test/clippy instead of building 2023-06-12 14:14:47 +02:00
Patryk Wychowaniec
4d3bb30b8b Improve README
Closes https://github.com/nix-community/naersk/issues/283.
2023-06-12 13:30:34 +02:00
Patryk Wychowaniec
88cd223801 Fix detection of symlinked Cargo.tomls
This commit fixes a bug introduced in #276 where symlinked Cargo.tomls
wouldn't get detected due to readDir() reporting them as - well -
_symlinks_ instead of regular files.

Note that we continue to keep the `if type == "directory"` condition for
recursion which means that we'll fail to detect "nested" Cargo.tomls if
someone decides to go wild and create workspace with symlinked crates.

That I'm not 100% sure on how to approach, but fortunately cases like
those seem to be practically non-existent (and Crane apparently not
supporting them builds a bit of confidence here as well).

Closes #280.
2023-03-23 11:29:54 +01:00
Patryk Wychowaniec
5c8dbab3d9 examples: Add multiple-binaries
Closes https://github.com/nix-community/naersk/issues/272.
2023-03-21 07:56:31 +01:00
Patryk Wychowaniec
2b41e666c1 Improve Cargo.toml discovery algorithm
Our current Cargo.toml discovery algorithm is based on reading the main
Cargo.toml and looking at its `workspace.members` - unfortunately, as it
turns out there's actually no requirement for all workspace crates to be
listed there, and some applications do fancy things like:

```toml
[workspace]
members = [ "crates/foo" ]

[dependencies]
foo = { path = "crates/foo" }
bar = { path = "crates/bar" } # whoopsie
```

... which doesn't play nice with Naersk's incremental builds (that is,
the compilation fails unless `singleStep = true;` is turned on).

This commit changes the logic to use a different approach: now we simply
recursively scan the root directory, noting down all the Cargo.tomls we
find; Crane seems to use the same algorithm.

I think the only case where this approach falls short are spurious
Cargo.tomls that are present somewhere in the source directory but are
actually unused - for instance, imagine I'm writing a Cargo clone where
I've got files like `src/tests/broken-manifest/Cargo.toml` - in cases
like these, the current approach will cause the build to fail, because
we will try to fixup a broken Cargo.toml, thinking it's used somewhere.

We could try to handle cases like these by using an even different
approach: instead of traversing the source tree, we could load the main
Cargo.toml and traverse its `workspace.members` + all path-based
dependencies recursively, noting down all the *explicitly present*
Cargo.tomls.

That is, given a top-level manifest of:

```
[workspace]
members = [ "crates/foo" ]

[dependencies]
foo = { path = "crates/foo" }
bar = { path = "crates/bar" }
```

... we'd note down and load `crates/foo/Cargo.toml` +
`crates/bar/Cargo.toml`, and then load _their_ path-based dependencies,
to find all transitive Cargo.tomls that belong to this workspace.

(that is, we have to scan the crates recursively, because `bar` might
depend on `crates/zar` - and that's not an imaginary edge case, that's
actually what happens inside Nushell, for instance.)

I don't have enough time to implement this more extensive approach now,
and IMO the improvement presented here is still an improvement, so I
think it's safe to go with the new-but-still-subpar approach here and
consider the better algorithm in the future :-)

# Testing

All tests pass, I've also made sure that incremental builds are still
incremental.

Closes https://github.com/nix-community/naersk/issues/274
2023-03-21 07:54:44 +01:00
Andrew Brooks
d998160d6a Disambiguate branches/tags when invoking builtins.fetchGit 2022-12-15 10:33:36 +01:00
Patryk Wychowaniec
6944160c19 Improve unpacking dependencies 2022-09-03 17:53:20 +02:00
Vladimir Romashchenko
8d2f4d00cb examples: Add i686-pc-windows-gnu to multi-target 2022-09-02 18:37:12 +02:00
Patryk Wychowaniec
c6a45e4277 Revamp examples & README 2022-08-04 12:56:43 +02:00
Daniel Goertzen
cddffb5aa2 remove fetchGit allRefs flag for nix <2.4
Prevent use of allRefs when nix <2.4 is in use.
nix <2.4 does not accept the `allRefs` flag, but has `allRefs` behavior
by default.  Note that this goes beyond the the initial intent of this
PR because it enables naersk's `gitAllRefs` flag to work on nix <2.4.
2022-06-12 16:08:02 +02:00
Daniel Goertzen
e300ddf8cb force fetchGit allRefs when a dependency is specified with "rev"
The usage of git "rev" dependencies in Cargo implies that the rev
will be found regardless of ref.  This is currently not true in naersk;
the following dependency fails:

usbfs = {git = "https://github.com/goertzenator/usbfs-rs", rev = "7c35b46e41ad76f838cd99b493f9337f475b5b70"}
2022-06-12 16:08:02 +02:00
dependabot[bot]
14997a79cd Bump spin from 0.5.0 to 0.5.2 in /test/fast/workspace/fixtures
Bumps [spin](https://github.com/mvdnes/spin-rs) from 0.5.0 to 0.5.2.
- [Release notes](https://github.com/mvdnes/spin-rs/releases)
- [Changelog](https://github.com/mvdnes/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mvdnes/spin-rs/commits)

---
updated-dependencies:
- dependency-name: spin
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 15:28:37 +02:00
dependabot[bot]
af8ba73597 Bump regex from 1.1.8 to 1.5.5 in /test/fast/workspace-patched/fixtures
Bumps [regex](https://github.com/rust-lang/regex) from 1.1.8 to 1.5.5.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.1.8...1.5.5)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 15:28:24 +02:00
dependabot[bot]
5b76e39b2a Bump regex from 1.1.8 to 1.5.5 in /test/fast/simple-dep/fixtures
Bumps [regex](https://github.com/rust-lang/regex) from 1.1.8 to 1.5.5.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.1.8...1.5.5)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 13:21:23 +02:00
dependabot[bot]
1eb62c040d Bump spin from 0.5.0 to 0.5.2 in /test/fast/simple-dep/fixtures
Bumps [spin](https://github.com/mvdnes/spin-rs) from 0.5.0 to 0.5.2.
- [Release notes](https://github.com/mvdnes/spin-rs/releases)
- [Changelog](https://github.com/mvdnes/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mvdnes/spin-rs/commits)

---
updated-dependencies:
- dependency-name: spin
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 12:38:24 +02:00
dependabot[bot]
97ed834a86 Bump regex from 1.1.8 to 1.5.5 in /test/fast/workspace/fixtures
Bumps [regex](https://github.com/rust-lang/regex) from 1.1.8 to 1.5.5.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.1.8...1.5.5)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 12:13:04 +02:00