Giter Club home page Giter Club logo

Comments (5)

ebkalderon avatar ebkalderon commented on August 27, 2024

This task could be made easier with #118, given that --message-format=json happens to include a list of filenames (in this case, .rmeta artifacts when using cargo check) belonging to the current crate. We could leverage this flag to glean what artifacts need to be copied in the Nix store on cargo check or cargo clippy.

Note that the .d files aren't listed with --message-format=json, and deleting them doesn't seem to invalidate the cache of cargo check nor affect the final result, indicating that they are probably safe to ignore.

from cargo2nix.

ebkalderon avatar ebkalderon commented on August 27, 2024

I think this feature would require a sizeable refactor of overlay/mkcrate.nix because cargo check is so different from cargo {build,test}. In the latter, we only care about .{rlib,a,so,dylib} files, while in the former we apparently only care about .rmeta files. This means that we can't reuse the linking logic in overlay/utils.sh; we'll need to write it nearly from scratch specifically for cargo check.

AFAIK, we can't wrap rustc and use command-line flags to point to Nix store paths of .rmeta files, so we may need to instead create a target/deps directory, symlink-farm all the dependencies' .rmeta files into it, and then pick out all the non-symlink files created and copy them to $out somewhere. This is so radically different from the other two compile modes, in fact, that I'm not sure how to approach this task without turning mkcrate.nix into a tangled mess.

from cargo2nix.

psionic-k avatar psionic-k commented on August 27, 2024

I ran the check --release on RustAnalyzer. Significantly more diverse outputs in the artifacts than just .d and .rmeta

Aside, since rust check doesn't need to link or emit binary, is it even benefiting from cargo2nix's native deps? I would like to constrain the role so that cargo2nix is doing maximum utility but with only strictly necessary second-system overhead

from cargo2nix.

ebkalderon avatar ebkalderon commented on August 27, 2024

@psionic-k It depends on the particular crate. If a crate provides a build.rs that performs codegen, it might run at cargo check time. As such, we have to be prepared for the possibility that the build.rs might call out to a native dep at any time, even during cargo check. Apparently, there is a desire upstream to indicate to build scripts whether a crate is "building" or "checking" and adjust the work done as a result, but this doesn't seem to have landed yet (rust-lang/cargo#4001).

from cargo2nix.

psionic-k avatar psionic-k commented on August 27, 2024

See reasoning in #92 for not blocking, but also not pursuing more support for non-output Nix derivations

from cargo2nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.