dotnetenv.{buildSolution,buildWrapper}: follow editorconfig & follow common bash style

There seems to be duplication and also improvements to one between these, so someone
should rework these.

Add missing `pre` and `post` hook runs.
This commit is contained in:
Artturin 2024-09-12 20:18:12 +03:00
parent 280db3deca
commit a4e4fc5d35
2 changed files with 39 additions and 46 deletions

View File

@ -31,12 +31,11 @@ stdenv.mkDerivation {
'';
installPhase = ''
addDeps()
{
if [ -f $1/nix-support/dotnet-assemblies ]
then
for i in $(cat $1/nix-support/dotnet-assemblies)
do
runHook preInstall
addDeps() {
if [ -f $1/nix-support/dotnet-assemblies ]; then
for i in $(cat $1/nix-support/dotnet-assemblies); do
windowsPath=$(cygpath --windows $i)
assemblySearchPaths="$assemblySearchPaths;$windowsPath"
@ -45,13 +44,11 @@ stdenv.mkDerivation {
fi
}
for i in ${toString assemblyInputs}
do
for i in ${toString assemblyInputs}; do
windowsPath=$(cygpath --windows $i)
echo "Using assembly path: $windowsPath"
if [ "$assemblySearchPaths" = "" ]
then
if [ "$assemblySearchPaths" = "" ]; then
assemblySearchPaths="$windowsPath"
else
assemblySearchPaths="$assemblySearchPaths;$windowsPath"
@ -62,8 +59,7 @@ stdenv.mkDerivation {
echo "Assembly search paths are: $assemblySearchPaths"
if [ "$assemblySearchPaths" != "" ]
then
if [ "$assemblySearchPaths" != "" ]; then
echo "Using assembly search paths args: $assemblySearchPathsArg"
export AssemblySearchPaths=$assemblySearchPaths
fi
@ -77,9 +73,10 @@ stdenv.mkDerivation {
mkdir -p $out/nix-support
for i in ${toString assemblyInputs}
do
for i in ${toString assemblyInputs}; do
echo $i >> $out/nix-support/dotnet-assemblies
done
runHook postInstall
'';
}

View File

@ -28,12 +28,9 @@ dotnetenv.buildSolution {
slnFile = "Wrapper.sln";
assemblyInputs = [ application ];
preBuild = ''
addRuntimeDeps()
{
if [ -f $1/nix-support/dotnet-assemblies ]
then
for i in $(cat $1/nix-support/dotnet-assemblies)
do
addRuntimeDeps() {
if [ -f $1/nix-support/dotnet-assemblies ]; then
for i in $(cat $1/nix-support/dotnet-assemblies); do
windowsPath=$(cygpath --windows $i | sed 's|\\|\\\\|g')
assemblySearchArray="$assemblySearchArray @\"$windowsPath\""
@ -45,8 +42,7 @@ dotnetenv.buildSolution {
export exePath=$(cygpath --windows $(find ${application} -name \*.exe) | sed 's|\\|\\\\|g')
# Generate assemblySearchPaths string array contents
for path in ${toString assemblyInputs}
do
for path in ${toString assemblyInputs}; do
assemblySearchArray="$assemblySearchArray @\"$(cygpath --windows $path | sed 's|\\|\\\\|g')\", "
addRuntimeDeps $path
done