tests.dotnet: init with test for projectReferences
Add a test for buildDotnetModule's `projectReferences = [ ... ];` feature, which is currently unused and therefore untested in nixpkgs.
This commit is contained in:
parent
c9ff452fd2
commit
256c3a7a53
8 changed files with 74 additions and 0 deletions
|
@ -86,6 +86,8 @@ with pkgs;
|
|||
|
||||
coq = callPackage ./coq {};
|
||||
|
||||
dotnet = recurseIntoAttrs (callPackages ./dotnet { });
|
||||
|
||||
makeHardcodeGsettingsPatch = callPackage ./make-hardcode-gsettings-patch { };
|
||||
|
||||
makeWrapper = callPackage ./make-wrapper { };
|
||||
|
|
5
pkgs/test/dotnet/default.nix
Normal file
5
pkgs/test/dotnet/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ callPackage }:
|
||||
|
||||
{
|
||||
project-references = callPackage ./project-references { };
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
ProjectReferencesTest.Library.Hello();
|
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../library/Library.csproj" />
|
||||
<PackageReference Include="ProjectReferencesTest.Library" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' " />
|
||||
</ItemGroup>
|
||||
</Project>
|
38
pkgs/test/dotnet/project-references/default.nix
Normal file
38
pkgs/test/dotnet/project-references/default.nix
Normal file
|
@ -0,0 +1,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
|
||||
''
|
8
pkgs/test/dotnet/project-references/library/Library.cs
Normal file
8
pkgs/test/dotnet/project-references/library/Library.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace ProjectReferencesTest;
|
||||
public static class Library
|
||||
{
|
||||
public static void Hello()
|
||||
{
|
||||
System.Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>ProjectReferencesTest.Library</PackageId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
5
pkgs/test/dotnet/project-references/nuget-deps.nix
Normal file
5
pkgs/test/dotnet/project-references/nuget-deps.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
# This file was automatically generated by passthru.fetch-deps.
|
||||
# Please dont edit it manually, your changes might get overwritten!
|
||||
|
||||
{ fetchNuGet }: [
|
||||
]
|
Loading…
Reference in a new issue