Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

Commit f17d1ab

Browse files
committed
"kpm restore" ignores nonexistent local package feeds and gives warnings
1 parent f40cb55 commit f17d1ab

File tree

5 files changed

+112
-95
lines changed

5 files changed

+112
-95
lines changed

src/Microsoft.Framework.PackageManager/Commands/InstallCommand.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ public async Task<bool> ExecuteCommand()
5555
var packageFeeds = new List<IPackageFeed>();
5656
foreach (var source in effectiveSources)
5757
{
58-
if (new Uri(source.Source).IsFile)
58+
var feed = PackageSourceUtils.CreatePackageFeed(
59+
source,
60+
_restoreCommand.NoCache,
61+
_restoreCommand.IgnoreFailedSources,
62+
Reports);
63+
if (feed != null)
5964
{
60-
packageFeeds.Add(PackageFolderFactory.CreatePackageFolderFromPath(source.Source, Reports.Quiet));
61-
}
62-
else
63-
{
64-
packageFeeds.Add(new NuGetv2Feed(
65-
source.Source, source.UserName, source.Password, _restoreCommand.NoCache, Reports,
66-
_restoreCommand.IgnoreFailedSources));
65+
packageFeeds.Add(feed);
6766
}
6867
}
6968

src/Microsoft.Framework.PackageManager/Restore/RemoteWalkProvider.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public class RemoteWalkProvider : IWalkProvider
1616
{
1717
private readonly IPackageFeed _source;
1818

19-
public RemoteWalkProvider(IPackageFeed source, bool isHttp)
19+
public RemoteWalkProvider(IPackageFeed source)
2020
{
2121
_source = source;
22-
IsHttp = isHttp;
22+
IsHttp = IsHttpSource(source);
2323
}
2424

2525
public bool IsHttp { get; private set; }
@@ -87,6 +87,11 @@ public async Task CopyToAsync(WalkProviderMatch match, Stream stream)
8787
await nupkgStream.CopyToAsync(stream);
8888
}
8989
}
90+
91+
private static bool IsHttpSource(IPackageFeed source)
92+
{
93+
return (source is NuGetv2Feed);
94+
}
9095
}
9196
}
9297

src/Microsoft.Framework.PackageManager/Restore/RestoreCommand.cs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -448,27 +448,10 @@ private void AddRemoteProvidersFromSources(List<IWalkProvider> remoteProviders,
448448
{
449449
foreach (var source in effectiveSources)
450450
{
451-
if (new Uri(source.Source).IsFile)
451+
var feed = PackageSourceUtils.CreatePackageFeed(source, NoCache, IgnoreFailedSources, Reports);
452+
if (feed != null)
452453
{
453-
remoteProviders.Add(
454-
new RemoteWalkProvider(
455-
PackageFolderFactory.CreatePackageFolderFromPath(
456-
source.Source,
457-
Reports.Quiet),
458-
isHttp: false));
459-
}
460-
else
461-
{
462-
remoteProviders.Add(
463-
new RemoteWalkProvider(
464-
new NuGetv2Feed(
465-
source.Source,
466-
source.UserName,
467-
source.Password,
468-
NoCache,
469-
Reports,
470-
ignoreFailure: IgnoreFailedSources),
471-
isHttp: true));
454+
remoteProviders.Add(new RemoteWalkProvider(feed));
472455
}
473456
}
474457
}

src/Microsoft.Framework.PackageManager/Utils/PackageSourceUtils.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.IO;
77
using System.Linq;
88
using NuGet;
9+
using Microsoft.Framework.PackageManager.Restore.NuGet;
910

1011
namespace Microsoft.Framework.PackageManager
1112
{
@@ -25,6 +26,31 @@ public static List<PackageSource> GetEffectivePackageSources(IPackageSourceProvi
2526
return enabledSources.Concat(addedSources).Distinct().ToList();
2627
}
2728

29+
public static IPackageFeed CreatePackageFeed(PackageSource source, bool noCache, bool ignoreFailedSources,
30+
Reports reports)
31+
{
32+
if (new Uri(source.Source).IsFile)
33+
{
34+
if (!Directory.Exists(source.Source))
35+
{
36+
reports.Information.WriteLine("Package source {0} doesn't exist",
37+
source.Source.Yellow().Bold());
38+
return null;
39+
}
40+
return PackageFolderFactory.CreatePackageFolderFromPath(source.Source, reports.Quiet);
41+
}
42+
else
43+
{
44+
return new NuGetv2Feed(
45+
source.Source,
46+
source.UserName,
47+
source.Password,
48+
noCache,
49+
reports,
50+
ignoreFailedSources);
51+
}
52+
}
53+
2854
private static bool CorrectName(string value, PackageSource source)
2955
{
3056
return source.Name.Equals(value, StringComparison.CurrentCultureIgnoreCase) ||

src/klr.core45/tpa.cpp

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,78 +6,82 @@
66

77
BOOL CreateTpaBase(LPWSTR** ppNames, size_t* pcNames, bool bNative)
88
{
9-
const size_t count = 32;
9+
const size_t count = 34;
1010
LPWSTR* pArray = new LPWSTR[count];
1111

1212
if (bNative)
1313
{
14-
pArray[0] = _wcsdup(L"mscorlib.ni.dll");
15-
pArray[1] = _wcsdup(L"mscorlib.Extensions.ni.dll");
16-
pArray[2] = _wcsdup(L"System.ni.dll");
17-
pArray[3] = _wcsdup(L"System.AppContext.ni.dll");
18-
pArray[4] = _wcsdup(L"System.Collections.ni.dll");
19-
pArray[5] = _wcsdup(L"System.Collections.Concurrent.ni.dll");
20-
pArray[6] = _wcsdup(L"System.ComponentModel.ni.dll");
21-
pArray[7] = _wcsdup(L"System.Console.ni.dll");
22-
pArray[8] = _wcsdup(L"System.Core.ni.dll");
23-
pArray[9] = _wcsdup(L"System.Diagnostics.Debug.ni.dll");
24-
pArray[10] = _wcsdup(L"System.Diagnostics.Tracing.ni.dll");
25-
pArray[11] = _wcsdup(L"System.Globalization.ni.dll");
26-
pArray[12] = _wcsdup(L"System.IO.ni.dll");
27-
pArray[13] = _wcsdup(L"System.IO.FileSystem.ni.dll");
28-
pArray[14] = _wcsdup(L"System.IO.FileSystem.Primitives.ni.dll");
29-
pArray[15] = _wcsdup(L"System.Linq.ni.dll");
30-
pArray[16] = _wcsdup(L"System.Reflection.ni.dll");
31-
pArray[17] = _wcsdup(L"System.Reflection.Extensions.ni.dll");
32-
pArray[18] = _wcsdup(L"System.Reflection.Primitives.ni.dll");
33-
pArray[19] = _wcsdup(L"System.Resources.ResourceManager.ni.dll");
34-
pArray[20] = _wcsdup(L"System.Runtime.ni.dll");
35-
pArray[21] = _wcsdup(L"System.Runtime.Extensions.ni.dll");
36-
pArray[22] = _wcsdup(L"System.Runtime.Handles.ni.dll");
37-
pArray[23] = _wcsdup(L"System.Runtime.InteropServices.ni.dll");
38-
pArray[24] = _wcsdup(L"System.Runtime.Loader.ni.dll");
39-
pArray[25] = _wcsdup(L"System.Text.Encoding.ni.dll");
40-
pArray[26] = _wcsdup(L"System.Text.Encoding.Extensions.ni.dll");
41-
pArray[27] = _wcsdup(L"System.Text.RegularExpressions.ni.dll");
42-
pArray[28] = _wcsdup(L"System.Threading.ni.dll");
43-
pArray[29] = _wcsdup(L"System.Threading.Overlapped.ni.dll");
44-
pArray[30] = _wcsdup(L"System.Threading.Tasks.ni.dll");
45-
pArray[31] = _wcsdup(L"System.Threading.ThreadPool.ni.dll");
14+
pArray[0] = _wcsdup(L"Internal.Runtime.Uri.ni.dll");
15+
pArray[1] = _wcsdup(L"Internal.Uri.ni.dll");
16+
pArray[2] = _wcsdup(L"mscorlib.ni.dll");
17+
pArray[3] = _wcsdup(L"mscorlib.Extensions.ni.dll");
18+
pArray[4] = _wcsdup(L"System.ni.dll");
19+
pArray[5] = _wcsdup(L"System.AppContext.ni.dll");
20+
pArray[6] = _wcsdup(L"System.Collections.ni.dll");
21+
pArray[7] = _wcsdup(L"System.Collections.Concurrent.ni.dll");
22+
pArray[8] = _wcsdup(L"System.ComponentModel.ni.dll");
23+
pArray[9] = _wcsdup(L"System.Console.ni.dll");
24+
pArray[10] = _wcsdup(L"System.Core.ni.dll");
25+
pArray[11] = _wcsdup(L"System.Diagnostics.Debug.ni.dll");
26+
pArray[12] = _wcsdup(L"System.Diagnostics.Tracing.ni.dll");
27+
pArray[13] = _wcsdup(L"System.Globalization.ni.dll");
28+
pArray[14] = _wcsdup(L"System.IO.ni.dll");
29+
pArray[15] = _wcsdup(L"System.IO.FileSystem.ni.dll");
30+
pArray[16] = _wcsdup(L"System.IO.FileSystem.Primitives.ni.dll");
31+
pArray[17] = _wcsdup(L"System.Linq.ni.dll");
32+
pArray[18] = _wcsdup(L"System.Reflection.ni.dll");
33+
pArray[19] = _wcsdup(L"System.Reflection.Extensions.ni.dll");
34+
pArray[20] = _wcsdup(L"System.Reflection.Primitives.ni.dll");
35+
pArray[21] = _wcsdup(L"System.Resources.ResourceManager.ni.dll");
36+
pArray[22] = _wcsdup(L"System.Runtime.ni.dll");
37+
pArray[23] = _wcsdup(L"System.Runtime.Extensions.ni.dll");
38+
pArray[24] = _wcsdup(L"System.Runtime.Handles.ni.dll");
39+
pArray[25] = _wcsdup(L"System.Runtime.InteropServices.ni.dll");
40+
pArray[26] = _wcsdup(L"System.Runtime.Loader.ni.dll");
41+
pArray[27] = _wcsdup(L"System.Text.Encoding.ni.dll");
42+
pArray[28] = _wcsdup(L"System.Text.Encoding.Extensions.ni.dll");
43+
pArray[29] = _wcsdup(L"System.Text.RegularExpressions.ni.dll");
44+
pArray[30] = _wcsdup(L"System.Threading.ni.dll");
45+
pArray[31] = _wcsdup(L"System.Threading.Overlapped.ni.dll");
46+
pArray[32] = _wcsdup(L"System.Threading.Tasks.ni.dll");
47+
pArray[33] = _wcsdup(L"System.Threading.ThreadPool.ni.dll");
4648
}
4749
else
4850
{
49-
pArray[0] = _wcsdup(L"mscorlib.dll");
50-
pArray[1] = _wcsdup(L"mscorlib.Extensions.dll");
51-
pArray[2] = _wcsdup(L"System.dll");
52-
pArray[3] = _wcsdup(L"System.AppContext.dll");
53-
pArray[4] = _wcsdup(L"System.Collections.dll");
54-
pArray[5] = _wcsdup(L"System.Collections.Concurrent.dll");
55-
pArray[6] = _wcsdup(L"System.ComponentModel.dll");
56-
pArray[7] = _wcsdup(L"System.Console.dll");
57-
pArray[8] = _wcsdup(L"System.Core.dll");
58-
pArray[9] = _wcsdup(L"System.Diagnostics.Debug.dll");
59-
pArray[10] = _wcsdup(L"System.Diagnostics.Tracing.dll");
60-
pArray[11] = _wcsdup(L"System.Globalization.dll");
61-
pArray[12] = _wcsdup(L"System.IO.dll");
62-
pArray[13] = _wcsdup(L"System.IO.FileSystem.dll");
63-
pArray[14] = _wcsdup(L"System.IO.FileSystem.Primitives.dll");
64-
pArray[15] = _wcsdup(L"System.Linq.dll");
65-
pArray[16] = _wcsdup(L"System.Reflection.dll");
66-
pArray[17] = _wcsdup(L"System.Reflection.Extensions.dll");
67-
pArray[18] = _wcsdup(L"System.Reflection.Primitives.dll");
68-
pArray[19] = _wcsdup(L"System.Resources.ResourceManager.dll");
69-
pArray[20] = _wcsdup(L"System.Runtime.dll");
70-
pArray[21] = _wcsdup(L"System.Runtime.Extensions.dll");
71-
pArray[22] = _wcsdup(L"System.Runtime.Handles.dll");
72-
pArray[23] = _wcsdup(L"System.Runtime.InteropServices.dll");
73-
pArray[24] = _wcsdup(L"System.Runtime.Loader.dll");
74-
pArray[25] = _wcsdup(L"System.Text.Encoding.dll");
75-
pArray[26] = _wcsdup(L"System.Text.Encoding.Extensions.dll");
76-
pArray[27] = _wcsdup(L"System.Text.RegularExpressions.dll");
77-
pArray[28] = _wcsdup(L"System.Threading.dll");
78-
pArray[29] = _wcsdup(L"System.Threading.Overlapped.dll");
79-
pArray[30] = _wcsdup(L"System.Threading.Tasks.dll");
80-
pArray[31] = _wcsdup(L"System.Threading.ThreadPool.dll");
51+
pArray[0] = _wcsdup(L"Internal.Runtime.Uri.dll");
52+
pArray[1] = _wcsdup(L"Internal.Uri.dll");
53+
pArray[2] = _wcsdup(L"mscorlib.dll");
54+
pArray[3] = _wcsdup(L"mscorlib.Extensions.dll");
55+
pArray[4] = _wcsdup(L"System.dll");
56+
pArray[5] = _wcsdup(L"System.AppContext.dll");
57+
pArray[6] = _wcsdup(L"System.Collections.dll");
58+
pArray[7] = _wcsdup(L"System.Collections.Concurrent.dll");
59+
pArray[8] = _wcsdup(L"System.ComponentModel.dll");
60+
pArray[9] = _wcsdup(L"System.Console.dll");
61+
pArray[10] = _wcsdup(L"System.Core.dll");
62+
pArray[11] = _wcsdup(L"System.Diagnostics.Debug.dll");
63+
pArray[12] = _wcsdup(L"System.Diagnostics.Tracing.dll");
64+
pArray[13] = _wcsdup(L"System.Globalization.dll");
65+
pArray[14] = _wcsdup(L"System.IO.dll");
66+
pArray[15] = _wcsdup(L"System.IO.FileSystem.dll");
67+
pArray[16] = _wcsdup(L"System.IO.FileSystem.Primitives.dll");
68+
pArray[17] = _wcsdup(L"System.Linq.dll");
69+
pArray[18] = _wcsdup(L"System.Reflection.dll");
70+
pArray[19] = _wcsdup(L"System.Reflection.Extensions.dll");
71+
pArray[20] = _wcsdup(L"System.Reflection.Primitives.dll");
72+
pArray[21] = _wcsdup(L"System.Resources.ResourceManager.dll");
73+
pArray[22] = _wcsdup(L"System.Runtime.dll");
74+
pArray[23] = _wcsdup(L"System.Runtime.Extensions.dll");
75+
pArray[24] = _wcsdup(L"System.Runtime.Handles.dll");
76+
pArray[25] = _wcsdup(L"System.Runtime.InteropServices.dll");
77+
pArray[26] = _wcsdup(L"System.Runtime.Loader.dll");
78+
pArray[27] = _wcsdup(L"System.Text.Encoding.dll");
79+
pArray[28] = _wcsdup(L"System.Text.Encoding.Extensions.dll");
80+
pArray[29] = _wcsdup(L"System.Text.RegularExpressions.dll");
81+
pArray[30] = _wcsdup(L"System.Threading.dll");
82+
pArray[31] = _wcsdup(L"System.Threading.Overlapped.dll");
83+
pArray[32] = _wcsdup(L"System.Threading.Tasks.dll");
84+
pArray[33] = _wcsdup(L"System.Threading.ThreadPool.dll");
8185
}
8286

8387
*ppNames = pArray;

0 commit comments

Comments
 (0)