···
postFixup = lib.optionalString (unwrapped ? man) ''
ln -s ${unwrapped.man} "$man"
passthru = unwrapped.passthru // {
···
usePackageSource ? false,
···
sdk = finalAttrs.finalPackage;
built = stdenv.mkDerivation {
+
name = "${sdk.name}-test-${name}";
buildInputs = [ sdk ] ++ buildInputs ++ lib.optional (usePackageSource) sdk.packages;
# make sure ICU works in a sandbox
propagatedSandboxProfile = toString sdk.__propagatedSandboxProfile;
+
++ lib.optionals (lang != null) [
+
dotnet new ${lib.escapeShellArgs unpackArgs} -o . --no-restore
+
# older SDKs don't include an embedded FSharp.Core package
+
if lang == "F#" && lib.versionOlder sdk.version "6.0.400" then
+
else if run == null then
runCommand "${built.name}-run"
···
+
# Setting LANG to something other than 'C' forces the runtime to search
+
# for ICU, which will be required in most user environments.
+
checkConsoleOutput = command: ''
+
output="$(LANG=C.UTF-8 ${command})"
+
[[ "$output" =~ ${output} ]] && touch "$out"
+
name = "console-${name}-${suffix}";
+
build = checkConsoleOutput "dotnet run";
+
publish = mkConsoleTest {
+
build = "dotnet publish -o $out/bin";
+
run = checkConsoleOutput "$src/bin/test";
+
self-contained = mkConsoleTest {
+
name = "self-contained";
+
usePackageSource = true;
+
build = "dotnet publish --use-current-runtime --sc -o $out";
+
run = checkConsoleOutput "$src/test";
+
single-file = mkConsoleTest {
+
usePackageSource = true;
+
build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
+
run = checkConsoleOutput "$src/bin/test";
+
// lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
+
stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
+
usePackageSource = true;
+
++ lib.optional stdenv.hostPlatform.isDarwin (
+
with apple_sdk.frameworks;
+
dotnet restore -p:PublishAot=true
+
dotnet publish -p:PublishAot=true -o $out/bin
+
run = checkConsoleOutput "$src/bin/test";
+
name = "web-${suffix}";
build = "dotnet publish -o $out/bin";
runtime = finalAttrs.finalPackage.aspnetcore;
···
runAllowNetworking = true;
+
unwrapped.passthru.tests or { }
+
version = testers.testVersion (
+
package = finalAttrs.finalPackage;
+
// lib.optionalAttrs (type != "sdk") {
+
command = "dotnet --info";
+
// lib.optionalAttrs (type == "sdk") ({
+
console = lib.recurseIntoAttrs {
+
# yes, older SDKs omit the comma
+
cs = mkConsoleTests "C#" "cs" "Hello,?\\ World!";
+
fs = mkConsoleTests "F#" "fs" "Hello\\ from\\ F#";
+
vb = mkConsoleTests "VB" "vb" "Hello,?\\ World!";
+
web = lib.recurseIntoAttrs {
+
cs = mkWebTest "C#" "cs";
+
fs = mkWebTest "F#" "fs";