Browse files

Fixes all tests with semver implementaiton

  • Loading branch information...
1 parent 741f4eb commit 44acda1574429bf7e849cab1775cda2c9994c7e0 @serialseb serialseb committed Feb 13, 2012
Showing with 1,378 additions and 480 deletions.
  1. +1 −0 build/common.project.properties
  2. +16 −4 openwrap.wrapdesc
  3. +6 −6 src/CommonProperties.cs
  4. +0 −1 src/OpenRasta.Client/Properties/AssemblyInfo.cs
  5. +0 −1 src/OpenWrap.Build.Bootstrap/Properties/AssemblyInfo.cs
  6. +2 −2 src/OpenWrap.Build.Tasks/OpenWrap.CSharp.targets
  7. +1 −2 src/OpenWrap.Build.Tasks/Properties/AssemblyInfo.cs
  8. +1 −2 src/OpenWrap.Commands/Properties/AssemblyInfo.cs
  9. +1 −1 src/OpenWrap.Commands/Wrap/AddWrapCommand.cs
  10. +1 −1 src/OpenWrap.Hooks/Properties/AssemblyInfo.cs
  11. +0 −1 src/OpenWrap.ReSharper.450/Properties/AssemblyInfo.cs
  12. +1 −1 src/OpenWrap.ReSharper.500/Properties/AssemblyInfo.cs
  13. +1 −1 src/OpenWrap.ReSharper.510/Properties/AssemblyInfo.cs
  14. +1 −1 src/OpenWrap.ReSharper.600/Properties/AssemblyInfo.cs
  15. +1 −1 src/OpenWrap.ReSharper.610/Properties/AssemblyInfo.cs
  16. +0 −1 src/OpenWrap.Testing/Properties/AssemblyInfo.cs
  17. +22 −0 src/OpenWrap.Tests/Build/assembly_info/assembly_file_version.cs
  18. +22 −0 src/OpenWrap.Tests/Build/assembly_info/assembly_version.cs
  19. +23 −0 src/OpenWrap.Tests/Build/assembly_info/author.cs
  20. +43 −0 src/OpenWrap.Tests/Build/assembly_info/context_assembly_info.cs
  21. +21 −0 src/OpenWrap.Tests/Build/assembly_info/copyright.cs
  22. +2 −122 src/OpenWrap.Tests/Build/assembly_info/none.cs
  23. +21 −0 src/OpenWrap.Tests/Build/assembly_info/title.cs
  24. +1 −1 src/OpenWrap.Tests/Dependencies/trees/resolvig_package_existing_in_local_and_remote.cs
  25. +1 −1 ...nWrap.Tests/Dependencies/trees/resolving_latest_package_in_system_with_outdated_remote_version.cs
  26. +1 −1 src/OpenWrap.Tests/Dependencies/trees/resolving_package_from_remote_repository.cs
  27. +1 −1 src/OpenWrap.Tests/Dependencies/trees/resolving_package_from_system_repository.cs
  28. +1 −1 src/OpenWrap.Tests/Dependencies/trees/resolving_sub_builds_from_current_directory.cs
  29. +0 −1 src/OpenWrap.Tests/Properties/AssemblyInfo.cs
  30. +2 −2 src/OpenWrap.Tests/Repositories/indexed_http/reading_the_dynamicproxy_package.cs
  31. +1 −1 src/OpenWrap.Tests/Repositories/manager/all_configured_remotes.cs
  32. +6 −7 src/OpenWrap.Tests/Repositories/manager/repositories_with_authentication.cs
  33. +1 −1 src/OpenWrap.Tests/Repositories/manager/repositories_with_authentication_without_auth_support.cs
  34. +2 −1 src/OpenWrap.Tests/Repositories/when_nuking_a_package.cs
  35. +1 −0 src/OpenWrap.Tests/Repositories/when_publishing_a_package.cs
  36. +514 −0 src/OpenWrap.Tests/Settings.StyleCop
  37. +6 −0 src/OpenWrap.Tests/Tests.csproj
  38. +5 −5 src/OpenWrap.Tests/openwrap_context.cs
  39. +1 −1 src/OpenWrap.VisualStudio.Shared/Properties/AssemblyInfo.cs
  40. +0 −1 src/OpenWrap.VisualStudio.SolutionAddIn/Properties/AssemblyInfo.cs
  41. +1 −1 src/OpenWrap.VisualStudio.SolutionPlugins/Properties/AssemblyInfo.cs
  42. +0 −1 src/OpenWrap.Windows/Properties/AssemblyInfo.cs
  43. +19 −17 src/OpenWrap/Build/AssemblyInfoGenerator.cs
  44. +4 −0 src/OpenWrap/Collections/EnumerableExtensions.cs
  45. +7 −0 src/OpenWrap/DictionaryExtensions.cs
  46. +3 −1 src/OpenWrap/IO/Packaging/Packager.cs
  47. +4 −2 src/OpenWrap/OpenWrap.csproj
  48. +10 −8 src/OpenWrap/PackageManagement/DefaultPackageManager.cs
  49. +5 −2 src/OpenWrap/PackageManagement/DependencyResolvers/DependencyResolutionResult.cs
  50. +1 −0 src/OpenWrap/PackageManagement/DependencyResolvers/DependencyVisitor.cs
  51. +212 −5 src/OpenWrap/PackageManagement/DependencyResolvers/DependencyVisitor2.cs
  52. +51 −0 src/OpenWrap/PackageManagement/DependencyResolvers/ExhaustiveResolver.cs
  53. +4 −4 src/OpenWrap/PackageManagement/DependencyResolvers/PackageSelectionContext.cs
  54. +1 −0 src/OpenWrap/PackageManagement/Packages/InMemoryPackage.cs
  55. +13 −12 src/OpenWrap/PackageManagement/Packages/UncompressedPackage.cs
  56. +16 −33 src/OpenWrap/PackageManagement/Packages/ZipFilePackage.cs
  57. +0 −93 src/OpenWrap/PackageModel/DefaultPackageInfo.cs
  58. +1 −1 src/OpenWrap/PackageModel/IPackageDescriptor.cs
  59. +4 −2 src/OpenWrap/PackageModel/IPackageInfo.cs
  60. +29 −9 src/OpenWrap/PackageModel/PackageDescriptor.cs
  61. +1 −1 src/OpenWrap/PackageModel/Parsers/SingleDateTimeOffsetValue.cs
  62. +37 −0 src/OpenWrap/PackageModel/Parsers/SingleSemanticVersionValue.cs
  63. +0 −21 src/OpenWrap/PackageModel/Parsers/SingleVersionValue.cs
  64. +3 −4 src/OpenWrap/PackageModel/ScopedPackageDescriptor.cs
  65. +1 −2 src/OpenWrap/Properties/AssemblyInfo.cs
  66. +2 −1 src/OpenWrap/Repositories/DefaultRemoteManager.cs
  67. +5 −2 src/OpenWrap/Repositories/FileSystem/FileSystemNavigator.cs
  68. +5 −0 src/OpenWrap/Repositories/Http/HttpRepositoryNavigator.cs
  69. +5 −1 src/OpenWrap/Repositories/Http/IndexedHttpRepository.cs
  70. +4 −3 src/OpenWrap/Repositories/Http/RequestExtensions.cs
  71. +2 −0 src/OpenWrap/Repositories/ISupportAuthentication.cs
  72. +5 −0 src/OpenWrap/Repositories/ISupportCurrentCredentials.cs
  73. +9 −5 src/OpenWrap/Repositories/InMemoryRepository.cs
  74. +4 −4 src/OpenWrap/Repositories/NuFeed/NuFeedRepository.cs
  75. +5 −0 src/OpenWrap/Repositories/NullAuthentication.cs
  76. +5 −4 src/OpenWrap/Repositories/PreauthenticatedRepository.cs
  77. +0 −1 src/OpenWrap/SemanticVersion.cs
  78. +9 −0 src/OpenWrap/Settings.StyleCop
  79. +10 −0 src/OpenWrap/VersionExtensions.cs
  80. +25 −13 src/Settings.StyleCop
  81. +0 −1 src/Tests.VisualStudio/Properties/AssemblyInfo.cs
  82. +1 −0 todo.txt
  83. +1 −1 version
  84. BIN wraps/openwrap-2.0.2.87978029.wrap
  85. BIN wraps/openwrap-2.0.3+0.wrap
  86. BIN wraps/openwrap-2.0.3+121.wrap
  87. BIN wraps/openwrap-2.0.3+84.wrap
  88. BIN wraps/openwrap/bin-net35/OpenRasta.Client.dll
  89. BIN wraps/openwrap/bin-net35/OpenRasta.Client.pdb
  90. BIN wraps/openwrap/bin-net35/OpenWrap.VisualStudio.Shared.dll
  91. BIN wraps/openwrap/bin-net35/OpenWrap.VisualStudio.Shared.pdb
  92. BIN wraps/openwrap/bin-net35/OpenWrap.VisualStudio.SolutionAddIn.dll
  93. BIN wraps/openwrap/bin-net35/OpenWrap.VisualStudio.SolutionAddIn.pdb
  94. BIN wraps/openwrap/bin-net35/OpenWrap.dll
  95. BIN wraps/openwrap/bin-net35/OpenWrap.pdb
  96. BIN wraps/openwrap/build/OpenWrap.Build.Bootstrap.dll
  97. BIN wraps/openwrap/build/OpenWrap.Build.Bootstrap.pdb
  98. BIN wraps/openwrap/build/OpenWrap.Build.Tasks.dll
  99. BIN wraps/openwrap/build/OpenWrap.Build.Tasks.pdb
  100. +103 −46 wraps/openwrap/build/OpenWrap.CSharp.targets
  101. BIN wraps/openwrap/commands-net35/OpenWrap.Commands.dll
  102. BIN wraps/openwrap/commands-net35/OpenWrap.Commands.pdb
  103. BIN wraps/openwrap/commands-net35/OpenWrap.Testing.dll
  104. BIN wraps/openwrap/commands-net35/OpenWrap.Testing.pdb
  105. +19 −5 wraps/openwrap/openwrap.wrapdesc
  106. BIN wraps/openwrap/solution/OpenWrap.Resharper.450.dll
  107. BIN wraps/openwrap/solution/OpenWrap.Resharper.450.pdb
  108. BIN wraps/openwrap/solution/OpenWrap.Resharper.500.dll
  109. BIN wraps/openwrap/solution/OpenWrap.Resharper.500.pdb
  110. BIN wraps/openwrap/solution/OpenWrap.Resharper.510.dll
  111. BIN wraps/openwrap/solution/OpenWrap.Resharper.510.pdb
  112. BIN wraps/openwrap/solution/OpenWrap.Resharper.600.dll
  113. BIN wraps/openwrap/solution/OpenWrap.Resharper.600.pdb
  114. BIN wraps/openwrap/solution/OpenWrap.Resharper.610.dll
  115. BIN wraps/openwrap/solution/OpenWrap.Resharper.610.pdb
  116. BIN wraps/openwrap/solution/OpenWrap.SolutionPlugins.VisualStudio.dll
  117. BIN wraps/openwrap/solution/OpenWrap.SolutionPlugins.VisualStudio.pdb
  118. +1 −1 wraps/openwrap/version
View
1 build/common.project.properties
@@ -3,6 +3,7 @@
<PropertyGroup>
<OutputPath Condition="'$(OutputPath)' == ''">..\..\scratch\bin\$(MSBuildProjectName)-$(Configuration)-$(Platform)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">..\..\scratch\obj\$(MSBuildProjectName)-$(Configuration)-$(Platform)</IntermediateOutputPath>
+ <NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\CommonProperties.cs">
View
20 openwrap.wrapdesc
@@ -1,13 +1,25 @@
depends: sharpziplib = 0.86
depends: openwrap content >= 2.0 and < 3.0
+depends: Mono.Cecil = 0.9.4
+depends: tdnet-framework
+depends: openfilesystem = 1.0.1
anchored: true
-build: msbuild; profile=net35; project=src\OpenWrap\OpenWrap.csproj; project=src\OpenWrap.VisualStudio.Shared\OpenWrap.VisualStudio.Shared.csproj; project=src\OpenWrap.Build.Tasks\OpenWrap.Build.Tasks.csproj; project=src\OpenWrap.Commands\OpenWrap.Commands.csproj; project=src\OpenWrap.VisualStudio.SolutionPlugins\OpenWrap.SolutionPlugins.VisualStudio.csproj;
+build: msbuild; profile=net35; project=src\OpenWrap\OpenWrap.csproj; project=src\OpenWrap.VisualStudio.Shared\OpenWrap.VisualStudio.Shared.csproj; project=src\OpenWrap.Build.Tasks\OpenWrap.Build.Tasks.csproj; project=src\OpenWrap.Commands\OpenWrap.Commands.csproj; project=src\OpenWrap.VisualStudio.SolutionPlugins\OpenWrap.SolutionPlugins.VisualStudio.csproj
#CreateHardLinksForAdditionalFilesIfPossible=true;CreateHardLinksForCopyAdditionalFilesIfPossible=true;CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true;CreateHardLinksForCopyLocalIfPossible=true;CreateHardLinksForPublishFilesIfPossible=true;BuildInParallel=true;
name: openwrap
title: OpenWrap Package Manager
-depends: tdnet-framework
use-symlinks: true
-depends: Mono.Cecil = 0.9.4
directory-structure: src\*{scope: Tests=tests}*\**
directory-structure: src\{scope: Tests.VisualStudio=tests}\**
-depends: openfilesystem = 1.0.1
+trademark: OpenWrap is a trademark of naughtyProd Limited 2010-2012
+author: Sebastien Lambla <seb@serialseb.com>
+copyright: © 2010-2012 naughtyProd Limited & Sebastien Lambla
+description: OpenWrap is an Open-Source dependency manager for .net platforms.
+assembly-info: author
+assembly-info: copyright
+assembly-info: assembly-version
+assembly-info: file-version
+assembly-info: assembly-info
+assembly-info: build
+assembly-info: description
+assembly-info: trademark
View
12 src/CommonProperties.cs
@@ -1,7 +1,7 @@
-[assembly: System.Reflection.AssemblyCompany("Caffeine IT / naughtyProd Limited")]
-[assembly: System.Reflection.AssemblyProduct("OpenWrap package management")]
-[assembly: System.Reflection.AssemblyCopyright("Copyright � naughtyProd Limited 2009-2011")]
-[assembly: System.Reflection.AssemblyTrademark("")]
+//[assembly: System.Reflection.AssemblyCompany("Caffeine IT / naughtyProd Limited")]
+//[assembly: System.Reflection.AssemblyProduct("OpenWrap package management")]
+//[assembly: System.Reflection.AssemblyCopyright("Copyright � naughtyProd Limited 2009-2011")]
+//[assembly: System.Reflection.AssemblyTrademark("")]
[assembly: System.Reflection.AssemblyCulture("")]
-[assembly: System.Reflection.AssemblyVersion("2.0.0.*")]
-[assembly: System.Reflection.AssemblyFileVersion("2.0.0.1")]
+//[assembly: System.Reflection.AssemblyVersion("2.0.0.*")]
+//[assembly: System.Reflection.AssemblyFileVersion("2.0.0.1")]
View
1 src/OpenRasta.Client/Properties/AssemblyInfo.cs
@@ -6,4 +6,3 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenRasta.Client")]
-[assembly: AssemblyDescription("")]
View
1 src/OpenWrap.Build.Bootstrap/Properties/AssemblyInfo.cs
@@ -6,4 +6,3 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenWrap.Build.Bootstrap")]
-[assembly: AssemblyDescription("")]
View
4 src/OpenWrap.Build.Tasks/OpenWrap.CSharp.targets
@@ -39,7 +39,7 @@
<OpenWrap-IncludeContentFiles Condition="'$(OpenWrap-IncludeContentFiles)' == ''">false</OpenWrap-IncludeContentFiles>
<_OpenWrap-GenerateSharedAssemblyInfo>False</_OpenWrap-GenerateSharedAssemblyInfo>
- <_OpenWrap-GenerateSharedAssemblyInfo Condition="Exists('$(OpenWrap-SharedAssemblyInfoFile)') == True">True</_OpenWrap-GenerateSharedAssemblyInfo>
+ <_OpenWrap-GenerateSharedAssemblyInfo Condition="Exists('$(OpenWrap-SharedAssemblyInfoFile)')">False</_OpenWrap-GenerateSharedAssemblyInfo>
</PropertyGroup>
<Target Name="OpenWrap-Initialize">
@@ -70,7 +70,7 @@
<Target Name="OpenWrap-ResolveReferences" DependsOnTargets="OpenWrap-Initialize">
- <ItemGroup Condition="'$(OpenWrap-SharedAssemblyInfoFile)' != ''">
+ <ItemGroup Condition="Exists('$(OpenWrap-SharedAssemblyInfoFile)')">
<Compile Include="$(OpenWrap-SharedAssemblyInfoFile)" />
</ItemGroup>
<ResolveWrapReferences
View
3 src/OpenWrap.Build.Tasks/Properties/AssemblyInfo.cs
@@ -2,5 +2,4 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-[assembly: AssemblyTitle("OpenWrap MSBuild tasks")]
-[assembly: AssemblyDescription("Provides MSBuild intergration for OpenWrap")]
+[assembly: AssemblyTitle("OpenWrap MSBuild tasks")]
View
3 src/OpenWrap.Commands/Properties/AssemblyInfo.cs
@@ -2,5 +2,4 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-[assembly: AssemblyTitle("OpenWrap commands")]
-[assembly: AssemblyDescription("All commands in the wrap and help namespace")]
+[assembly: AssemblyTitle("OpenWrap commands")]
View
2 src/OpenWrap.Commands/Wrap/AddWrapCommand.cs
@@ -108,7 +108,7 @@ protected override IEnumerable<ICommandOutput> ExecuteCore()
yield return VerifyProjectRepository();
yield return SetupEnvironmentForAdd();
- var sourceRepositories = GetSourceRepositories();
+ var sourceRepositories = GetSourceRepositories().ToList();
var descriptor = new PackageDescriptor(_targetDescriptor.Value);
if (Project && System)
View
2 src/OpenWrap.Hooks/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenWrap.Hooks")]
-[assembly: AssemblyDescription("")]
+
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("OpenWrap.Hooks")]
View
1 src/OpenWrap.ReSharper.450/Properties/AssemblyInfo.cs
@@ -4,4 +4,3 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap Resharper 4.5 support")]
-[assembly: AssemblyDescription("")]
View
2 src/OpenWrap.ReSharper.500/Properties/AssemblyInfo.cs
@@ -3,6 +3,6 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap.Resharper.50")]
-[assembly: AssemblyDescription("")]
+
[assembly: ComVisible(false)]
[assembly: Guid("ffb5e9f7-fce2-41db-aeef-0e107ea07cd2")]
View
2 src/OpenWrap.ReSharper.510/Properties/AssemblyInfo.cs
@@ -4,6 +4,6 @@
[assembly: AssemblyTitle("OpenWrap.Resharper.50")]
-[assembly: AssemblyDescription("")]
+
[assembly: ComVisible(false)]
[assembly: Guid("ffb5e9f7-fce2-41db-aeef-0e107ea07cd2")]
View
2 src/OpenWrap.ReSharper.600/Properties/AssemblyInfo.cs
@@ -3,6 +3,6 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap.Resharper.600")]
-[assembly: AssemblyDescription("")]
+
[assembly: ComVisible(false)]
[assembly: Guid("e103bfe8-0d9b-4858-aafd-60b4c202e2c2")]
View
2 src/OpenWrap.ReSharper.610/Properties/AssemblyInfo.cs
@@ -3,6 +3,6 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap.Resharper.610")]
-[assembly: AssemblyDescription("")]
+
[assembly: ComVisible(false)]
[assembly: Guid("125b025d-b1d1-4c74-88c8-eff676a6d64a")]
View
1 src/OpenWrap.Testing/Properties/AssemblyInfo.cs
@@ -3,4 +3,3 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap.Testing")]
-[assembly: AssemblyDescription("")]
View
22 src/OpenWrap.Tests/Build/assembly_info/assembly_file_version.cs
@@ -0,0 +1,22 @@
+using System.Reflection;
+using NUnit.Framework;
+
+namespace Tests.Build.assembly_info
+{
+ public class assembly_file_version : context_assembly_info
+ {
+ public assembly_file_version()
+ {
+ given_descriptor(
+ "version: 1.0.0." + ushort.MaxValue,
+ "assembly-info: file-version");
+ when_generating_assembly_info();
+ }
+ [Test]
+ public void contains_attribute()
+ {
+ should_have<AssemblyFileVersionAttribute>(
+ "1.0.0.65535");
+ }
+ }
+}
View
22 src/OpenWrap.Tests/Build/assembly_info/assembly_version.cs
@@ -0,0 +1,22 @@
+using System.Reflection;
+using NUnit.Framework;
+
+namespace Tests.Build.assembly_info
+{
+ public class assembly_version : context_assembly_info
+ {
+ public assembly_version()
+ {
+ given_descriptor(
+ "version: 1.0.0." + ushort.MaxValue,
+ "assembly-info: assembly-version");
+ when_generating_assembly_info();
+ }
+ [Test]
+ public void contains_attribute()
+ {
+ should_have<AssemblyVersionAttribute>(
+ "1.0.0.0");
+ }
+ }
+}
View
23 src/OpenWrap.Tests/Build/assembly_info/author.cs
@@ -0,0 +1,23 @@
+using System.Reflection;
+using NUnit.Framework;
+
+namespace Tests.Build.assembly_info
+{
+ public class author : context_assembly_info
+ {
+ public author()
+ {
+ given_descriptor(
+ "author: sauron <sauron@middle.earth>",
+ "author: frodo <frodo@middle.earth>",
+ "assembly-info: author");
+ when_generating_assembly_info();
+ }
+ [Test]
+ public void contains_attribute()
+ {
+ should_have<AssemblyCompanyAttribute>(
+ "sauron <sauron@middle.earth>, frodo <frodo@middle.earth>");
+ }
+ }
+}
View
43 src/OpenWrap.Tests/Build/assembly_info/context_assembly_info.cs
@@ -0,0 +1,43 @@
+using OpenFileSystem.IO;
+using OpenFileSystem.IO.FileSystems.InMemory;
+using OpenWrap;
+using OpenWrap.Build;
+using OpenWrap.PackageModel;
+using OpenWrap.PackageModel.Serialization;
+using OpenWrap.Testing;
+
+namespace Tests.Build.assembly_info
+{
+ public class context_assembly_info : context
+ {
+ const string ATTRIBUTE_TEXT = "[assembly: {0}(\"{1}\")]";
+ protected IFile assembly_info_file;
+ IPackageDescriptor descriptor;
+ InMemoryFileSystem file_system;
+ protected string assembly_info_content;
+
+ public context_assembly_info()
+ {
+ file_system = new InMemoryFileSystem();
+ assembly_info_file = file_system.GetTempDirectory().GetFile("GeneratedAssemblyinfo.cs");
+ }
+ protected void when_generating_assembly_info()
+ {
+ var generator = new AssemblyInfoGenerator(descriptor);
+ generator.Write(assembly_info_file);
+ assembly_info_content = generator.ToString();
+ }
+
+ protected void given_descriptor(params string[] lines)
+ {
+ descriptor = new PackageDescriptorReader()
+ .Read(lines.JoinString("\r\n").ToUTF8Stream());
+ }
+ protected void should_have<T>(string value)
+ {
+ assembly_info_content.ShouldContain(
+ string.Format(ATTRIBUTE_TEXT, typeof(T).FullName, value)
+ );
+ }
+ }
+}
View
21 src/OpenWrap.Tests/Build/assembly_info/copyright.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using NUnit.Framework;
+
+namespace Tests.Build.assembly_info
+{
+ public class copyright : context_assembly_info
+ {
+ public copyright()
+ {
+ given_descriptor(
+ "copyright: Tolkien",
+ "assembly-info: copyright");
+ when_generating_assembly_info();
+ }
+ [Test]
+ public void contains_attribute()
+ {
+ should_have<AssemblyCopyrightAttribute>("Tolkien");
+ }
+ }
+}
View
124 src/OpenWrap.Tests/Build/assembly_info/none.cs
@@ -1,16 +1,9 @@
-using System.Reflection;
-using NUnit.Framework;
-using OpenFileSystem.IO;
-using OpenFileSystem.IO.FileSystems.InMemory;
-using OpenWrap;
-using OpenWrap.Build;
-using OpenWrap.PackageModel;
-using OpenWrap.PackageModel.Serialization;
+using NUnit.Framework;
using OpenWrap.Testing;
namespace Tests.Build.assembly_info
{
- public class none :context_assembly_info
+ public class none : context_assembly_info
{
public none()
{
@@ -24,117 +17,4 @@ public void no_file_generated()
assembly_info_file.Exists.ShouldBeFalse();
}
}
- public class copyright : context_assembly_info
- {
- public copyright()
- {
- given_descriptor(
- "copyright: Tolkien",
- "assembly-info: copyright");
- when_generating_assembly_info();
- }
- [Test]
- public void contains_attribute()
- {
- should_have<AssemblyCopyrightAttribute>("Tolkien");
- }
- }
-
- public class assembly_file_version : context_assembly_info
- {
- public assembly_file_version()
- {
- given_descriptor(
- "version: 1.0.0." + ushort.MaxValue,
- "assembly-info: file-version");
- when_generating_assembly_info();
- }
- [Test]
- public void contains_attribute()
- {
- should_have<AssemblyFileVersionAttribute>(
- "1.0.0.65535");
- }
- }
- public class assembly_version : context_assembly_info
- {
- public assembly_version()
- {
- given_descriptor(
- "version: 1.0.0." + ushort.MaxValue,
- "assembly-info: assembly-version");
- when_generating_assembly_info();
- }
- [Test]
- public void contains_attribute()
- {
- should_have<AssemblyVersionAttribute>(
- "1.0.0.0");
- }
- }
- public class author : context_assembly_info
- {
- public author()
- {
- given_descriptor(
- "author: sauron <sauron@middle.earth>",
- "author: frodo <frodo@middle.earth>",
- "assembly-info: author");
- when_generating_assembly_info();
- }
- [Test]
- public void contains_attribute()
- {
- should_have<AssemblyCompanyAttribute>(
- "sauron <sauron@middle.earth>, frodo <frodo@middle.earth>");
- }
- }
- public class title : context_assembly_info
- {
- public title()
- {
- given_descriptor(
- "title: The lord of the rings",
- "assembly-info: title");
- when_generating_assembly_info();
- }
- [Test]
- public void contains_attribute()
- {
- should_have<AssemblyProductAttribute>("The lord of the rings");
- }
- }
-
- public class context_assembly_info : context
- {
- const string ATTRIBUTE_TEXT = "[assembly: {0}(\"{1}\")]";
- protected IFile assembly_info_file;
- IPackageDescriptor descriptor;
- InMemoryFileSystem file_system;
- protected string assembly_info_content;
-
- public context_assembly_info()
- {
- file_system = new InMemoryFileSystem();
- assembly_info_file = file_system.GetTempDirectory().GetFile("GeneratedAssemblyinfo.cs");
- }
- protected void when_generating_assembly_info()
- {
- var generator = new AssemblyInfoGenerator(descriptor);
- generator.Write(assembly_info_file);
- assembly_info_content = generator.ToString();
- }
-
- protected void given_descriptor(params string[] lines)
- {
- descriptor = new PackageDescriptorReader()
- .Read(lines.JoinString("\r\n").ToUTF8Stream());
- }
- protected void should_have<T>(string value)
- {
- assembly_info_content.ShouldContain(
- string.Format(ATTRIBUTE_TEXT, typeof(T).FullName, value)
- );
- }
- }
}
View
21 src/OpenWrap.Tests/Build/assembly_info/title.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using NUnit.Framework;
+
+namespace Tests.Build.assembly_info
+{
+ public class title : context_assembly_info
+ {
+ public title()
+ {
+ given_descriptor(
+ "title: The lord of the rings",
+ "assembly-info: title");
+ when_generating_assembly_info();
+ }
+ [Test]
+ public void contains_attribute()
+ {
+ should_have<AssemblyProductAttribute>("The lord of the rings");
+ }
+ }
+}
View
2 src/OpenWrap.Tests/Dependencies/trees/resolvig_package_existing_in_local_and_remote.cs
@@ -24,7 +24,7 @@ public void finds_highest_version_number_across_repositories()
var dependency = Resolve.SuccessfulPackages.First();
dependency.Packages.ShouldNotBeEmpty().First()
- .Source.ShouldBe(RemoteRepository);
+ .Source.Token.ShouldBe(RemoteRepository.Token);
dependency.Packages.ShouldNotBeEmpty()
.First().SemanticVersion.ShouldBe("1.1.0");
}
View
2 ...sts/Dependencies/trees/resolving_latest_package_in_system_with_outdated_remote_version.cs
@@ -29,7 +29,7 @@ public void the_package_is_installed_from_system()
{
Resolve.SuccessfulPackages.ShouldHaveCountOf(1)
.First()
- .Check(x => x.Packages.First().Source.ShouldBe(SystemRepository))
+ .Check(x => x.Packages.First().Source.Token.ShouldBe(SystemRepository.Token))
.Check(x => x.Packages.First().SemanticVersion.ShouldBe("1.0.0.1"));
}
}
View
2 src/OpenWrap.Tests/Dependencies/trees/resolving_package_from_remote_repository.cs
@@ -21,7 +21,7 @@ public void dependency_on_remote_package_is_resolved()
Resolve.IsSuccess.ShouldBeTrue();
Resolve.SuccessfulPackages.First().Packages.ShouldNotBeEmpty()
.First()
- .Source.ShouldBe(RemoteRepository);
+ .Source.Token.ShouldBe(RemoteRepository.Token);
}
}
}
View
2 src/OpenWrap.Tests/Dependencies/trees/resolving_package_from_system_repository.cs
@@ -20,7 +20,7 @@ public void system_package_is_resolved()
{
Resolve.IsSuccess.ShouldBeTrue();
Resolve.SuccessfulPackages.First().Packages.ShouldNotBeEmpty()
- .First().Source.ShouldBe(SystemRepository);
+ .First().Source.Token.ShouldBe(SystemRepository.Token);
}
}
}
View
2 src/OpenWrap.Tests/Dependencies/trees/resolving_sub_builds_from_current_directory.cs
@@ -21,7 +21,7 @@ public void package_found_from_current_directory()
{
Resolve.SuccessfulPackages.Where(x => x.Identifier.Name == "rings-of-power")
.ShouldHaveCountOf(1)
- .First().Packages.First().Source.ShouldBe(CurrentDirectoryRepository);
+ .First().Packages.First().Source.Token.ShouldBe(CurrentDirectoryRepository.Token);
}
}
View
1 src/OpenWrap.Tests/Properties/AssemblyInfo.cs
@@ -3,4 +3,3 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap tests")]
-[assembly: AssemblyDescription("")]
View
4 src/OpenWrap.Tests/Repositories/indexed_http/reading_the_dynamicproxy_package.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using NUnit.Framework;
+using OpenWrap;
using OpenWrap.PackageModel;
using OpenWrap.Testing;
@@ -14,7 +15,6 @@ public reading_the_dynamicproxy_package()
{
given_repository();
castle_proxy = Repository.PackagesByName["castle-dynamicproxy"].First();
-
}
[Test]
@@ -24,7 +24,7 @@ public void has_the_correct_name()
}
[Test]public void has_the_correct_version()
{
- castle_proxy.SemanticVersion.ShouldBe("2.1.0");
+ castle_proxy.Version.ShouldBe("2.1.0".ToVersion());
}
[Test]
public void has_the_correct_dependencies()
View
2 src/OpenWrap.Tests/Repositories/manager/all_configured_remotes.cs
@@ -37,7 +37,7 @@ public void fetch_repo_built()
public void publish_repo_built()
{
PublishRepositories.ShouldHaveAtLeastOne().First()
- .Check(_ => _.Name.ShouldBe("somewhere"))
+ .Check(_ => _.Name.ShouldBe("iron-hills - somewhere"))
.Check(_ => _.Token.ShouldBe("[memory]somewhere"))
.Feature<ISupportPublishing>().ShouldNotBeNull();
}
View
13 src/OpenWrap.Tests/Repositories/manager/repositories_with_authentication.cs
@@ -20,24 +20,23 @@ public repositories_with_authentication()
[Test]
public void repository_has_authentication()
{
- FetchRepositories.Single().ShouldBeOfType<PreAuthenticatedRepository>()
- .Credentials
+ FetchRepositories.Single().Feature<ISupportAuthentication>()
+ .CurrentCredentials
.Check(_ => _.UserName.ShouldBe("sauron"))
.Check(_ => _.Password.ShouldBe("itsmyprecious"));
}
[Test]
public void repository_supports_credentials_override()
{
- var repo = FetchRepositories.OfType<PreAuthenticatedRepository>().Single();
- var auth = repo.Feature<ISupportAuthentication>()
- .WithCredentials(new NetworkCredential("saruman", "impersonator"));
- repo.Credentials
+ var repo = FetchRepositories.Single().Feature<ISupportAuthentication>();
+ var auth = repo.WithCredentials(new NetworkCredential("saruman", "impersonator"));
+ repo.CurrentCredentials
.Check(_ => _.UserName.ShouldBe("saruman"))
.Check(_ => _.Password.ShouldBe("impersonator"));
auth.Dispose();
- repo.Credentials
+ repo.CurrentCredentials
.Check(_ => _.UserName.ShouldBe("sauron"))
.Check(_ => _.Password.ShouldBe("itsmyprecious"));
}
View
2 ...nWrap.Tests/Repositories/manager/repositories_with_authentication_without_auth_support.cs
@@ -18,7 +18,7 @@ public repositories_with_authentication_without_auth_support()
[Test]
public void repository_has_no_authentication()
{
- FetchRepositories.Single().ShouldBeOfType<InMemoryRepository>();
+ FetchRepositories.Single().Feature<ISupportAuthentication>().ShouldBeNull();
}
}
}
View
3 src/OpenWrap.Tests/Repositories/when_nuking_a_package.cs
@@ -20,7 +20,8 @@ public void index_document_contains_nuked_attribute()
{
(from XElement node in IndexDocument.Descendants("wrap")
where node.Attribute("name").Value.Equals("pharrell") &&
- node.Attribute("version").Value.Equals("1.0.0+0") &&
+ node.Attribute("version").Value.Equals("1.0.0.0") &&
+ node.Attribute("semantic-version").Value.Equals("1.0.0.0") &&
node.Attribute("nuked").Value.Equals("true")
select node)
.ShouldHaveCountOf(1);
View
1 src/OpenWrap.Tests/Repositories/when_publishing_a_package.cs
@@ -33,6 +33,7 @@ public void index_file_contains_package()
package.ShouldNotBeNull();
package.Attribute("name").ShouldNotBeNull().Value.ShouldBe("isengard");
package.Attribute("version").ShouldNotBeNull().Value.ShouldBe("2.1");
+ package.Attribute("semantic-version").ShouldNotBeNull().Value.ShouldBe("2.1");
var link = package.Descendants("link").FirstOrDefault().ShouldNotBeNull();
link.Attribute("href").ShouldNotBeNull().Value.ShouldNotBeNull().ShouldContain("isengard-2.1.wrap");
}
View
514 src/OpenWrap.Tests/Settings.StyleCop
@@ -0,0 +1,514 @@
+<StyleCopSettings Version="105">
+ <Analyzers>
+ <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
+ <Rules>
+ <Rule Name="InheritDocMustBeUsedWithInheritingClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
+ <Rules>
+ <Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="WhileDoFooterMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationHeaderMustBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentMustBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainBlankLinesAtStartOfFile">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainBlankLinesAtEndOfFile">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
+ <Rules>
+ <Rule Name="FieldsMustBePrivate">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeAnalysisSuppressionMustHaveJustification">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DebugAssertMustProvideMessageText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DebugFailMustProvideMessageText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileMayOnlyContainASingleClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileMayOnlyContainASingleNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StatementMustNotUseUnnecessaryParenthesis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConditionalExpressionsMustDeclarePrecedence">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="RemoveDelegateParenthesisWhenPossible">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="AttributeConstructorMustNotUseUnnecessaryParenthesis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="RemoveUnnecessaryCode">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
+ <Rules>
+ <Rule Name="ElementMustBeginWithUpperCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementMustBeginWithLowerCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="InterfaceNamesMustBeginWithI">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FieldNamesMustNotUseHungarianNotation">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="AccessibleFieldsMustBeginWithUpperCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="VariableNamesMustNotBePrefixed">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
+ <Rules>
+ <Rule Name="ElementsMustAppearInTheCorrectOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementsMustBeOrderedByAccess">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConstantsMustAppearBeforeFields">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StaticElementsMustAppearBeforeInstanceElements">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DeclarationKeywordsMustFollowOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ProtectedMustComeBeforeInternal">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PropertyAccessorsMustFollowOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="EventAccessorsMustFollowOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UsingDirectivesMustBeOrderedAlphabeticallyByNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
+ <Rules>
+ <Rule Name="CommentsMustContainText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DoNotPrefixCallsWithBaseUnlessLocalImplementationExists">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningParenthesisMustBeOnDeclarationLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingParenthesisMustBeOnLineOfLastParameter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingParenthesisMustBeOnLineOfOpeningParenthesis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CommaMustBeOnSameLineAsPreviousParameter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ParameterListMustFollowDeclaration">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ParameterMustFollowComma">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="QueryClauseMustFollowPreviousClause">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="QueryClausesMustBeOnSeparateLinesOrAllOnOneLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="QueryClausesSpanningMultipleLinesMustBeginOnOwnLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DoNotPlaceRegionsWithinElements">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainEmptyStatements">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainMultipleStatementsOnOneLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="BlockStatementsMustNotContainEmbeddedComments">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="BlockStatementsMustNotContainEmbeddedRegions">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UseStringEmptyForEmptyStrings">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UseBuiltInTypeAlias">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UseShorthandForNullableTypes">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
+ <Rules>
+ <Rule Name="KeywordsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CommasMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SemicolonsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationLinesMustBeginWithSingleSpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OperatorKeywordMustBeFollowedBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningParenthesisMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningSquareBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingSquareBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningGenericBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingGenericBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningAttributeBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingAttributeBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="NullableTypeSymbolsMustNotBePrecededBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="MemberAccessSymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="IncrementDecrementSymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="NegativeSignsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PositiveSignsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ColonsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainMultipleWhitespaceInARow">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="TabsMustNotBeUsed">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ </Analyzers>
+</StyleCopSettings>
View
6 src/OpenWrap.Tests/Tests.csproj
@@ -51,7 +51,13 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
+ <Compile Include="Build\assembly_info\assembly_file_version.cs" />
+ <Compile Include="Build\assembly_info\assembly_version.cs" />
+ <Compile Include="Build\assembly_info\author.cs" />
+ <Compile Include="Build\assembly_info\context_assembly_info.cs" />
+ <Compile Include="Build\assembly_info\copyright.cs" />
<Compile Include="Build\assembly_info\none.cs" />
+ <Compile Include="Build\assembly_info\title.cs" />
<Compile Include="Build\builders.msbuild\explicit_projects_without_source_folder.cs" />
<Compile Include="Build\builders.msbuild\project_doesnt_exist.cs" />
<Compile Include="Build\builders.msbuild\project_use_filename_wildcard.cs" />
View
10 src/OpenWrap.Tests/openwrap_context.cs
@@ -141,7 +141,7 @@ protected void given_system_package(string name, string version, params string[]
static void AddPackage(IPackageRepository repository, string name, string version, string[] dependencies)
{
var packageFileName = name + "-" + version + ".wrap";
- var packageStream = Packager.NewWithDescriptor(new InMemoryFile(packageFileName), name, version.ToString(), dependencies).OpenRead();
+ var packageStream = Packager.NewWithDescriptor(new InMemoryFile(packageFileName), name, version, dependencies).OpenRead();
using (var readStream = packageStream)
using (var publisher = repository.Feature<ISupportPublishing>().Publisher())
publisher.Publish(packageFileName, readStream);
@@ -211,17 +211,17 @@ protected void given_file(string filePath, Stream stream)
}
}
- protected void given_remote_repository(string remoteName, int? priority = null, Action<InMemoryRepository> factory = null)
+ protected void given_remote_repository(string configName, int? priority = null, Action<InMemoryRepository> factory = null)
{
- var repo = new InMemoryRepository(remoteName);
+ var repo = new InMemoryRepository(configName);
if (factory != null) factory(repo);
RemoteRepositories.Add(repo);
- ConfiguredRemotes[remoteName] = new RemoteRepository
+ ConfiguredRemotes[configName] = new RemoteRepository
{
Priority = priority ?? ConfiguredRemotes.Count + 1,
FetchRepository = new RemoteRepositoryEndpoint{Token=repo.Token},
PublishRepositories = { new RemoteRepositoryEndpoint{Token=repo.Token } },
- Name = remoteName
+ Name = configName
};
ServiceLocator.GetService<IConfigurationManager>().Save(ConfiguredRemotes);
}
View
2 src/OpenWrap.VisualStudio.Shared/Properties/AssemblyInfo.cs
@@ -3,6 +3,6 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap.VisualStudio.Shared")]
-[assembly: AssemblyDescription("")]
+
[assembly: ComVisible(false)]
[assembly: Guid("9bc94be8-fa5e-4f4d-9706-ea3e41009a8a")]
View
1 src/OpenWrap.VisualStudio.SolutionAddIn/Properties/AssemblyInfo.cs
@@ -3,5 +3,4 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap Visual Studio Add-in")]
-[assembly: AssemblyDescription("Provides OpenWrap integration for Visual Studio ")]
View
2 src/OpenWrap.VisualStudio.SolutionPlugins/Properties/AssemblyInfo.cs
@@ -3,6 +3,6 @@
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenWrap.VisualStudio")]
-[assembly: AssemblyDescription("")]
+
[assembly: ComVisible(false)]
[assembly: Guid("60d4c2fe-23b4-4f3d-ade2-48cf62addcb4")]
View
1 src/OpenWrap.Windows/Properties/AssemblyInfo.cs
@@ -5,7 +5,6 @@
using System.Windows;
[assembly: AssemblyTitle("OpenWrap.Windows")]
-[assembly: AssemblyDescription("OpenWrap Graphical User interface")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
View
36 src/OpenWrap/Build/AssemblyInfoGenerator.cs
@@ -5,27 +5,23 @@
using OpenFileSystem.IO;
using OpenWrap.IO;
using OpenWrap.PackageModel;
-using OpenWrap.ProjectModel;
namespace OpenWrap.Build
{
public class AssemblyInfoGenerator
{
const string ATTRIBUTE_TEXT = "[assembly: {0}(\"{1}\")]";
-
+
readonly IPackageDescriptor _descriptor;
- public SemanticVersion Version { get; set; }
public AssemblyInfoGenerator(IPackageDescriptor descriptor)
{
_descriptor = descriptor;
Version = descriptor.SemanticVersion;
}
- public void Write(IFile destination)
- {
- if (_descriptor.AssemblyInfo.Any())
- destination.WriteString(ToString());
- }
+
+ public SemanticVersion Version { get; set; }
+
public override string ToString()
{
var sb = new StringBuilder();
@@ -40,23 +36,29 @@ public override string ToString()
int revision;
if (!int.TryParse(Version.Build, out revision)) revision = -1;
var clrVersion = new Version(
- Version.Major % ushort.MaxValue,
- Version.Minor % ushort.MaxValue,
- Version.Patch == -1 ? 0 : Version.Patch % ushort.MaxValue,
- revision == -1 ? 0 : revision % ushort.MaxValue
- );
- TryAppend<AssemblyVersionAttribute>(sb,
- "assembly-version",
+ Version.Major % ushort.MaxValue,
+ Version.Minor % ushort.MaxValue,
+ Version.Patch == -1 ? 0 : Version.Patch % ushort.MaxValue,
+ revision == -1 ? 0 : revision % ushort.MaxValue);
+
+ TryAppend<AssemblyVersionAttribute>(sb,
+ "assembly-version",
clrVersion.ToString());
TryAppend<AssemblyInformationalVersionAttribute>(sb, "assembly-info-version", Version.ToString());
- TryAppend<AssemblyFileVersionAttribute>(sb,
- "file-version",
+ TryAppend<AssemblyFileVersionAttribute>(sb,
+ "file-version",
Version.ToVersion().ToString());
}
return sb.ToString();
}
+ public void Write(IFile destination)
+ {
+ if (_descriptor.AssemblyInfo.Any())
+ destination.WriteString(ToString());
+ }
+
void TryAppend<T>(StringBuilder sb, string flagName, string attribValue)
{
if (_descriptor.AssemblyInfo.Contains("*") || _descriptor.AssemblyInfo.ContainsNoCase(flagName))
View
4 src/OpenWrap/Collections/EnumerableExtensions.cs
@@ -7,6 +7,10 @@ namespace OpenWrap.Collections
{
public static class EnumerableExtensions
{
+ public static List<T> CopyOrNew<T>(this IEnumerable<T> collection)
+ {
+ return collection == null ? new List<T>() : new List<T>(collection);
+ }
public static IEnumerable<T> Select<T>(this IEnumerable input, Func<object, T> functoid)
{
foreach(var obj in input)
View
7 src/OpenWrap/DictionaryExtensions.cs
@@ -24,5 +24,12 @@ public static class DictionaryExtensions
dictionary.Add(key, outValue = new TValue());
return outValue;
}
+ public static TValue GetOrCreate<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> value)
+ {
+ TValue outValue;
+ if (!dictionary.TryGetValue(key, out outValue))
+ dictionary.Add(key, outValue = value());
+ return outValue;
+ }
}
}
View
4 src/OpenWrap/IO/Packaging/Packager.cs
@@ -42,8 +42,10 @@ public static IFile NewWithDescriptor(IFile wrapFile, string name, string versio
var lines = descriptorLines.ToList();
if (lines.None(_ => _.StartsWithNoCase("name:")))
lines.Add("name: " + name);
+ if (lines.None(_=>_.StartsWithNoCase("semantic-version:")))
+ lines.Add("semantic-version: " + version);
if (lines.None(_ => _.StartsWithNoCase("version:")))
- lines.Add("version: " + name);
+ lines.Add("version: " + version.ToSemVer().ToVersion());
var descriptorContent = lines.JoinString("\r\n").ToUTF8Stream();
var versionContent = version.ToUTF8Stream();
View
6 src/OpenWrap/OpenWrap.csproj
@@ -46,6 +46,7 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<UseVSHostingProcess>false</UseVSHostingProcess>
+ <DocumentationFile>..\..\scratch\bin\OpenWrap-Debug-AnyCPU\OpenWrap.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -112,6 +113,7 @@
<Compile Include="Configuration\Remotes\Legacy\RemoteRepository.cs" />
<Compile Include="Configuration\Remotes\RemoteRepositoryEndpoint.cs" />
<Compile Include="Configuration\StringBuilderExtensions.cs" />
+ <Compile Include="PackageManagement\DependencyResolvers\DependencyVisitor2.cs" />
<Compile Include="PackageManagement\Exporters\Assemblies\AbstractAssemblyExporter.cs" />
<Compile Include="PackageManagement\Assembly.cs" />
<Compile Include="PackageManagement\DependencyResolvers\ResolutionResultExtensions.cs" />
@@ -150,6 +152,7 @@
<Compile Include="Repositories\IRemoteManager.cs" />
<Compile Include="Repositories\IRepositoryFeature.cs" />
<Compile Include="Repositories\ISupportLocking.cs" />
+ <Compile Include="Repositories\ISupportCurrentCredentials.cs" />
<Compile Include="Repositories\NuFeed\NuFeedReader.cs" />
<Compile Include="Repositories\NuFeed\NuFeedRepository.cs" />
<Compile Include="Repositories\NuFeed\NuFeedRepositoryFactory.cs" />
@@ -255,7 +258,6 @@
<Compile Include="Configuration\Remotes\RemoteRepository.cs" />
<Compile Include="Commands\Cli\ShellRunner.cs" />
<Compile Include="PackageModel\AbsolutelyEqualVersionVertex.cs" />
- <Compile Include="PackageModel\DefaultPackageInfo.cs" />
<Compile Include="PackageModel\PackageDescriptorEntryCollection.cs" />
<Compile Include="PackageModel\GenericDescriptorEntry.cs" />
<Compile Include="PackageModel\GreaterThanVersionVertex.cs" />
@@ -269,7 +271,7 @@
<Compile Include="PackageModel\Parsers\SingleDateTimeOffsetValue.cs" />
<Compile Include="PackageModel\Parsers\SingleStringValue.cs" />
<Compile Include="PackageModel\Parsers\SingleValue.cs" />
- <Compile Include="PackageModel\Parsers\SingleVersionValue.cs" />
+ <Compile Include="PackageModel\Parsers\SingleSemanticVersionValue.cs" />
<Compile Include="PackageModel\Serialization\StringExtensions.cs" />
<Compile Include="Commands\EnvironmentExtensions.cs" />
<Compile Include="IO\IOExtensions.cs" />
View
18 src/OpenWrap/PackageManagement/DefaultPackageManager.cs
@@ -212,14 +212,16 @@ public IPackageRemoveResult RemoveSystemPackage(PackageRequest packageToRemove,
static IEnumerable<PackageAnchoredResult> AnchorPackages(DependencyResolutionResult resolvedPackages, IEnumerable<IPackageRepository> destinationRepositories)
{
- return from repo in destinationRepositories.OfType<ISupportAnchoring>()
+ return from repo in destinationRepositories
+ let anchorage = repo.Feature<ISupportAnchoring>()
+ where anchorage != null
from successfulPackage in resolvedPackages.SuccessfulPackages
where successfulPackage.IsAnchored
- let packageInstances = from packageInstance in successfulPackage.Packages
- where packageInstance != null &&
- packageInstance.Source == repo
- select packageInstance
- from anchorResult in repo.AnchorPackages(packageInstances)
+ let packageInstances = (from packageInstance in successfulPackage.Packages
+ where packageInstance != null &&
+ packageInstance.Source.Token == repo.Token
+ select packageInstance)
+ from anchorResult in anchorage.AnchorPackages(packageInstances)
select anchorResult;
}
@@ -249,11 +251,11 @@ static IPackageInfo GetBestSourcePackage(IEnumerable<IPackageRepository> sourceR
{
return (
from repo in sourceRepositories
- let compatiblePackage = packages.FirstOrDefault(x => x.Source == repo)
+ let compatiblePackage = packages.FirstOrDefault(x => x.Source.Token == repo.Token)
where compatiblePackage != null
select compatiblePackage
)
- .First();
+ .First();
}
static IPackageInfo GetExistingPackage(IPackageRepository destinationRepository, ResolvedPackage foundPackage, Func<SemanticVersion, bool> versionSelector)
View
7 src/OpenWrap/PackageManagement/DependencyResolvers/DependencyResolutionResult.cs
@@ -10,13 +10,16 @@ public class DependencyResolutionResult
{
public IPackageDescriptor Descriptor { get; private set; }
- public DependencyResolutionResult(IPackageDescriptor descriptor, IEnumerable<ResolvedPackage> successfulPackages, IEnumerable<ResolvedPackage> conflictingPackages, IEnumerable<ResolvedPackage> missingPackages)
+ public DependencyResolutionResult(
+ IPackageDescriptor descriptor,
+ IEnumerable<ResolvedPackage> successfulPackages,
+ IEnumerable<ResolvedPackage> conflictingPackages,
+ IEnumerable<ResolvedPackage> missingPackages)
{
Descriptor = descriptor;
SuccessfulPackages = successfulPackages.ToList().AsReadOnly();
DiscardedPackages = conflictingPackages.ToList().AsReadOnly();
MissingPackages = missingPackages.ToList().AsReadOnly();
- //IsSuccess = !(MissingPackages.Any() || DiscardedPackages.Any());
IsSuccess = !(MissingPackages.Any(x => SuccessfulPackages.None(s => s.Identifier.Name.EqualsNoCase(x.Identifier.Name)))
|| DiscardedPackages.Any(x => SuccessfulPackages.None(s => s.Identifier.Name.EqualsNoCase(x.Identifier.Name))));
}
View
1 src/OpenWrap/PackageManagement/DependencyResolvers/DependencyVisitor.cs
@@ -8,6 +8,7 @@
namespace OpenWrap.PackageManagement.DependencyResolvers
{
+
public class DependencyVisitor
{
readonly Stack<Node> _currentNode = new Stack<Node>();
View
217 src/OpenWrap/PackageManagement/DependencyResolvers/DependencyVisitor2.cs
@@ -1,14 +1,221 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
+using Mono.Collections.Generic;
+using OpenWrap.Collections;
+using OpenWrap.PackageModel;
namespace OpenWrap.PackageManagement.DependencyResolvers
{
- public class AbstractDependencyVisitor<TVersion>
+ public class LoggingPackageResolver : PackageResolverVisitor<IPackageInfo>
{
- static void Main(string[] args)
+ public LoggingPackageResolver(
+ IEnumerable<IPackageInfo> allPackages,
+ IEnumerable<IPackageInfo> success = null,
+ IEnumerable<IPackageInfo> fail = null,
+ Action<IPackageInfo, Func<IPackageInfo, bool>, IPackageInfo, bool> arcTraversal = null)
+ : base(allPackages, null, PackageStrategy.Latest, success, fail, arcTraversal)
{
- //new[]{"hi"}.
+ DependencyReader = ReadDependencies;
+ if (arcTraversal == null)
+ {
+ Traversal = LoggingTraversal;
+ }
+ else
+ {
+ Traversal = (@in, dep, @out, result) =>
+ {
+ LoggingTraversal(@in, dep, @out, result);
+ arcTraversal(@in, dep, @out, result);
+ };
+ }
}
-
+
+ Dictionary<Func<IPackageInfo, bool>, PackageDependency> _dependencyMap;
+
+ IEnumerable<Func<IPackageInfo, bool>> ReadDependencies(IPackageInfo arg)
+ {
+ return arg.Dependencies.Select(ReadDependency);
+ }
+ public virtual bool Visit(IEnumerable<PackageDependency> dependencies)
+ {
+ return Visit(dependencies.Select(ReadDependency));
+ }
+
+ Func<IPackageInfo, bool> ReadDependency(PackageDependency packageDependency)
+ {
+ var matcher = ToFunc(packageDependency);
+ if (_dependencyMap.ContainsKey(matcher) == false)
+ _dependencyMap[matcher] = packageDependency;
+ return matcher;
+ }
+
+ static Func<IPackageInfo, bool> ToFunc(PackageDependency packageDependency)
+ {
+ return package => packageDependency.IsFulfilledBy(package.SemanticVersion);
+ }
+
+ public override bool Visit(IEnumerable<Func<IPackageInfo, bool>> dependencies)
+ {
+ _dependencyMap = new Dictionary<Func<IPackageInfo, bool>, PackageDependency>();
+ NotFound = new List<CallStack>();
+ Success = new List<CallStack>();
+ Fail = new List<CallStack>();
+
+ return base.Visit(dependencies);
+ }
+
+ public List<CallStack> Fail { get; set; }
+
+ protected override bool VisitPackage(IPackageInfo package)
+ {
+ Push(package.Identifier);
+ var success = base.VisitPackage(package);
+ Pop();
+ return success;
+ }
+ void LoggingTraversal(IPackageInfo package, Func<IPackageInfo, bool> dependency, IPackageInfo destination, bool success)
+ {
+ if (!success && destination != null)
+ Fail.Add(new CallStack(_currentNode));
+ else if (!success)
+ NotFound.Add(new CallStack(_currentNode));
+ else
+ Success.Add(new CallStack(_currentNode));
+ }
+
+ public List<CallStack> Success { get; private set; }
+ protected override bool VisitDependency(IPackageInfo package, Func<IPackageInfo, bool> dependency)
+ {
+ Push(_dependencyMap[dependency]);
+ var success = base.VisitDependency(package, dependency);
+ Pop();
+ return success;
+ }
+
+ Stack<Node> _currentNode = new Stack<Node>();
+ public List<CallStack> NotFound { get; private set; }
+
+
+ void Pop()
+ {
+ _currentNode.Pop();
+ }
+
+ void Push(PackageIdentifier identifier)
+ {
+ _currentNode.Push(new PackageNode(identifier));
+ WriteDebug("P:" + identifier);
+ }
+
+ void Push(PackageDependency dependency)
+ {
+ _currentNode.Push(new DependencyNode(dependency));
+ WriteDebug("D:" + dependency);
+ }
+
+ void WriteDebug(string text)
+ {
+ var packages = string.Empty;
+ ////string.Format(
+ //// " Yes: {0} No:{1}",
+ //// SelectionContext.CompatiblePackageVersions.Select(x => x.Key).JoinString(","),
+ //// SelectionContext.IncompatiblePackageVersions.Select(x => x.Key).JoinString(","));
+
+ Debug.WriteLine(new string(' ', _currentNode.Count) + text + packages);
+ }
+
}
+ public static class PackageStrategy
+ {
+ public static IEnumerable<IPackageInfo> Latest(IEnumerable<IPackageInfo> arg)
+ {
+#pragma warning disable 612,618
+ return arg.Where(_ => _.SemanticVersion != null)
+ .OrderByDescending(_ => _.SemanticVersion)
+ .Concat(
+ arg.Where(_ => _.SemanticVersion == null && _.Version != null)
+ .OrderBy(_ => _.Version)
+ );
+#pragma warning restore 612,618
+ }
+ }
+ public class PackageResolverVisitor<T> where T : class
+ {
+ readonly Func<IEnumerable<T>, IEnumerable<T>> _strategy;
+ readonly IEnumerable<T> _allPackages;
+ public Func<T, IEnumerable<Func<T, bool>>> DependencyReader { get; set; }
+ public Action<T, Func<T, bool>, T, bool> Traversal { get; set; }
+ public ICollection<T> SuccessfulPackages { get; set; }
+ public ICollection<T> IncompatiblePackages { get; set; }
+
+ public PackageResolverVisitor(
+ IEnumerable<T> allPackages,
+ Func<T, IEnumerable<Func<T, bool>>> dependencyReader,
+ Func<IEnumerable<T>, IEnumerable<T>> strategy,
+ IEnumerable<T> success = null,
+ IEnumerable<T> fail = null,
+ Action<T, Func<T, bool>, T, bool> arcTraversal = null)
+ {
+ _strategy = strategy;
+ _allPackages = allPackages;
+ DependencyReader = dependencyReader;
+ Traversal = arcTraversal;
+ SuccessfulPackages = success.CopyOrNew();
+ IncompatiblePackages = fail.CopyOrNew();
+ }
+
+
+ public virtual bool Visit(IEnumerable<Func<T, bool>> dependencies)
+ {
+ return dependencies.All(info => VisitDependency(null, info));
+ }
+
+ protected virtual bool VisitDependency(T package, Func<T, bool> dependency)
+ {
+ if (SuccessfulPackages.Any(dependency))
+ return true;
+
+ var matchingPackages =
+ _allPackages
+ .Where(info => IncompatiblePackages.Contains(info) == false)
+ .Where(dependency);
+ if (matchingPackages.Any() == false)
+ {
+ InvokeTraversal(package, dependency, null, false);
+ return false;
+ }
+ foreach (var matchingPackage in matchingPackages)
+ {
+ var success = VisitPackage(matchingPackage);
+ InvokeTraversal(package, dependency, matchingPackage, success);
+ if (success) return true;
+ }
+ return false;
+ }
+
+ protected void InvokeTraversal(T package, Func<T, bool> dependency, T destination, bool success)
+ {
+ if (Traversal == null) return;
+ Traversal(package, dependency, destination, success);
+ }
+
+ protected virtual bool VisitPackage(T package)
+ {
+ var newResolver = new PackageResolverVisitor<T>(_allPackages, DependencyReader, _strategy, SuccessfulPackages, IncompatiblePackages, Traversal);
+ newResolver.SuccessfulPackages.Add(package);
+ if (newResolver.Visit(DependencyReader(package)))
+ {
+ SuccessfulPackages = newResolver.SuccessfulPackages;
+ IncompatiblePackages = newResolver.IncompatiblePackages;
+ return true;
+ }
+
+ IncompatiblePackages.Add(package);
+
+ return false;
+ }
+ }
+
}
View
51 src/OpenWrap/PackageManagement/DependencyResolvers/ExhaustiveResolver.cs
@@ -7,6 +7,57 @@
namespace OpenWrap.PackageManagement.DependencyResolvers
{
+ public class StrategyResolver : IPackageResolver
+ {
+ const int MAX_RETRIES = 5000;
+ public void Initialize()
+ {
+ }
+
+ public DependencyResolutionResult TryResolveDependencies(IPackageDescriptor packageDescriptor, IEnumerable<IPackageRepository> repositoriesToQuery)
+ {
+ Debug.WriteLine("Resolving descriptor " + packageDescriptor.Dependencies.Select(x => x.ToString()).JoinString(", "));
+
+ List<IPackageInfo> excluded = new List<IPackageInfo>();
+
+ var allPackages = repositoriesToQuery.Packages().SelectMany(_=>_);
+
+ var declaredDependencies = packageDescriptor.Dependencies.Select(PackageMatchesDependency).ToList();
+ for (int i = 0; i < MAX_RETRIES; i++)
+ {
+ var visitor = new LoggingPackageResolver(allPackages, fail: excluded);
+
+ if (visitor.Visit(declaredDependencies))
+ {
+ return new DependencyResolutionResult(packageDescriptor,
+ ToResolveResult(visitor.Success),
+ ToResolveResult(visitor.Fail),
+ ToResolveResult(visitor.NotFound));
+ }
+ var newExclusions = visitor.IncompatiblePackages.Except(excluded).ToList();
+ if (newExclusions.Any() == false) break;
+
+ excluded.AddRange(visitor.IncompatiblePackages);
+ }
+ throw new InvalidOperationException(string.Format("OpenWrap tried {0} times to resolve the tree of dependencies and gave up.", MAX_RETRIES));
+ }
+
+ IEnumerable<ResolvedPackage> ToResolveResult(List<CallStack> success)
+ {
+ return Enumerable.Empty<ResolvedPackage>();
+ }
+
+ Func<IPackageInfo, bool> GetDependency(Dictionary<PackageDependency, Func<IPackageInfo, bool>> dependencyMap, PackageDependency packageDependency)
+ {
+ return dependencyMap.GetOrCreate(packageDependency, () => PackageMatchesDependency(packageDependency));
+ }
+
+
+ Func<IPackageInfo, bool> PackageMatchesDependency(PackageDependency packageDependency)
+ {
+ return package => packageDependency.IsFulfilledBy(package.SemanticVersion ?? package.Version.ToSemVer());
+ }
+ }
public class ExhaustiveResolver : IPackageResolver
{
const int MAX_RETRIES = 5000;
View
8 src/OpenWrap/PackageManagement/DependencyResolvers/PackageSelectionContext.cs
@@ -48,7 +48,7 @@ public bool IsIgnored(PackageIdentifier identifier)
public void PackageConflicts(PackageIdentifier identifier, CallStack failingCallStack)
{
- var existingCompatible = CompatiblePackageVersions[identifier];
+ PackageResolutionStacks existingCompatible = CompatiblePackageVersions[identifier];
_compatiblePackageVersions.Pop();
CompatiblePackageVersions.Remove(identifier);
@@ -62,20 +62,20 @@ public void PackageHasChildrenConflicting(PackageIdentifier identifier)
_compatiblePackageVersions.Pop();
CompatiblePackageVersions.Remove(identifier);
- var newIgnores = _incompatiblePackages.Pop();
+ PackageResolveResults newIgnores = _incompatiblePackages.Pop();
_incompatiblePackages.Pop();
_incompatiblePackages.Push(newIgnores);
}
public void PackageSucceeds(PackageIdentifier packageNode, CallStack succeedingCallstack)
{
// commit the new ignore list
- var ignoredPackagesInBranch = _incompatiblePackages.Pop();
+ PackageResolveResults ignoredPackagesInBranch = _incompatiblePackages.Pop();
_incompatiblePackages.Pop();
_incompatiblePackages.Push(ignoredPackagesInBranch);
// add successful package
- var foundPackages = _compatiblePackageVersions.Pop();
+ PackageResolveResults foundPackages = _compatiblePackageVersions.Pop();
foundPackages.Add(packageNode, successful: new[] { succeedingCallstack });
_compatiblePackageVersions.Pop();
_compatiblePackageVersions.Push(foundPackages);
View
1 src/OpenWrap/PackageManagement/Packages/InMemoryPackage.cs