diff options
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/test/default.nix | 2 | ||||
-rw-r--r-- | pkgs/test/dotnet/default.nix | 5 | ||||
-rw-r--r-- | pkgs/test/dotnet/project-references/application/Application.cs | 1 | ||||
-rw-r--r-- | pkgs/test/dotnet/project-references/application/Application.csproj | 10 | ||||
-rw-r--r-- | pkgs/test/dotnet/project-references/default.nix | 38 | ||||
-rw-r--r-- | pkgs/test/dotnet/project-references/library/Library.cs | 8 | ||||
-rw-r--r-- | pkgs/test/dotnet/project-references/library/Library.csproj | 5 | ||||
-rw-r--r-- | pkgs/test/dotnet/project-references/nuget-deps.nix | 5 |
8 files changed, 74 insertions, 0 deletions
diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 9f684dcea72ff..b6793d25b6e21 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -86,6 +86,8 @@ with pkgs; coq = callPackage ./coq {}; + dotnet = recurseIntoAttrs (callPackages ./dotnet { }); + makeHardcodeGsettingsPatch = callPackage ./make-hardcode-gsettings-patch { }; makeWrapper = callPackage ./make-wrapper { }; diff --git a/pkgs/test/dotnet/default.nix b/pkgs/test/dotnet/default.nix new file mode 100644 index 0000000000000..7592b09d76e3c --- /dev/null +++ b/pkgs/test/dotnet/default.nix @@ -0,0 +1,5 @@ +{ callPackage }: + +{ + project-references = callPackage ./project-references { }; +} diff --git a/pkgs/test/dotnet/project-references/application/Application.cs b/pkgs/test/dotnet/project-references/application/Application.cs new file mode 100644 index 0000000000000..ae2c956a4df73 --- /dev/null +++ b/pkgs/test/dotnet/project-references/application/Application.cs @@ -0,0 +1 @@ +ProjectReferencesTest.Library.Hello(); diff --git a/pkgs/test/dotnet/project-references/application/Application.csproj b/pkgs/test/dotnet/project-references/application/Application.csproj new file mode 100644 index 0000000000000..6507637a5535c --- /dev/null +++ b/pkgs/test/dotnet/project-references/application/Application.csproj @@ -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> diff --git a/pkgs/test/dotnet/project-references/default.nix b/pkgs/test/dotnet/project-references/default.nix new file mode 100644 index 0000000000000..f40b9196c2091 --- /dev/null +++ b/pkgs/test/dotnet/project-references/default.nix @@ -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 +'' diff --git a/pkgs/test/dotnet/project-references/library/Library.cs b/pkgs/test/dotnet/project-references/library/Library.cs new file mode 100644 index 0000000000000..a4af4a0fea2d5 --- /dev/null +++ b/pkgs/test/dotnet/project-references/library/Library.cs @@ -0,0 +1,8 @@ +namespace ProjectReferencesTest; +public static class Library +{ + public static void Hello() + { + System.Console.WriteLine("Hello, World!"); + } +} diff --git a/pkgs/test/dotnet/project-references/library/Library.csproj b/pkgs/test/dotnet/project-references/library/Library.csproj new file mode 100644 index 0000000000000..b9a71276d24a9 --- /dev/null +++ b/pkgs/test/dotnet/project-references/library/Library.csproj @@ -0,0 +1,5 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <PackageId>ProjectReferencesTest.Library</PackageId> + </PropertyGroup> +</Project> diff --git a/pkgs/test/dotnet/project-references/nuget-deps.nix b/pkgs/test/dotnet/project-references/nuget-deps.nix new file mode 100644 index 0000000000000..f3a17967e25c8 --- /dev/null +++ b/pkgs/test/dotnet/project-references/nuget-deps.nix @@ -0,0 +1,5 @@ +# This file was automatically generated by passthru.fetch-deps. +# Please dont edit it manually, your changes might get overwritten! + +{ fetchNuGet }: [ +] |