Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
base: a408bcbe4447
Choose a base ref
...
head repository: NixOS/nixpkgs
compare: 366dc671a956
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on Jan 7, 2020

  1. buildRustCrate: add buildTests flag to tell rustc to build tests in…

    …stead of binaries
    
    This helps us instruct rustc to build tests instead of binaries. The
    actual build will then ONLY produce test executables. This is a first
    step towards having rust crate tests within nixpkgs.
    
    We default back to only a single output in test cases since that is the
    only reasonable thing to do here.
    
    Producing libraries or binaries in addition to tests would theoretically
    be feasible but usually generates different dependency trees. It is very
    common to have some libraries in `[dev-depdendencies]` within Cargo.toml
    just for your tests. To not start mixing things up going with a
    dedicated derivation for the test build sounds like the best choice for
    now.
    
    To use this you must provide a proper test dependency chain to
    `buildRustCrate` (as you would usually do with your non-test inputs).
    And then set the `buildTests` attribute to `true`. The derivation will
    then contain all tests that were built in `$out/tests`. All common test
    patterns and directories should be supported and tested by this change.
    
    Below is an example how you would run a single test from the derivation.
    This commit contains some more examples in the `buildRustCrateTests`
    attribute set that might be helpful.
    
    ```
    let
      drv = buildRustCrate {
         …
         buildTests true;
      };
    in runCommand "test-my-crate" {} ''
      touch $out
      exec ${drv}/tests/my-test
    ''
    ```
    andir committed Jan 7, 2020
    Copy the full SHA
    a3a5176 View commit details
    Browse the repository at this point in the history
  2. buildRustCrate: slight "rewording" and reformatting

    There is no point in reinventinb builtins through `filterAttrs` or the
    like. Lets just stick to what we already have in our toolbelt.
    andir committed Jan 7, 2020
    Copy the full SHA
    3e61906 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    71a96b2 View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2020

  1. Merge pull request #76820 from andir/buildRustCrate-tests

    buildRustCrate: add `buildTests` flag to tell rustc to build tests instead of binaries
    andir committed Jan 8, 2020
    Copy the full SHA
    366dc67 View commit details
    Browse the repository at this point in the history