diff options
author | David Karlaš <david.karlas@xamarin.com> | 2015-11-24 20:46:28 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2015-11-24 20:46:28 +0300 |
commit | fdcef13057a9c4a9bc924602c9b2b33c1da3bf63 (patch) | |
tree | f5d45bca682a39c3946dbd9fee281e152288a4aa /main/src/addins/MonoDevelop.PackageManagement | |
parent | ee4190106f0d102c4fdce57fc3c5637cbce7b9aa (diff) | |
parent | 07a993cf6d80660fde31099c1aca8029a3035807 (diff) |
Merge branch 'master' into newExceptionDialog
Diffstat (limited to 'main/src/addins/MonoDevelop.PackageManagement')
26 files changed, 225 insertions, 563 deletions
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs index 1177b4d023..4a9a933c57 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs @@ -113,7 +113,7 @@ namespace MonoDevelop.PackageManagement.Commands try {
PackageManagementServices.UpdatedPackagesInSolution.CheckForUpdates ();
} catch (Exception ex) {
- LoggingService.LogInternalError ("Check for NuGet package updates error.", ex);
+ LoggingService.LogError ("Check for NuGet package updates error.", ex);
}
}
@@ -125,7 +125,7 @@ namespace MonoDevelop.PackageManagement.Commands e.Cancel = true;
}
} catch (Exception ex) {
- LoggingService.LogInternalError (ex);
+ LoggingService.LogError ("Error on unloading workspace item.", ex);
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs index 1a22b06d86..7ebab31800 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakePackage.cs @@ -231,6 +231,15 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers public bool DevelopmentDependency { get; set; }
public bool IsValid { get; set; }
+
+ public IFileSystem FileSystemPassedToExtractContents;
+ public string ExtractPathPassedToExtractContents;
+
+ public void ExtractContents (IFileSystem fileSystem, string extractPath)
+ {
+ FileSystemPassedToExtractContents = fileSystem;
+ ExtractPathPassedToExtractContents = extractPath;
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs index 769caa8028..24b3593320 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/FakeSettings.cs @@ -83,30 +83,30 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers PackageSources.Add (valuePair);
}
- public Dictionary<string, KeyValuePair<string, string>> SavedSectionValues =
- new Dictionary<string, KeyValuePair<string, string>> ();
+ public Dictionary<string, SettingValue> SavedSectionValues =
+ new Dictionary<string, SettingValue> ();
public void SetValue (string section, string key, string value)
{
SavedSectionValues.Remove (section);
- SavedSectionValues.Add (section, new KeyValuePair<string, string> (key, value));
+ SavedSectionValues.Add (section, new SettingValue (key, value, false));
}
- public KeyValuePair<string, string> GetValuePassedToSetValueForActivePackageSourceSection ()
+ public SettingValue GetValuePassedToSetValueForActivePackageSourceSection ()
{
return SavedSectionValues [RegisteredPackageSourceSettings.ActivePackageSourceSectionName];
}
- public void SetValues (string section, IList<KeyValuePair<string, string>> values)
+ public void SetValues (string section, IList<SettingValue> values)
{
SavedSectionValueLists.Remove (section);
SavedSectionValueLists.Add (section, values);
}
- public Dictionary<string, IList<KeyValuePair<string, string>>> SavedSectionValueLists
- = new Dictionary<string, IList<KeyValuePair<string, string>>> ();
+ public Dictionary<string, IList<SettingValue>> SavedSectionValueLists
+ = new Dictionary<string, IList<SettingValue>> ();
- public IList<KeyValuePair<string, string>> GetValuesPassedToSetValuesForPackageSourcesSection ()
+ public IList<SettingValue> GetValuesPassedToSetValuesForPackageSourcesSection ()
{
return SavedSectionValueLists [PackageSourcesSectionName];
}
@@ -184,7 +184,7 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers DisabledPackageSources.Add (setting);
}
- public IList<KeyValuePair<string, string>> GetValuesPassedToSetValuesForDisabledPackageSourcesSection ()
+ public IList<SettingValue> GetValuesPassedToSetValuesForDisabledPackageSourcesSection ()
{
return SavedSectionValueLists [DisabledPackageSourcesSectionName];
}
@@ -202,7 +202,7 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers Sections.Add ("packageRestore", items);
}
- public KeyValuePair<string, string> GetValuePassedToSetValueForPackageRestoreSection ()
+ public SettingValue GetValuePassedToSetValueForPackageRestoreSection ()
{
return SavedSectionValues ["packageRestore"];
}
@@ -219,6 +219,16 @@ namespace MonoDevelop.PackageManagement.Tests.Helpers items.Add (new SettingValue ("repositoryPath", fullPath, false));
Sections.Add (ConfigSectionName, items);
}
+
+ public Dictionary<string, IList<SettingValue>> SectionsUpdated =
+ new Dictionary<string, IList<SettingValue>> ();
+
+ public void UpdateSections (string section, IList<SettingValue> values)
+ {
+ SectionsUpdated.Remove (section);
+ SectionsUpdated.Add (section, values);
+ SetValues (section, values);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/TestableCheckForUpdatesTaskRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableCheckForUpdatesTaskRunner.cs index 548db011cc..6744012901 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/TestableCheckForUpdatesTaskRunner.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableCheckForUpdatesTaskRunner.cs @@ -25,36 +25,32 @@ // THE SOFTWARE.
using System;
+using System.Collections.Generic;
using ICSharpCode.PackageManagement;
using MonoDevelop.Ide;
-using MonoDevelop.PackageManagement.Tests.Helpers;
-namespace MonoDevelop.PackageManagement.Tests
+namespace MonoDevelop.PackageManagement.Tests.Helpers
{
public class TestableCheckForUpdatesTaskRunner : CheckForUpdatesTaskRunner
{
- public TestableCheckForUpdatesTaskRunner (
- ITaskFactory taskFactory,
- IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageManagementEvents)
- : base (taskFactory, progressMonitorFactory, packageManagementEvents)
- {
- }
+ public List<string> LoggedErrorMessages = new List<string> ();
+ public List<Exception> LoggedExceptions = new List<Exception> ();
- protected override CheckForUpdatesProgressMonitor CreateProgressMonitor (
- IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageManagementEvents)
+ public TestableCheckForUpdatesTaskRunner (ITaskFactory taskFactory)
+ : base (taskFactory)
{
- ProgressMonitorCreated = new TestableCheckForUpdatesProgressMonitor (progressMonitorFactory, packageManagementEvents);
- return ProgressMonitorCreated;
}
- public TestableCheckForUpdatesProgressMonitor ProgressMonitorCreated { get; set; }
-
protected override void GuiBackgroundDispatch (MessageHandler handler)
{
handler.Invoke ();
}
+
+ protected override void LogError (string message, Exception ex)
+ {
+ LoggedErrorMessages.Add (message);
+ LoggedExceptions.Add (ex);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj index ec5a0df98e..71f6d04262 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj @@ -42,6 +42,7 @@ <OutputPath>..\..\..\..\build\tests</OutputPath> <DebugSymbols>true</DebugSymbols> <DebugType>pdbonly</DebugType> + <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> </PropertyGroup> <ItemGroup> <Reference Include="System" /> @@ -204,14 +205,13 @@ <Compile Include="MonoDevelop.PackageManagement.Tests\MSBuildTargetsRestoredMonitorTests.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests\EnsureNuGetPackageBuildImportsTargetUpdaterTests.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\ExceptionThrowingSolutionPackageRepository.cs" /> - <Compile Include="MonoDevelop.PackageManagement.Tests\CheckForUpdatesProgressMonitorTests.cs" /> - <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableCheckForUpdatesProgressMonitor.cs" /> - <Compile Include="MonoDevelop.PackageManagement.Tests\TestableCheckForUpdatesTaskRunner.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests\OpenPackageReadMeMonitorTests.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableInstallPackageAction.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableUpdatePackageAction.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests\FilePathExtensionsTests.cs" /> <Compile Include="MonoDevelop.PackageManagement.Tests\DotNetProjectExtensionsTests.cs" /> + <Compile Include="MonoDevelop.PackageManagement.Tests.Helpers\TestableCheckForUpdatesTaskRunner.cs" /> + <Compile Include="MonoDevelop.PackageManagement.Tests\MinClientVersionTests.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj"> diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/CheckForUpdatesProgressMonitorTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/CheckForUpdatesProgressMonitorTests.cs deleted file mode 100644 index 56abc52484..0000000000 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/CheckForUpdatesProgressMonitorTests.cs +++ /dev/null @@ -1,148 +0,0 @@ -//
-// CheckForUpdatesProgressMonitorTests.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using NUnit.Framework;
-using MonoDevelop.PackageManagement.Tests.Helpers;
-using MonoDevelop.Core;
-using ICSharpCode.PackageManagement;
-using NuGet;
-
-namespace MonoDevelop.PackageManagement.Tests
-{
- [TestFixture]
- public class CheckForUpdatesProgressMonitorTests
- {
- TestableCheckForUpdatesProgressMonitor progressMonitor;
- FakeProgressMonitorFactory progressMonitorFactory;
- FakeProgressMonitor fakeProgressMonitor;
- PackageManagementEvents packageEvents;
-
- void CreateProgressMonitor ()
- {
- progressMonitorFactory = new FakeProgressMonitorFactory ();
- fakeProgressMonitor = progressMonitorFactory.ProgressMonitor;
- packageEvents = new PackageManagementEvents ();
- progressMonitor = new TestableCheckForUpdatesProgressMonitor (progressMonitorFactory, packageEvents);
- }
-
- [Test]
- public void Constructor_NewInstance_CreatesProgressMonitor ()
- {
- CreateProgressMonitor ();
-
- Assert.AreEqual (GettextCatalog.GetString ("Checking for package updates..."), progressMonitorFactory.StatusText);
- }
-
- [Test]
- public void Dispose_NewInstance_ProgressMonitorIsDisposed ()
- {
- CreateProgressMonitor ();
-
- progressMonitor.Dispose ();
-
- Assert.IsTrue (fakeProgressMonitor.IsDisposed);
- }
-
- [Test]
- public void Constructor_PackageManagementMessageEventFired_MessageLoggedToProgressMonitor ()
- {
- CreateProgressMonitor ();
-
- packageEvents.OnPackageOperationMessageLogged (MessageLevel.Info, "MyMessage");
-
- fakeProgressMonitor.AssertMessageIsLogged ("MyMessage");
- }
-
- [Test]
- public void Dispose_MessageLoggedAfterDispose_MessageNotLoggedToProgressMonitor ()
- {
- CreateProgressMonitor ();
- progressMonitor.Dispose ();
-
- packageEvents.OnPackageOperationMessageLogged (MessageLevel.Info, "MyMessage");
-
- fakeProgressMonitor.AssertMessageIsNotLogged ("MyMessage");
- }
-
- [Test]
- public void ReportError_ReportException_ExceptionReportedToProgressMonitor ()
- {
- CreateProgressMonitor ();
- var exception = new Exception ("Error");
-
- progressMonitor.ReportError (exception);
-
- fakeProgressMonitor.AssertMessageIsLogged ("Error");
- Assert.AreEqual (GettextCatalog.GetString ("Could not check for package updates."), fakeProgressMonitor.ReportedErrorMessage);
- Assert.IsTrue (progressMonitor.IsPackageConsoleShown);
- }
-
- [Test]
- public void ReportError_ReportDispatchServiceException_UnderlyingExceptionReported ()
- {
- CreateProgressMonitor ();
- var exception = new Exception ("Error");
- string message = "An exception was thrown while dispatching a method call in the UI thread.";
- var dispatchServiceException = new Exception (message, exception);
-
- progressMonitor.ReportError (dispatchServiceException);
-
- fakeProgressMonitor.AssertMessageIsLogged ("Error");
- }
-
- [Test]
- public void ReportSuccess_UpdatesAvailable_UpdatesAvailableMessageShownByProgressMonitor ()
- {
- CreateProgressMonitor ();
-
- progressMonitor.ReportSuccess (true);
-
- Assert.AreEqual (GettextCatalog.GetString ("Package updates are available."), fakeProgressMonitor.ReportedSuccessMessage);
- }
-
- [Test]
- public void ReportSuccess_NoUpdatesAvailable_NoUpdatesAvailableMessageShownByProgressMonitor ()
- {
- CreateProgressMonitor ();
-
- progressMonitor.ReportSuccess (false);
-
- Assert.AreEqual (GettextCatalog.GetString ("Packages are up to date."), fakeProgressMonitor.ReportedSuccessMessage);
- }
-
- [Test]
- public void ReportSuccess_NoUpdatesAvailableButWarningLogged_NoUpdatesAvailableWithWarningMessageShownByProgressMonitor ()
- {
- CreateProgressMonitor ();
- packageEvents.OnPackageOperationMessageLogged (MessageLevel.Warning, "WarningMessage");
-
- progressMonitor.ReportSuccess (false);
-
- Assert.AreEqual (GettextCatalog.GetString ("No updates found but warnings were reported."), fakeProgressMonitor.ReportedWarningMessage);
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MinClientVersionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MinClientVersionTests.cs new file mode 100644 index 0000000000..4fa2b48c68 --- /dev/null +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/MinClientVersionTests.cs @@ -0,0 +1,69 @@ +//
+// MinClientVersionTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.PackageManagement.Tests.Helpers;
+using NuGet;
+using NUnit.Framework;
+
+namespace MonoDevelop.PackageManagement.Tests
+{
+ [TestFixture]
+ public class MinClientVersionTests
+ {
+ FakePackage CreatePackageWithMinClientVersion (string minClientVersion)
+ {
+ return new FakePackage ("Test", "1.0") {
+ MinClientVersion = new Version (minClientVersion)
+ };
+ }
+
+ void WalkPackage (IPackage package)
+ {
+ var localRepository = new FakePackageRepository ();
+ var sourceRepository = new FakePackageRepository ();
+ var walker = new InstallWalker (localRepository, sourceRepository, null, NullLogger.Instance, true, false, DependencyVersion.Lowest);
+ walker.Walk (package);
+ }
+
+ [Test]
+ public void MinClientVersion_MicrosoftApplicationInsights_ShouldBeSupportedByNuGet ()
+ {
+ FakePackage package = CreatePackageWithMinClientVersion ("2.8.50313");
+
+ Assert.DoesNotThrow (() => WalkPackage (package));
+ }
+
+ [Test]
+ public void MinClientVersion_VeryHighNuGetVersion_ShouldNotBeSupportedByNuGet ()
+ {
+ FakePackage package = CreatePackageWithMinClientVersion ("9999.99");
+
+ Assert.Throws<NuGetVersionNotSatisfiedException> (() => WalkPackage (package));
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs index b3ad384a74..c83b4aee72 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageFromRepositoryTests.cs @@ -462,6 +462,19 @@ namespace MonoDevelop.PackageManagement.Tests Assert.IsTrue (dependency);
}
+
+ [Test]
+ public void ExtractPath_WrappedPackage_WrappedPackageExtractContentsCalled ()
+ {
+ CreatePackage ();
+ var expectedFileSystem = new FakeFileSystem ();
+ string expectedPath = @"d:\projects\test\packages";
+
+ package.ExtractContents (expectedFileSystem, expectedPath);
+
+ Assert.AreEqual (expectedFileSystem, fakePackage.FileSystemPassedToExtractContents);
+ Assert.AreEqual (expectedPath, fakePackage.ExtractPathPassedToExtractContents);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs index f0bf3da6ca..48f81bc6d7 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/PackageManagementOptionsTests.cs @@ -179,16 +179,16 @@ namespace MonoDevelop.PackageManagement.Tests registeredPackageSources.Clear ();
registeredPackageSources.Add (packageSource);
- var expectedSavedPackageSourceSettings = new List<KeyValuePair<string, string>> ();
- expectedSavedPackageSourceSettings.Add (new KeyValuePair<string, string> ("Test", "http://codeplex.com"));
+ var expectedSavedPackageSourceSettings = new List<SettingValue> ();
+ expectedSavedPackageSourceSettings.Add (new SettingValue ("Test", "http://codeplex.com", false));
- IList<KeyValuePair<string, string>> actualSavedPackageSourceSettings = fakeSettings.GetValuesPassedToSetValuesForPackageSourcesSection ();
+ IList<SettingValue> actualSavedPackageSourceSettings = fakeSettings.GetValuesPassedToSetValuesForPackageSourcesSection ();
Assert.AreEqual (expectedSavedPackageSourceSettings, actualSavedPackageSourceSettings);
}
[Test]
- public void PackageSources_OnePackageSourceAdded_PackageSourcesSectionDeletedFromSettings ()
+ public void PackageSources_OnePackageSourceAdded_PackageSourcesSectionUpdated ()
{
CreateSettings ();
CreateOptions (fakeSettings);
@@ -198,9 +198,11 @@ namespace MonoDevelop.PackageManagement.Tests registeredPackageSources.Clear ();
registeredPackageSources.Add (packageSource);
- bool sectionDeleted = fakeSettings.IsPackageSourcesSectionDeleted;
+ IList<SettingValue> settings = fakeSettings.SectionsUpdated [RegisteredPackageSourceSettings.PackageSourcesSectionName];
- Assert.IsTrue (sectionDeleted);
+ Assert.AreEqual (1, settings.Count);
+ Assert.AreEqual ("Test", settings[0].Key);
+ Assert.AreEqual ("http://codeplex.com", settings[0].Value);
}
[Test]
@@ -230,10 +232,10 @@ namespace MonoDevelop.PackageManagement.Tests options.ActivePackageSource = packageSource;
- var expectedKeyValuePair = new KeyValuePair<string, string> ("Test", "http://sharpdevelop.com");
- KeyValuePair<string, string> actualKeyValuePair = fakeSettings.GetValuePassedToSetValueForActivePackageSourceSection ();
+ var expectedSetting = new SettingValue ("Test", "http://sharpdevelop.com", false);
+ SettingValue actualSetting = fakeSettings.GetValuePassedToSetValueForActivePackageSourceSection ();
- Assert.AreEqual (expectedKeyValuePair, actualKeyValuePair);
+ Assert.AreEqual (expectedSetting, actualSetting);
}
[Test]
@@ -395,9 +397,9 @@ namespace MonoDevelop.PackageManagement.Tests registeredPackageSources.Clear ();
registeredPackageSources.Add (packageSource);
- bool sectionDeleted = fakeSettings.IsDisabledPackageSourcesSectionDeleted;
+ IList<SettingValue> settings = fakeSettings.SectionsUpdated[RegisteredPackageSourceSettings.DisabledPackageSourceSectionName];
- Assert.IsTrue (sectionDeleted);
+ Assert.AreEqual (0, settings.Count);
}
[Test]
@@ -411,10 +413,10 @@ namespace MonoDevelop.PackageManagement.Tests registeredPackageSources.Clear ();
registeredPackageSources.Add (packageSource);
- var expectedSavedPackageSourceSettings = new List<KeyValuePair<string, string>> ();
- expectedSavedPackageSourceSettings.Add (new KeyValuePair<string, string> (packageSource.Name, "true"));
+ var expectedSavedPackageSourceSettings = new List<SettingValue> ();
+ expectedSavedPackageSourceSettings.Add (new SettingValue (packageSource.Name, "true", false));
- IList<KeyValuePair<string, string>> actualSavedPackageSourceSettings =
+ IList<SettingValue> actualSavedPackageSourceSettings =
fakeSettings.GetValuesPassedToSetValuesForDisabledPackageSourcesSection ();
Assert.AreEqual (expectedSavedPackageSourceSettings, actualSavedPackageSourceSettings);
}
@@ -430,7 +432,7 @@ namespace MonoDevelop.PackageManagement.Tests registeredPackageSources.Clear ();
registeredPackageSources.Add (packageSource);
- IList<KeyValuePair<string, string>> actualSavedPackageSourceSettings =
+ IList<SettingValue> actualSavedPackageSourceSettings =
fakeSettings.GetValuesPassedToSetValuesForDisabledPackageSourcesSection ();
Assert.AreEqual (0, actualSavedPackageSourceSettings.Count);
}
@@ -464,10 +466,10 @@ namespace MonoDevelop.PackageManagement.Tests options.IsPackageRestoreEnabled = true;
- KeyValuePair<string, string> keyPair = fakeSettings.GetValuePassedToSetValueForPackageRestoreSection ();
+ SettingValue setting = fakeSettings.GetValuePassedToSetValueForPackageRestoreSection ();
- Assert.AreEqual ("enabled", keyPair.Key);
- Assert.AreEqual ("True", keyPair.Value);
+ Assert.AreEqual ("enabled", setting.Key);
+ Assert.AreEqual ("True", setting.Value);
}
[Test]
@@ -492,8 +494,8 @@ namespace MonoDevelop.PackageManagement.Tests options.IsPackageRestoreEnabled = false;
- KeyValuePair<string, string> keyValuePair = fakeSettings.GetValuePassedToSetValueForPackageRestoreSection ();
- Assert.AreEqual ("False", keyValuePair.Value);
+ SettingValue setting = fakeSettings.GetValuePassedToSetValueForPackageRestoreSection ();
+ Assert.AreEqual ("False", setting.Value);
}
[Test]
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatedPackagesInSolutionTests.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatedPackagesInSolutionTests.cs index 0469b53d99..a67593fd7c 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatedPackagesInSolutionTests.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests/UpdatedPackagesInSolutionTests.cs @@ -54,10 +54,7 @@ namespace MonoDevelop.PackageManagement.Tests taskFactory = new FakeTaskFactory ();
taskFactory.RunTasksSynchronously = true;
progressMonitorFactory = new FakeProgressMonitorFactory ();
- checkForUpdatesTaskRunner = new TestableCheckForUpdatesTaskRunner (
- taskFactory,
- progressMonitorFactory,
- packageManagementEvents);
+ checkForUpdatesTaskRunner = new TestableCheckForUpdatesTaskRunner (taskFactory);
updatedPackagesInSolution = new TestableUpdatedPackagesInSolution (
solution,
registeredPackageRepositories,
@@ -387,61 +384,7 @@ namespace MonoDevelop.PackageManagement.Tests }
[Test]
- public void CheckForUpdates_OnePackageUpdated_ProgressMonitorCreatedAndDisposedAfterCheckForUpdatesReturned ()
- {
- CreateUpdatedPackagesInSolution ();
- taskFactory.RunTasksSynchronously = false;
- FakePackageManagementProject project = AddProjectToSolution ();
- project.AddPackageReference ("MyPackage", "1.0");
- AddUpdatedPackageToAggregateSourceRepository ("MyPackage", "1.1");
- updatedPackagesInSolution.CheckForUpdates ();
- bool progressMonitorCreated = checkForUpdatesTaskRunner.ProgressMonitorCreated != null;
- bool disposedBeforeTaskRun = progressMonitorFactory.ProgressMonitor.IsDisposed;
-
- taskFactory.ExecuteAllTasks<CheckForUpdatesTask> ();
-
- Assert.IsTrue (progressMonitorCreated);
- Assert.IsFalse (disposedBeforeTaskRun);
- Assert.IsTrue (progressMonitorFactory.ProgressMonitor.IsDisposed);
- }
-
- [Test]
- public void CheckForUpdates_OnePackageUpdatedButSolutionClosedBeforeResultsReturned_ProgressMonitorIsDisposed ()
- {
- CreateUpdatedPackagesInSolution ();
- taskFactory.RunTasksSynchronously = false;
- FakePackageManagementProject project = AddProjectToSolution ();
- project.AddPackageReference ("MyPackage", "1.0");
- AddUpdatedPackageToAggregateSourceRepository ("MyPackage", "1.1");
- updatedPackagesInSolution.CheckForUpdates ();
- bool progressMonitorCreated = checkForUpdatesTaskRunner.ProgressMonitorCreated != null;
- bool disposedBeforeTaskRun = progressMonitorFactory.ProgressMonitor.IsDisposed;
- var task = taskFactory.FakeTasksCreated [0] as FakeTask<CheckForUpdatesTask>;
- task.ExecuteTaskButNotContinueWith ();
- updatedPackagesInSolution.Clear ();
-
- task.ExecuteContinueWith ();
-
- Assert.IsTrue (progressMonitorCreated);
- Assert.IsFalse (disposedBeforeTaskRun);
- Assert.IsTrue (progressMonitorFactory.ProgressMonitor.IsDisposed);
- }
-
- [Test]
- public void CheckForUpdates_OnePackageUpdated_SuccessReportedToProgressMonitor ()
- {
- CreateUpdatedPackagesInSolution ();
- FakePackageManagementProject project = AddProjectToSolution ();
- project.AddPackageReference ("MyPackage", "1.0");
- AddUpdatedPackageToAggregateSourceRepository ("MyPackage", "1.1");
-
- updatedPackagesInSolution.CheckForUpdates ();
-
- Assert.AreEqual (GettextCatalog.GetString ("Package updates are available."), progressMonitorFactory.ProgressMonitor.ReportedSuccessMessage);
- }
-
- [Test]
- public void CheckForUpdates_NoPackagesUpdated_SuccessReportedToProgressMonitor ()
+ public void CheckForUpdates_NoPackagesUpdated_NoUpdates ()
{
CreateUpdatedPackagesInSolution ();
FakePackageManagementProject project = AddProjectToSolution ();
@@ -451,11 +394,10 @@ namespace MonoDevelop.PackageManagement.Tests UpdatedPackagesInProject updatedPackages = updatedPackagesInSolution.GetUpdatedPackages (project.Project);
Assert.IsFalse (updatedPackagesInSolution.AnyUpdates ());
- Assert.AreEqual (GettextCatalog.GetString ("Packages are up to date."), progressMonitorFactory.ProgressMonitor.ReportedSuccessMessage);
}
[Test]
- public void CheckForUpdates_ExceptionThrownWhilstCheckingForUpdates_ErrorReportedToProgressMonitorWhichIsDisposed ()
+ public void CheckForUpdates_ExceptionThrownWhilstCheckingForUpdates_ExceptionLogged ()
{
CreateUpdatedPackagesInSolution ();
taskFactory.RunTasksSynchronously = false;
@@ -471,14 +413,12 @@ namespace MonoDevelop.PackageManagement.Tests task.Result = null;
task.ExecuteContinueWith ();
- Assert.AreEqual (GettextCatalog.GetString ("Could not check for package updates."), progressMonitorFactory.ProgressMonitor.ReportedErrorMessage);
- Assert.IsTrue (checkForUpdatesTaskRunner.ProgressMonitorCreated.IsPackageConsoleShown);
- progressMonitorFactory.ProgressMonitor.AssertMessageIsLogged ("Inner exception error message");
- Assert.IsTrue (progressMonitorFactory.ProgressMonitor.IsDisposed);
+ Assert.AreEqual ("Current check for updates task error.", checkForUpdatesTaskRunner.LoggedErrorMessages[0]);
+ Assert.AreEqual (task.Exception, checkForUpdatesTaskRunner.LoggedExceptions[0]);
}
[Test]
- public void CheckForUpdates_ExceptionThrownWhilstCheckingForUpdatesButSolutionClosedBeforeCheckForUpdatesReturns_ErrorIsNotReportedButProgressMonitorIsDisposed ()
+ public void CheckForUpdates_ExceptionThrownWhilstCheckingForUpdatesButSolutionClosedBeforeCheckForUpdatesReturns_ErrorIsLogged ()
{
CreateUpdatedPackagesInSolution ();
taskFactory.RunTasksSynchronously = false;
@@ -494,13 +434,12 @@ namespace MonoDevelop.PackageManagement.Tests task.Result = null;
task.ExecuteContinueWith ();
- Assert.IsNull (progressMonitorFactory.ProgressMonitor.ReportedErrorMessage);
- progressMonitorFactory.ProgressMonitor.AssertMessageIsNotLogged ("Error message");
- Assert.IsTrue (progressMonitorFactory.ProgressMonitor.IsDisposed);
+ Assert.AreEqual ("Check for updates task error.", checkForUpdatesTaskRunner.LoggedErrorMessages[0]);
+ Assert.AreEqual (task.Exception, checkForUpdatesTaskRunner.LoggedExceptions[0]);
}
[Test]
- public void CheckForUpdates_ExceptionThrownWhilstCheckingForUpdatesButSolutionClosedBeforeCheckForUpdatesReturnsAndSecondCheckForUpdatesIsStarted_ErrorIsNotReported ()
+ public void CheckForUpdates_ExceptionThrownWhilstCheckingForUpdatesButSolutionClosedBeforeCheckForUpdatesReturnsAndSecondCheckForUpdatesIsStarted_ErrorIsLogged ()
{
CreateUpdatedPackagesInSolution ();
taskFactory.RunTasksSynchronously = false;
@@ -516,9 +455,8 @@ namespace MonoDevelop.PackageManagement.Tests task.Result = null;
task.ExecuteContinueWith ();
- Assert.IsNull (progressMonitorFactory.ProgressMonitor.ReportedErrorMessage);
- progressMonitorFactory.ProgressMonitor.AssertMessageIsNotLogged ("Error message");
- Assert.IsTrue (progressMonitorFactory.ProgressMonitor.IsDisposed);
+ Assert.AreEqual ("Check for updates task error.", checkForUpdatesTaskRunner.LoggedErrorMessages[0]);
+ Assert.AreEqual (task.Exception, checkForUpdatesTaskRunner.LoggedExceptions[0]);
}
[Test]
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj index 111d26d622..e1673e7ae1 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj @@ -46,6 +46,7 @@ <OutputPath>..\..\..\build\AddIns\MonoDevelop.PackageManagement</OutputPath> <DebugSymbols>true</DebugSymbols> <DebugType>pdbonly</DebugType> + <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> </PropertyGroup> <ItemGroup> <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> @@ -342,7 +343,6 @@ <Compile Include="MonoDevelop.PackageManagement\IUpdatedPackagesInSolution.cs" /> <Compile Include="MonoDevelop.PackageManagement\FallbackRepository.cs" /> <Compile Include="MonoDevelop.PackageManagement.Commands\PackageManagementStartupHandler.cs" /> - <Compile Include="MonoDevelop.PackageManagement\PackageUpdatesEventMonitor.cs" /> <Compile Include="MonoDevelop.PackageManagement\UpdatedPackagesMonitor.cs" /> <Compile Include="MonoDevelop.PackageManagement\UpdatePackagesProgressMonitorStatusMessage.cs" /> <Compile Include="MonoDevelop.PackageManagement\CheckForUpdatedPackagesAction.cs" /> @@ -364,13 +364,13 @@ <Compile Include="MonoDevelop.PackageManagement\MSBuildTargetsRestoredMonitor.cs" /> <Compile Include="MonoDevelop.PackageManagement\PackageManagementMSBuildExtension.cs" /> <Compile Include="MonoDevelop.PackageManagement\EnsureNuGetPackageBuildImportsTargetUpdater.cs" /> - <Compile Include="MonoDevelop.PackageManagement\CheckForUpdatesProgressMonitor.cs" /> <Compile Include="MonoDevelop.PackageManagement\CheckForUpdatesTaskRunner.cs" /> <Compile Include="MonoDevelop.PackageManagement\CheckForUpdatesTask.cs" /> <Compile Include="MonoDevelop.PackageManagement\ProjectReloadedEventArgs.cs" /> <Compile Include="MonoDevelop.PackageManagement\OpenPackageReadmeMonitor.cs" /> <Compile Include="MonoDevelop.PackageManagement\IOpenPackageReadMeMonitor.cs" /> <Compile Include="MonoDevelop.PackageManagement\NullOpenPackageReadMeMonitor.cs" /> + <Compile Include="MonoDevelop.PackageManagement\PackageManagementSolutionExtensions.cs" /> <Compile Include="MonoDevelop.PackageManagement\DotNetProjectReferenceEventArgs.cs" /> <Compile Include="MonoDevelop.PackageManagement\LocalCopyReferenceMaintainer.cs" /> <Compile Include="MonoDevelop.PackageManagement\DotNetSolutionEventArgs.cs" /> diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs index fbe1ad52f9..258e102084 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/BackgroundPackageActionRunner.cs @@ -210,7 +210,7 @@ namespace MonoDevelop.PackageManagement public void ShowError (ProgressMonitorStatusMessage progressMessage, Exception exception)
{
- LoggingService.LogInternalError (progressMessage.Status, exception);
+ LoggingService.LogError (progressMessage.Error, exception);
ShowError (progressMessage, exception.Message);
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesProgressMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesProgressMonitor.cs deleted file mode 100644 index dbcb6fe501..0000000000 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesProgressMonitor.cs +++ /dev/null @@ -1,104 +0,0 @@ -//
-// CheckForUpdatesProgressMonitor.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using ICSharpCode.PackageManagement;
-using MonoDevelop.Core;
-
-namespace MonoDevelop.PackageManagement
-{
- public class CheckForUpdatesProgressMonitor : IDisposable
- {
- ProgressMonitorStatusMessage progressMessage;
- IProgressMonitor progressMonitor;
- PackageUpdatesEventMonitor eventMonitor;
-
- public CheckForUpdatesProgressMonitor ()
- : this (
- PackageManagementServices.ProgressMonitorFactory,
- PackageManagementServices.PackageManagementEvents)
- {
- }
-
- public CheckForUpdatesProgressMonitor (
- IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageEvents)
- {
- progressMessage = ProgressMonitorStatusMessageFactory.CreateCheckingForPackageUpdatesMessage ();
- this.progressMonitor = progressMonitorFactory.CreateProgressMonitor (progressMessage.Status);
-
- eventMonitor = new PackageUpdatesEventMonitor (progressMonitor, packageEvents);
- }
-
- public void Dispose ()
- {
- eventMonitor.Dispose ();
- progressMonitor.Dispose ();
- }
-
- public void ReportError (Exception ex)
- {
- LoggingService.LogInternalError (ex);
- if (IsGuiDispatchException (ex)) {
- progressMonitor.Log.WriteLine (ex.InnerException.Message);
- } else if (ex is AggregateException) {
- LogAggregateException ((AggregateException)ex);
- } else {
- progressMonitor.Log.WriteLine (ex.Message);
- }
- progressMonitor.ReportError (progressMessage.Error, null);
- ShowPackageConsole ();
- }
-
- static bool IsGuiDispatchException (Exception ex)
- {
- return (ex.InnerException != null) &&
- (ex.Message == "An exception was thrown while dispatching a method call in the UI thread.");
- }
-
- void LogAggregateException (AggregateException ex)
- {
- progressMonitor.Log.WriteLine (new AggregateExceptionErrorMessage (ex));
- }
-
- protected virtual void ShowPackageConsole ()
- {
- progressMonitor.ShowPackageConsole ();
- }
-
- public void ReportSuccess (bool anyUpdates)
- {
- if (anyUpdates) {
- progressMonitor.ReportSuccess (GettextCatalog.GetString ("Package updates are available."));
- } else if (eventMonitor.WarningReported) {
- progressMonitor.ReportWarning (progressMessage.Warning);
- } else {
- progressMonitor.ReportSuccess (progressMessage.Success);
- }
- }
- }
-}
-
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs index 45d7c73716..d59e6517f8 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs @@ -65,7 +65,6 @@ namespace MonoDevelop.PackageManagement public void CheckForUpdatesCompleted ()
{
- ProgressMonitor.ReportSuccess (projectsWithUpdatedPackages.Any ());
updatedPackagesInSolution.CheckForUpdatesCompleted (this);
}
@@ -73,23 +72,12 @@ namespace MonoDevelop.PackageManagement get { return projectsWithUpdatedPackages; }
}
- public CheckForUpdatesProgressMonitor ProgressMonitor { get; set; }
-
public void Dispose ()
{
if (!disposed) {
disposed = true;
- if (ProgressMonitor != null) {
- ProgressMonitor.Dispose ();
- ProgressMonitor = null;
- }
}
}
-
- public void ReportError (Exception ex)
- {
- ProgressMonitor.ReportError (ex);
- }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTaskRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTaskRunner.cs index 0a01ea6163..c323d30246 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTaskRunner.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTaskRunner.cs @@ -25,7 +25,6 @@ // THE SOFTWARE.
using System;
-using System.Collections.Generic;
using ICSharpCode.PackageManagement;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -35,26 +34,16 @@ namespace MonoDevelop.PackageManagement public class CheckForUpdatesTaskRunner : IDisposable
{
ITaskFactory taskFactory;
- IPackageManagementProgressMonitorFactory progressMonitorFactory;
- IPackageManagementEvents packageManagementEvents;
CheckForUpdatesTask currentCheckForUpdatesTask;
ITask<CheckForUpdatesTask> task;
- public CheckForUpdatesTaskRunner (
- ITaskFactory taskFactory,
- IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageManagementEvents)
+ public CheckForUpdatesTaskRunner (ITaskFactory taskFactory)
{
this.taskFactory = taskFactory;
- this.progressMonitorFactory = progressMonitorFactory;
- this.packageManagementEvents = packageManagementEvents;
}
public CheckForUpdatesTaskRunner ()
- : this (
- new PackageManagementTaskFactory (),
- PackageManagementServices.ProgressMonitorFactory,
- PackageManagementServices.PackageManagementEvents)
+ : this (new PackageManagementTaskFactory ())
{
}
@@ -74,7 +63,6 @@ namespace MonoDevelop.PackageManagement void CreateCheckForUpdatesTask (CheckForUpdatesTask checkForUpdatesTask)
{
currentCheckForUpdatesTask = checkForUpdatesTask;
- checkForUpdatesTask.ProgressMonitor = CreateProgressMonitor ();
task = taskFactory.CreateTask (
() => CheckForUpdates (checkForUpdatesTask),
@@ -108,9 +96,9 @@ namespace MonoDevelop.PackageManagement {
if (task.IsFaulted) {
if (IsCurrentTask (task)) {
- ReportError (task.Exception);
+ LogError ("Current check for updates task error.", task.Exception);
} else {
- LoggingService.LogInternalError ("Check for updates task error.", task.Exception);
+ LogError ("Check for updates task error.", task.Exception);
}
} else if (task.IsCancelled) {
// Ignore.
@@ -134,13 +122,9 @@ namespace MonoDevelop.PackageManagement return currentCheckForUpdatesTask == task;
}
- void ReportError (Exception ex)
+ protected virtual void LogError (string message, Exception ex)
{
- CheckForUpdatesTask task = currentCheckForUpdatesTask;
- task.ReportError (ex);
- GuiBackgroundDispatch (() => {
- task.Dispose ();
- });
+ LoggingService.LogError (message, ex);
}
bool IsCurrentTask (ITask<CheckForUpdatesTask> taskToCompare)
@@ -148,18 +132,6 @@ namespace MonoDevelop.PackageManagement return taskToCompare == task;
}
- CheckForUpdatesProgressMonitor CreateProgressMonitor ()
- {
- return CreateProgressMonitor (progressMonitorFactory, packageManagementEvents);
- }
-
- protected virtual CheckForUpdatesProgressMonitor CreateProgressMonitor (
- IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageManagementEvents)
- {
- return new CheckForUpdatesProgressMonitor (progressMonitorFactory, packageManagementEvents);
- }
-
protected virtual void GuiBackgroundDispatch (MessageHandler handler)
{
DispatchService.BackgroundDispatch (handler);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageFromRepository.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageFromRepository.cs index 56a5227376..f597c22480 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageFromRepository.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageFromRepository.cs @@ -231,5 +231,10 @@ namespace ICSharpCode.PackageManagement return true;
}
}
+
+ public void ExtractContents (IFileSystem fileSystem, string extractPath)
+ {
+ package.ExtractContents (fileSystem, extractPath);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs index 5e8ec633b8..a6130d65f7 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementEventsMonitor.cs @@ -192,7 +192,7 @@ namespace MonoDevelop.PackageManagement public void ReportError (ProgressMonitorStatusMessage progressMessage, Exception ex)
{
- LoggingService.LogInternalError (ex);
+ LoggingService.LogError (progressMessage.Error, ex);
progressMonitor.Log.WriteLine (ex.Message);
progressMonitor.ReportError (progressMessage.Error, null);
ShowPackageConsole (progressMonitor);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs index ccf2cb438c..f07f6e48b2 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementServices.cs @@ -100,7 +100,7 @@ namespace ICSharpCode.PackageManagement try {
return Settings.LoadDefaultSettings (null, null, null);
} catch (Exception ex) {
- LoggingService.LogInternalError ("Unable to load NuGet.Config.", ex);
+ LoggingService.LogError ("Unable to load NuGet.Config.", ex);
}
return NullSettings.Instance;
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableCheckForUpdatesProgressMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolutionExtensions.cs index d35e6aefe5..4f9ef87876 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.Helpers/TestableCheckForUpdatesProgressMonitor.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementSolutionExtensions.cs @@ -1,49 +1,43 @@ -//
-// TestableCheckForUpdatesProgressMonitor.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using ICSharpCode.PackageManagement;
-
-namespace MonoDevelop.PackageManagement.Tests.Helpers
-{
- public class TestableCheckForUpdatesProgressMonitor : CheckForUpdatesProgressMonitor
- {
- public TestableCheckForUpdatesProgressMonitor (
- IPackageManagementProgressMonitorFactory progressMonitorFactory,
- IPackageManagementEvents packageEvents)
- : base (progressMonitorFactory, packageEvents)
- {
- }
-
- public bool IsPackageConsoleShown;
-
- protected override void ShowPackageConsole ()
- {
- IsPackageConsoleShown = true;
- }
- }
-}
-
+// +// PackageManagementSolutionExtensions.cs +// +// Author: +// Matt Ward <matt.ward@xamarin.com> +// +// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using MonoDevelop.PackageManagement; +using MonoDevelop.Projects; + +namespace ICSharpCode.PackageManagement +{ + public static class PackageManagementSolutionExtensions + { + public static IPackageManagementProject GetProject (this IPackageManagementSolution solution, DotNetProject project) + { + var projectProxy = new DotNetProjectProxy (project); + var repository = PackageManagementServices.PackageRepositoryCache.CreateAggregateWithPriorityMachineCacheRepository (); + return solution.GetProject (repository, projectProxy); + } + } +} + diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs index 2dd4d79a71..0b905a25cb 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestoreRunner.cs @@ -82,7 +82,7 @@ namespace MonoDevelop.PackageManagement try {
RestorePackages (progressMonitor, progressMessage);
} catch (Exception ex) {
- LoggingService.LogInternalError (ex);
+ LoggingService.LogError (progressMessage.Error, ex);
progressMonitor.Log.WriteLine (ex.Message);
progressMonitor.ReportError (progressMessage.Error, null);
progressMonitor.ShowPackageConsole ();
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestorer.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestorer.cs index 912e981ecc..f13c9f3fb3 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestorer.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageRestorer.cs @@ -77,7 +77,7 @@ namespace MonoDevelop.PackageManagement RestoreWithProgressMonitor (progressMessage);
}
} catch (Exception ex) {
- LoggingService.LogInternalError (ex);
+ LoggingService.LogError ("Package restore failed", ex);
RestoreFailed = true;
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageUpdatesEventMonitor.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageUpdatesEventMonitor.cs deleted file mode 100644 index cfb21f91da..0000000000 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageUpdatesEventMonitor.cs +++ /dev/null @@ -1,73 +0,0 @@ -//
-// PackageUpdatesEventMonitor.cs
-//
-// Author:
-// Matt Ward <matt.ward@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using ICSharpCode.PackageManagement;
-using MonoDevelop.Core;
-using NuGet;
-
-namespace MonoDevelop.PackageManagement
-{
- public class PackageUpdatesEventMonitor : IDisposable
- {
- IPackageManagementEvents packageEvents;
- IProgressMonitor progressMonitor;
-
- public PackageUpdatesEventMonitor (IProgressMonitor progressMonitor)
- : this (
- progressMonitor,
- PackageManagementServices.PackageManagementEvents)
- {
- }
-
- public PackageUpdatesEventMonitor (
- IProgressMonitor progressMonitor,
- IPackageManagementEvents packageEvents)
- {
- this.progressMonitor = progressMonitor;
- this.packageEvents = packageEvents;
-
- packageEvents.PackageOperationMessageLogged += PackageOperationMessageLogged;
- }
-
- void PackageOperationMessageLogged (object sender, PackageOperationMessageLoggedEventArgs e)
- {
- progressMonitor.Log.WriteLine (e.Message.ToString ());
-
- if (e.Message.Level == MessageLevel.Warning) {
- WarningReported = true;
- }
- }
-
- public void Dispose ()
- {
- packageEvents.PackageOperationMessageLogged -= PackageOperationMessageLogged;
- }
-
- public bool WarningReported { get; private set; }
- }
-}
-
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageOperationsAction.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageOperationsAction.cs index cf75931581..6cb5f30fb4 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageOperationsAction.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProcessPackageOperationsAction.cs @@ -28,9 +28,7 @@ using System.Collections.Generic;
using System.Linq;
-using MonoDevelop.PackageManagement;
using NuGet;
-using MonoDevelop.PackageManagement;
namespace ICSharpCode.PackageManagement
{
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorStatusMessageFactory.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorStatusMessageFactory.cs index 6bc99bf3f8..6c42dbef5f 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorStatusMessageFactory.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorStatusMessageFactory.cs @@ -213,15 +213,6 @@ namespace MonoDevelop.PackageManagement );
}
- public static ProgressMonitorStatusMessage CreateCheckingForPackageUpdatesMessage ()
- {
- return new ProgressMonitorStatusMessage (
- GetString ("Checking for package updates..."),
- GetString ("Packages are up to date."),
- GetString ("Could not check for package updates."),
- GetString ("No updates found but warnings were reported."));
- }
-
static string GetString (string phrase)
{
return GettextCatalog.GetString (phrase);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs index 8369605e22..1986fcc729 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/RegisteredPackageSourceSettings.cs @@ -39,7 +39,9 @@ namespace ICSharpCode.PackageManagement {
public class RegisteredPackageSourceSettings
{
+ public static readonly string PackageSourcesSectionName = "packageSources";
public static readonly string ActivePackageSourceSectionName = "activePackageSource";
+ public static readonly string DisabledPackageSourceSectionName = "disabledPackageSources";
public static readonly PackageSource AggregatePackageSource =
new PackageSource("(Aggregate source)", "All");
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs index 2488c558da..7f89c7f8bb 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/SettingsProvider.cs @@ -66,7 +66,7 @@ namespace MonoDevelop.PackageManagement try {
return LoadSettings (GetSolutionDirectory ());
} catch (Exception ex) {
- LoggingService.LogInternalError ("Unable to load NuGet.Config file.", ex);
+ LoggingService.LogError ("Unable to load NuGet.Config file.", ex);
}
return NullSettings.Instance;
}
|