Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git workspaces #298

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Git workspaces #298

wants to merge 11 commits into from

Conversation

tilpner
Copy link
Contributor

@tilpner tilpner commented Sep 20, 2023

This adds support for using workspaces in git dependencies with inherited fields, building upon #166 and #281.
An example project which doesn't build on master, but works with this PR, can be found here.

#166 takes care of exposing workspace members at the top level of a vendoring entry, so that cargo can find it, but it abducts the crate from its workspace without adjusting the manifest.
For example, the sqlx-postgres manifest inherits dependencies and metadata (edition, license) from the workspace manifest. These fields can't be filled in by cargo after copying the member crate out of the workspace, so this PR fills in that information before/while copying it out.

It does add a dependency on cargo's unstable API, which I found preferable to reimplementing the manifest inheritance on top of cargo_metadata, but I'd understand if it's an unacceptable choice for crate2nix. cargo (in the most recent version, which might not be required) also expects a very recent rustc.

The libgit2-sys dependencies are currently duplicated, due to lack of a central place to put them. If tools.nix could import default.nix, this wouldn't be a problem, but that seems to have been avoided so far, and would probably cause changes to the public interface.

If the commit message convention is out of place, or the drive-by "improvements" (don't shadow nix, use stable CLI) don't fit into this PR, we can change/drop them.

marius851000 and others added 11 commits September 19, 2023 12:22
It has a fairly narrow range of libgit2 versions it will accept from the
system environment, so instead of manually providing a recent-enough
version from nixpkgs-unstable, or downgrading the rust crate until the
available version matches, we allow it to build its preferred version.
When copying out workspace member crates from a larger workspace,
cargo will not be able to process the separated manifest if it still
refers to e.g. the workspace license or workspace dependencies, because
it can't find the workspace manifest.

We can't help it find the workspace manifest, because crates in a cargo
vendor directory aren't discovered recursively, and cargo doesn't resolve
symlinks before checking the ancestors to find the workspace manifest.
@kolloch
Copy link
Collaborator

kolloch commented Oct 14, 2023

Heyo @tilpner, I am not sure when I have time to think about this. But I already merged some of your commits on master, so thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants