Make the nuget cache local to the repo (#3370)

* fixes #3368

* Update build nuget cache to be in the repo
This commit is contained in:
Bryan Thornbury 2016-06-09 15:05:27 -07:00 committed by Piotr Puszkiewicz
parent 45d8f174aa
commit 1dc6b0e2dd
5 changed files with 11 additions and 20 deletions

View file

@ -261,21 +261,9 @@ namespace Microsoft.DotNet.Cli.Build
public static BuildTargetResult CheckPackageCache(BuildTargetContext c)
{
var ciBuild = string.Equals(Environment.GetEnvironmentVariable("CI_BUILD"), "1", StringComparison.Ordinal);
if (ciBuild)
{
// On CI, HOME is redirected under the repo, which gets deleted after every build.
// So make NUGET_PACKAGES outside of the repo.
var nugetPackages = Path.GetFullPath(Path.Combine(c.BuildContext.BuildDirectory, "..", ".nuget", "packages"));
Environment.SetEnvironmentVariable("NUGET_PACKAGES", nugetPackages);
Dirs.NuGetPackages = nugetPackages;
}
// Set the package cache location in NUGET_PACKAGES just to be safe
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUGET_PACKAGES")))
{
Environment.SetEnvironmentVariable("NUGET_PACKAGES", Dirs.NuGetPackages);
}
// Always set the package cache location local to the build
Environment.SetEnvironmentVariable("NUGET_PACKAGES", Dirs.NuGetPackages);
CleanNuGetTempCache();

View file

@ -25,6 +25,7 @@ if($Help)
$env:CONFIGURATION = $Configuration;
$RepoRoot = "$PSScriptRoot\..\.."
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
if($NoPackage)
{

View file

@ -57,6 +57,9 @@ while [[ $# > 0 ]]; do
shift
done
# Set nuget package cache under the repo
export NUGET_PACKAGES="$REPOROOT/.nuget/packages"
# Set up the environment to be used for building with clang.
if which "clang-3.5" > /dev/null 2>&1; then
export CC="$(which clang-3.5)"