From 91018d6d8513f5062ffe2c27ccdc2bdcaaa3a222 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sat, 20 Mar 2021 15:17:55 +1300 Subject: [PATCH] pkg(dotnet-5.0.201): Nuget caching --- packages/dotnet/5.0.201/build.sh | 8 ++++++++ packages/dotnet/5.0.201/compile | 11 +++++++++-- packages/dotnet/5.0.201/environment | 2 +- packages/dotnet/5.0.201/run | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/dotnet/5.0.201/build.sh b/packages/dotnet/5.0.201/build.sh index cd72067..9093a3a 100644 --- a/packages/dotnet/5.0.201/build.sh +++ b/packages/dotnet/5.0.201/build.sh @@ -4,3 +4,11 @@ curl "https://download.visualstudio.microsoft.com/download/pr/73a9cb2a-1acd-4d20 tar xzf dotnet.tar.gz --strip-components=1 rm dotnet.tar.gz +# Cache nuget packages +export DOTNET_CLI_HOME=$PWD +dotnet new console -o cache_application +# This calls a restore on the global-packages index ($DOTNET_CLI_HOME/.nuget/packages) +# If we want to allow more packages, we could add them to this cache_application + +rm -rf cache_application +# Get rid of it, we don't actually need the application - just the restore \ No newline at end of file diff --git a/packages/dotnet/5.0.201/compile b/packages/dotnet/5.0.201/compile index 9a0ea83..d92c7a9 100644 --- a/packages/dotnet/5.0.201/compile +++ b/packages/dotnet/5.0.201/compile @@ -1,5 +1,12 @@ #!/usr/bin/env bash -dotnet new console +export DOTNET_CLI_HOME=$PWD + +dotnet build > /dev/null # Shut the thing up + +dotnet new console -o . --no-restore rm Program.cs -dotnet build -o . \ No newline at end of file + +dotnet restore --source $DOTNET_ROOT/.nuget/packages + +dotnet build -o . --no-restore \ No newline at end of file diff --git a/packages/dotnet/5.0.201/environment b/packages/dotnet/5.0.201/environment index 34d0bbb..596d56e 100644 --- a/packages/dotnet/5.0.201/environment +++ b/packages/dotnet/5.0.201/environment @@ -2,4 +2,4 @@ # Put 'export' statements here for environment variables export DOTNET_ROOT=$PWD -export PATH=$DOTNET_ROOT:$PATH +export PATH=$DOTNET_ROOT:$PATH \ No newline at end of file diff --git a/packages/dotnet/5.0.201/run b/packages/dotnet/5.0.201/run index 1739d03..40495e0 100644 --- a/packages/dotnet/5.0.201/run +++ b/packages/dotnet/5.0.201/run @@ -1,5 +1,7 @@ #!/usr/bin/env bash # Put instructions to run the runtime +export DOTNET_CLI_HOME=$PWD + shift dotnet $(basename $(realpath .)).dll "$@" \ No newline at end of file