-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support reading package folder locations out of the lock file
The task previously was constructing the path to the user's packages location itself, which had various issues. It meant that if the restore was done with a different path, we don't know that. It also meant we didn't handle the paths specified in nuget.config. Now, if the paths are present in the lock file, we'll use that. Otherwise, we'll construct our old path as before. Any explicitly given path to the task is still used no matter what.
- Loading branch information
1 parent
4a5f280
commit d37c917
Showing
7 changed files
with
183 additions
and
33 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/Microsoft.NuGet.Build.Tasks.Tests/Json/LockFileWithWithSpecifiedPackageFolders.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"locked": false, | ||
"version": 2, | ||
"targets": { | ||
".NETFramework,Version=v4.5": { | ||
"Newtonsoft.Json/8.0.3": { | ||
"type": "package", | ||
"compile": { | ||
"lib/net45/Newtonsoft.Json.dll": {} | ||
}, | ||
"runtime": { | ||
"lib/net45/Newtonsoft.Json.dll": {} | ||
} | ||
} | ||
} | ||
}, | ||
"libraries": { | ||
"Newtonsoft.Json/8.0.3": { | ||
"sha512": "KGsYQdS2zLH+H8x2cZaSI7e+YZ4SFIbyy1YJQYl6GYBWjf5o4H1A68nxyq+WTyVSOJQ4GqS/DiPE+UseUizgMg==", | ||
"type": "package", | ||
"path": "newtonsoft.json/8.0.3", | ||
"files": [ | ||
"lib/net20/Newtonsoft.Json.dll", | ||
"lib/net20/Newtonsoft.Json.xml", | ||
"lib/net35/Newtonsoft.Json.dll", | ||
"lib/net35/Newtonsoft.Json.xml", | ||
"lib/net40/Newtonsoft.Json.dll", | ||
"lib/net40/Newtonsoft.Json.xml", | ||
"lib/net45/Newtonsoft.Json.dll", | ||
"lib/net45/Newtonsoft.Json.xml", | ||
"lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll", | ||
"lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml", | ||
"lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.dll", | ||
"lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.xml", | ||
"newtonsoft.json.8.0.3.nupkg.sha512", | ||
"newtonsoft.json.nuspec", | ||
"tools/install.ps1" | ||
] | ||
} | ||
}, | ||
"projectFileDependencyGroups": { | ||
"": [ | ||
"Newtonsoft.Json" | ||
], | ||
".NETFramework,Version=v4.5": [] | ||
}, | ||
"tools": {}, | ||
"projectFileToolGroups": {}, | ||
"packageFolders": { | ||
"C:\\PackageFolder\\": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Microsoft.NuGet.Build.Tasks.Tests/PackageFolderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Microsoft.NuGet.Build.Tasks.Tests | ||
{ | ||
public class PackageFolderTests | ||
{ | ||
[Fact] | ||
public void ResolveWithLockFileWithPackageFolders() | ||
{ | ||
var result = NuGetTestHelpers.ResolvePackagesWithJsonFileContents( | ||
Json.Json.LockFileWithWithSpecifiedPackageFolders, | ||
".NETFramework,Version=v4.5", | ||
runtimeIdentifier: null, | ||
createTemporaryFolderForPackages: false); | ||
|
||
Assert.Equal(@"C:\PackageFolder\Newtonsoft.Json\8.0.3\lib\net45\Newtonsoft.Json.dll", result.References.Single().ItemSpec); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters