Code Monkey home page Code Monkey logo

import-cargo's Issues

Create separate build derivations for each dependency

Currently import-cargo just builds a derivation full of vendored source code.

It'd be quite amazing if it could build a set of derivations that compile each dependency separately (in order to avoid recompiling things unnecessarily).

Currently cargo (nightly) provides --build-plan, which outputs a plan full of the relevant rustc calls/args/env variables and the dependency tree. It seems like it should be possible to use this to create the set of nix derivations (with a little bit of rewriting of paths and -L inputs etc.)

A snip of a bit of the --build-plan output for a single dependency in the middle of my tree:

    {
      "package_name": "syn",
      "package_version": "0.11.11",
      "target_kind": [
        "lib"
      ],
      "kind": "Host",
      "compile_mode": "build",
      "deps": [
        1,
        3,
        2
      ],
      "outputs": [
        "/home/darius/whist-rust/target/release/deps/libsyn-45a26153f0636545.rlib",
        "/home/darius/whist-rust/target/release/deps/libsyn-45a26153f0636545.rmeta"
      ],
      "links": {},
      "program": "rustc",
      "args": [
        "--crate-name",
        "syn",
        "/home/darius/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-0.11.11/src/lib.rs",
        "--error-format=json",
        "--json=diagnostic-rendered-ansi,artifacts",
        "--crate-type",
        "lib",
        "--emit=dep-info,metadata,link",
        "-C",
        "opt-level=3",
        "-C",
        "debuginfo=2",
        "--cfg",
        "feature=\"default\"",
        "--cfg",
        "feature=\"parsing\"",
        "--cfg",
        "feature=\"printing\"",
        "--cfg",
        "feature=\"quote\"",
        "--cfg",
        "feature=\"synom\"",
        "--cfg",
        "feature=\"unicode-xid\"",
        "--cfg",
        "feature=\"visit\"",
        "-C",
        "metadata=45a26153f0636545",
        "-C",
        "extra-filename=-45a26153f0636545",
        "--out-dir",
        "/home/darius/whist-rust/target/release/deps",
        "-L",
        "dependency=/home/darius/whist-rust/target/release/deps",
        "--extern",
        "quote=/home/darius/whist-rust/target/release/deps/libquote-103bc26133e54dfe.rmeta",
        "--extern",
        "synom=/home/darius/whist-rust/target/release/deps/libsynom-5d0d6e9fb7bedce0.rmeta",
        "--extern",
        "unicode_xid=/home/darius/whist-rust/target/release/deps/libunicode_xid-528627904f457e26.rmeta",
        "--cap-lints",
        "allow"
      ],
      "env": {
        "CARGO": "/nix/store/akbsvnqdzj1rspmicv1j8qs8l7rhwbjv-rust/bin/cargo",
        "CARGO_MANIFEST_DIR": "/home/darius/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-0.11.11",
        "CARGO_PKG_AUTHORS": "David Tolnay <[email protected]>",
        "CARGO_PKG_DESCRIPTION": "Nom parser for Rust source code",
        "CARGO_PKG_HOMEPAGE": "",
        "CARGO_PKG_NAME": "syn",
        "CARGO_PKG_REPOSITORY": "https://github.com/dtolnay/syn",
        "CARGO_PKG_VERSION": "0.11.11",
        "CARGO_PKG_VERSION_MAJOR": "0",
        "CARGO_PKG_VERSION_MINOR": "11",
        "CARGO_PKG_VERSION_PATCH": "11",
        "CARGO_PKG_VERSION_PRE": "",
        "LD_LIBRARY_PATH": "/home/darius/whist-rust/target/release/deps:/nix/store/pk26s5n6myxda66splfnvbbg2kw0g40n-rust-1.42.0-nightly-2020-01-01-1ed41b072/lib:/run/opengl-driver/lib"
      },
      "cwd": "/home/darius/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-0.11.11"
    },

cc @mstone @copumpkin @P-E-Meunier

Project license

Hi!

I would like to use import-cargo in my project under MIT license, but there is no license in this project.
Can you add it?

Thanks in advance!

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.