use PORTABLE instead of commenting out code

This commit is contained in:
quoctruong
2016-06-29 12:40:25 -07:00
parent eea998b4df
commit 5fcd59db92
5 changed files with 21 additions and 18 deletions
@@ -76,7 +76,8 @@ namespace Microsoft.PackageManagement.Providers.Internal.Bootstrap {
return Enumerable.Empty<Feed>();
}
/* No bootstrap
#if !PORTABLE
// we don't do bootstrap on core powershell
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) {
Warning(Constants.Messages.NetworkNotAvailable);
Warning(string.Format(CultureInfo.CurrentCulture, Resources.Messages.ProviderBootstrapFailed));
@@ -92,7 +93,7 @@ namespace Microsoft.PackageManagement.Providers.Internal.Bootstrap {
Warning(Constants.Messages.ProviderSwidtagUnavailable);
return Enumerable.Empty<Feed>();
}
*/
#endif
}
return _feeds;
}
@@ -443,9 +444,10 @@ namespace Microsoft.PackageManagement.Providers.Internal.Bootstrap {
/// <returns></returns>
internal Package GetProviderFromFile(string filePath, bool copyFileToTemp = false, bool suppressErrorsAndWarnings = false) {
// not supported
#if PORTABLE
// not supported on core powershell
return null;
/*
#else
if (string.IsNullOrWhiteSpace(filePath) && !System.IO.File.Exists(filePath)) {
Warning(Constants.Messages.FileNotFound, filePath);
return null;
@@ -506,7 +508,7 @@ namespace Microsoft.PackageManagement.Providers.Internal.Bootstrap {
}
return null;
*/
#endif
}
/// <summary>
@@ -45,11 +45,11 @@
"netstandard1.6": {
"imports": ["dnxcore50"],
"buildOptions": {
"define": ["CORECLR"],
"define": ["CORECLR", "PORTABLE"],
"compile": {
"exclude": [ "ProgramsProvider.cs"]
}
}
}
}
}
}
@@ -859,7 +859,8 @@ namespace Microsoft.PackageManagement.Internal.Implementation {
return Enumerable.Empty<string>();
/* We don't need to scan provider assemblies on corepowershell.
#if !PORTABLE
//We don't need to scan provider assemblies on corepowershell.
//if provider is installed in providername\version format
var providerFolder = ProviderAssembliesLocation.Distinct(new PathEqualityComparer(PathCompareOption.Full)).SelectMany(Directory.EnumerateDirectories);
@@ -966,20 +967,20 @@ namespace Microsoft.PackageManagement.Internal.Implementation {
}
}
}
*/
#endif
}
//Return all providers under the providerAssemblies folder
internal IEnumerable<string> AllProvidersFromProviderAssembliesLocation(IHostApi request) {
/*
don't need this for core powershell
#if !PORTABLE
// don't need this for core powershell
try {
return ScanAllProvidersFromProviderAssembliesLocation(request, null, null, null, null, ProviderOption.AllProvider).WhereNotNull().ToArray();
} catch (Exception ex) {
request.Debug(ex.Message);
}
*/
#endif
return Enumerable.Empty<string>();
}
@@ -988,8 +989,8 @@ namespace Microsoft.PackageManagement.Internal.Implementation {
//This method only gets called during the initialization, i.e. LoadProviders().
private IEnumerable<string> ProvidersWithLatestVersionFromProviderAssembliesLocation(IHostApi request) {
return Enumerable.Empty<string>();
/*
don't need this for core powershell
#if !PORTABLE
// don't need this for core powershell
try {
var providerPaths = ScanAllProvidersFromProviderAssembliesLocation(request, null, null, null, null, ProviderOption.LatestVersion).WhereNotNull().ToArray();
@@ -1023,7 +1024,7 @@ namespace Microsoft.PackageManagement.Internal.Implementation {
request.Debug(ex.Message);
}
return Enumerable.Empty<string>();
*/
#endif
}
/// <summary>
+1 -1
View File
@@ -49,7 +49,7 @@
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ],
"define": [ "CORECLR", "PORTABLE" ],
"compile": {
"exclude": [ "Providers/Inbox/Common/*" ]
}
+2 -2
View File
@@ -4,18 +4,18 @@
"monad/miscfiles/modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1": "Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1",
"monad/miscfiles/modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1": "Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1",
"monad/miscfiles/modules/PSDiagnostics/PSDiagnostics.psm1": "PSDiagnostics/PSDiagnostics.psm1",
"monad/miscfiles/modules/PSGet/PSGet.psd1": "PowerShellGet/PowerShellGet.psd1",
"monad/miscfiles/modules/AppxProvider/AppxProvider.psm1": "AppxProvider/AppxProvider.psm1",
"monad/miscfiles/modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1": "Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1": "Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1",
"monad/miscfiles/modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1": "Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Archive/ArchiveResources.psd1": "Microsoft.PowerShell.Archive/ArchiveResources.psd1",
"monad/miscfiles/modules/PSGet/PSGet.psd1": "PowerShellGet/PowerShellGet.psd1",
"monad/miscfiles/modules/PSGet/PSModule.psm1": "PowerShellGet/PSModule.psm1",
"monad/miscfiles/modules/PSGet/PSGet.Format.ps1xml": "PowerShellGet/PSGet.Format.ps1xml",
"monad/miscfiles/modules/PSGet/PSGet.Resource.psd1": "PowerShellGet/PSGet.Resource.psd1",
"monad/miscfiles/modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1": "Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1",
"monad/miscfiles/modules/AppxProvider/AppxProvider.Resource.psd1": "AppxProvider/AppxProvider.Resource.psd1",
"monad/miscfiles/modules/AppxProvider/AppxProvider.psd1": "AppxProvider/AppxProvider.psd1",
"monad/miscfiles/modules/PSGet/PSGet.Resource.psd1": "PowerShellGet/PSGet.Resource.psd1",
"monad/src/LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1": "Microsoft.PowerShell.LocalAccounts/Microsoft.PowerShell.LocalAccounts.psd1",
"monad/src/LocalAccounts/LocalAccounts.format.ps1xml": "Microsoft.PowerShell.LocalAccounts/LocalAccounts.format.ps1xml",
"monad/src/oneget/PowerShell.Module/PackageManagement.psd1": "PackageManagement/PackageManagement.psd1",