diff options
author | Evgeny Zemtsov <eze@resoptima.com> | 2021-12-09 20:17:12 +0100 |
---|---|---|
committer | Evgeny Zemtsov <eze@resoptima.com> | 2021-12-13 19:14:44 +0100 |
commit | 06477cccf74328cad4b77152d5426b1efed392ca (patch) | |
tree | c01f088fb18a730258574663af19417640329e9f /pkgs/build-support | |
parent | a6d02a52140017e5d10ad702620cdc6829b2ee91 (diff) |
buildDotnetModule: support local project references
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/build-dotnet-module/default.nix | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/build-support/build-dotnet-module/default.nix b/pkgs/build-support/build-dotnet-module/default.nix index 637924b056a3..7e56e70bf8b9 100644 --- a/pkgs/build-support/build-dotnet-module/default.nix +++ b/pkgs/build-support/build-dotnet-module/default.nix @@ -30,6 +30,15 @@ # The NuGet dependency file. This locks all NuGet dependency versions, as otherwise they cannot be deterministically fetched. # This can be generated using the `nuget-to-nix` tool. , nugetDeps ? null +# A list of derivations containing nupkg packages for local project references. +# Referenced derivations can be built with `buildDotnetModule` with `packNupkg=true` flag. +# Since we are sharing them as nugets they must be added to csproj/fsproj files as `PackageReference` as well. +# For example, your project has a local dependency: +# <ProjectReference Include="../foo/bar.fsproj" /> +# To enable discovery through `projectReferences` you would need to add a line: +# <ProjectReference Include="../foo/bar.fsproj" /> +# <PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/> +, projectReferences ? [] # Libraries that need to be available at runtime should be passed through this. # These get wrapped into `LD_LIBRARY_PATH`. , runtimeDeps ? [] @@ -64,6 +73,7 @@ let inherit sha256; }; }); + _localDeps = linkFarmFromDrvs "${name}-local-nuget-deps" projectReferences; nuget-source = stdenvNoCC.mkDerivation rec { name = "${args.pname}-nuget-source"; @@ -76,6 +86,8 @@ let nuget sources Add -Name nixos -Source "$out/lib" nuget init "${_nugetDeps}" "$out/lib" + ${lib.optionalString (projectReferences != []) + "nuget init \"${_localDeps}\" \"$out/lib\""} # Generates a list of all unique licenses' spdx ids. find "$out/lib" -name "*.nuspec" -exec sh -c \ |