···
postFixup = lib.optionalString (unwrapped ? man) ''
ln -s ${unwrapped.man} "$man"
passthru = unwrapped.passthru // {
···
usePackageSource ? false,
···
sdk = finalAttrs.finalPackage;
built = stdenv.mkDerivation {
105
-
name = "dotnet-test-${name}";
107
+
name = "${sdk.name}-test-${name}";
buildInputs = [ sdk ] ++ buildInputs ++ lib.optional (usePackageSource) sdk.packages;
# make sure ICU works in a sandbox
propagatedSandboxProfile = toString sdk.__propagatedSandboxProfile;
112
-
dotnet new ${template} -o . --no-restore
115
+
++ lib.optionals (lang != null) [
123
+
dotnet new ${lib.escapeShellArgs unpackArgs} -o . --no-restore
118
-
if run == null then
129
+
# older SDKs don't include an embedded FSharp.Core package
130
+
if lang == "F#" && lib.versionOlder sdk.version "6.0.400" then
132
+
else if run == null then
runCommand "${built.name}-run"
···
145
-
# Setting LANG to something other than 'C' forces the runtime to search
146
-
# for ICU, which will be required in most user environments.
147
-
checkConsoleOutput = command: ''
148
-
output="$(LANG=C.UTF-8 ${command})"
149
-
# yes, older SDKs omit the comma
150
-
[[ "$output" =~ Hello,?\ World! ]] && touch "$out"
153
-
unwrapped.passthru.tests or { }
155
-
version = testers.testVersion (
157
-
package = finalAttrs.finalPackage;
159
-
// lib.optionalAttrs (type != "sdk") {
160
-
command = "dotnet --info";
164
-
// lib.optionalAttrs (type == "sdk") (
166
-
console = mkDotnetTest {
168
-
template = "console";
169
-
build = checkConsoleOutput "dotnet run";
160
+
lang: suffix: output:
162
+
# Setting LANG to something other than 'C' forces the runtime to search
163
+
# for ICU, which will be required in most user environments.
164
+
checkConsoleOutput = command: ''
165
+
output="$(LANG=C.UTF-8 ${command})"
166
+
[[ "$output" =~ ${output} ]] && touch "$out"
170
+
{ name, ... }@args:
174
+
name = "console-${name}-${suffix}";
175
+
template = "console";
180
+
lib.recurseIntoAttrs {
181
+
run = mkConsoleTest {
183
+
build = checkConsoleOutput "dotnet run";
172
-
publish = mkDotnetTest {
174
-
template = "console";
175
-
build = "dotnet publish -o $out/bin";
176
-
run = checkConsoleOutput "$src/bin/test";
186
+
publish = mkConsoleTest {
188
+
build = "dotnet publish -o $out/bin";
189
+
run = checkConsoleOutput "$src/bin/test";
179
-
self-contained = mkDotnetTest {
180
-
name = "self-contained";
181
-
template = "console";
182
-
usePackageSource = true;
183
-
build = "dotnet publish --use-current-runtime --sc -o $out";
185
-
run = checkConsoleOutput "$src/test";
192
+
self-contained = mkConsoleTest {
193
+
name = "self-contained";
194
+
usePackageSource = true;
195
+
build = "dotnet publish --use-current-runtime --sc -o $out";
197
+
run = checkConsoleOutput "$src/test";
188
-
single-file = mkDotnetTest {
189
-
name = "single-file";
190
-
template = "console";
191
-
usePackageSource = true;
192
-
build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
194
-
run = checkConsoleOutput "$src/bin/test";
200
+
single-file = mkConsoleTest {
201
+
name = "single-file";
202
+
usePackageSource = true;
203
+
build = "dotnet publish --use-current-runtime -p:PublishSingleFile=true -o $out/bin";
205
+
run = checkConsoleOutput "$src/bin/test";
208
+
// lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
209
+
aot = mkConsoleTest {
211
+
stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
212
+
usePackageSource = true;
217
+
++ lib.optional stdenv.hostPlatform.isDarwin (
219
+
with apple_sdk.frameworks;
221
+
swiftPackages.swift
229
+
dotnet restore -p:PublishAot=true
230
+
dotnet publish -p:PublishAot=true -o $out/bin
233
+
run = checkConsoleOutput "$src/bin/test";
197
-
web = mkDotnetTest {
240
+
name = "web-${suffix}";
build = "dotnet publish -o $out/bin";
runtime = finalAttrs.finalPackage.aspnetcore;
···
runAllowNetworking = true;
232
-
// lib.optionalAttrs finalAttrs.finalPackage.hasILCompiler {
233
-
aot = mkDotnetTest {
235
-
stdenv = if stdenv.hostPlatform.isDarwin then swiftPackages.stdenv else stdenv;
236
-
template = "console";
237
-
usePackageSource = true;
242
-
++ lib.optional stdenv.hostPlatform.isDarwin (
244
-
with apple_sdk.frameworks;
246
-
swiftPackages.swift
254
-
dotnet restore -p:PublishAot=true
255
-
dotnet publish -p:PublishAot=true -o $out/bin
258
-
run = checkConsoleOutput "$src/bin/test";
275
+
unwrapped.passthru.tests or { }
277
+
version = testers.testVersion (
279
+
package = finalAttrs.finalPackage;
281
+
// lib.optionalAttrs (type != "sdk") {
282
+
command = "dotnet --info";
286
+
// lib.optionalAttrs (type == "sdk") ({
287
+
console = lib.recurseIntoAttrs {
288
+
# yes, older SDKs omit the comma
289
+
cs = mkConsoleTests "C#" "cs" "Hello,?\\ World!";
290
+
fs = mkConsoleTests "F#" "fs" "Hello\\ from\\ F#";
291
+
vb = mkConsoleTests "VB" "vb" "Hello,?\\ World!";
294
+
web = lib.recurseIntoAttrs {
295
+
cs = mkWebTest "C#" "cs";
296
+
fs = mkWebTest "F#" "fs";