summary refs log tree commit diff
path: root/pkgs/test/dotnet/project-references/default.nix
blob: f40b9196c2091210bc8b2dde71ce01c1d81cade8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Tests the `projectReferences = [ ... ];` feature of buildDotnetModule.
# The `library` derivation exposes a .nupkg, which is then consumed by the `application` derivation.
# https://nixos.org/manual/nixpkgs/unstable/index.html#packaging-a-dotnet-application

{ lib
, dotnet-sdk
, buildDotnetModule
, runCommand
}:

let
  nugetDeps = ./nuget-deps.nix;

  # Specify the TargetFramework via an environment variable so that we don't
  # have to update the .csproj files when updating dotnet-sdk
  TargetFramework = "net${lib.versions.majorMinor (lib.getVersion dotnet-sdk)}";

  library = buildDotnetModule {
    name = "project-references-test-library";
    src = ./library;
    inherit nugetDeps TargetFramework;

    packNupkg = true;
  };

  application = buildDotnetModule {
    name = "project-references-test-application";
    src = ./application;
    inherit nugetDeps TargetFramework;

    projectReferences = [ library ];
  };
in

runCommand "project-references-test" { } ''
  ${application}/bin/Application
  touch $out
''