Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{dotnetenv}:
2
3{ name
4, src
5, baseDir ? "."
6, slnFile
7, targets ? "ReBuild"
8, verbosity ? "detailed"
9, options ? "/p:Configuration=Debug;Platform=Win32"
10, assemblyInputs ? []
11, preBuild ? ""
12, namespace
13, mainClassName
14, mainClassFile
15, modifyPublicMain ? true
16}:
17
18let
19 application = dotnetenv.buildSolution {
20 inherit name src baseDir slnFile targets verbosity;
21 inherit options assemblyInputs preBuild;
22 inherit modifyPublicMain mainClassFile;
23 };
24in
25dotnetenv.buildSolution {
26 name = "${name}-wrapper";
27 src = ./Wrapper;
28 slnFile = "Wrapper.sln";
29 assemblyInputs = [ application ];
30 preBuild = ''
31 addRuntimeDeps()
32 {
33 if [ -f $1/nix-support/dotnet-assemblies ]
34 then
35 for i in $(cat $1/nix-support/dotnet-assemblies)
36 do
37 windowsPath=$(cygpath --windows $i | sed 's|\\|\\\\|g')
38 assemblySearchArray="$assemblySearchArray @\"$windowsPath\""
39
40 addRuntimeDeps $i
41 done
42 fi
43 }
44
45 export exePath=$(cygpath --windows $(find ${application} -name \*.exe) | sed 's|\\|\\\\|g')
46
47 # Generate assemblySearchPaths string array contents
48 for path in ${toString assemblyInputs}
49 do
50 assemblySearchArray="$assemblySearchArray @\"$(cygpath --windows $path | sed 's|\\|\\\\|g')\", "
51 addRuntimeDeps $path
52 done
53
54 sed -e "s|@ROOTNAMESPACE@|${namespace}Wrapper|" \
55 -e "s|@ASSEMBLYNAME@|${namespace}|" \
56 Wrapper/Wrapper.csproj.in > Wrapper/Wrapper.csproj
57
58 sed -e "s|@NAMESPACE@|${namespace}|g" \
59 -e "s|@MAINCLASSNAME@|${mainClassName}|g" \
60 -e "s|@EXEPATH@|$exePath|g" \
61 -e "s|@ASSEMBLYSEARCHPATH@|$assemblySearchArray|" \
62 Wrapper/Wrapper.cs.in > Wrapper/Wrapper.cs
63 '';
64}