Merge pull request #234235 from raphaelr/mknugetsource-support-subdirs
buildDotnetModule: fix `projectReferences = [ ... ]`
This commit is contained in:
commit
6b942b501e
|
@ -15,12 +15,10 @@ let
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out/{lib,share}
|
mkdir -p $out/{lib,share}
|
||||||
|
|
||||||
(
|
# use -L to follow symbolic links. When `projectReferences` is used in
|
||||||
shopt -s nullglob
|
# buildDotnetModule, one of the deps will be a symlink farm.
|
||||||
for nupkg in ${lib.concatMapStringsSep " " (dep: "\"${dep}\"/*.nupkg") deps}; do
|
find -L ${lib.concatStringsSep " " deps} -type f -name '*.nupkg' -exec \
|
||||||
cp --no-clobber "$nupkg" $out/lib
|
cp --no-clobber '{}' $out/lib ';'
|
||||||
done
|
|
||||||
)
|
|
||||||
|
|
||||||
# Generates a list of all licenses' spdx ids, if available.
|
# Generates a list of all licenses' spdx ids, if available.
|
||||||
# Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt")
|
# Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt")
|
||||||
|
|
|
@ -86,6 +86,8 @@ with pkgs;
|
||||||
|
|
||||||
coq = callPackage ./coq {};
|
coq = callPackage ./coq {};
|
||||||
|
|
||||||
|
dotnet = recurseIntoAttrs (callPackages ./dotnet { });
|
||||||
|
|
||||||
makeHardcodeGsettingsPatch = callPackage ./make-hardcode-gsettings-patch { };
|
makeHardcodeGsettingsPatch = callPackage ./make-hardcode-gsettings-patch { };
|
||||||
|
|
||||||
makeWrapper = callPackage ./make-wrapper { };
|
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