Skip to content

Commit

Permalink
Fixes wrong unregistration of events in COM add-in and update binarie…
Browse files Browse the repository at this point in the history
…s to a more stable version
  • Loading branch information
serialseb committed Sep 14, 2011
1 parent daa6bab commit 0486a79
Show file tree
Hide file tree
Showing 31 changed files with 37 additions and 59 deletions.
Empty file.
3 changes: 2 additions & 1 deletion src/OpenWrap.Commands/Wrap/BuildWrapCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ IEnumerable<ICommandOutput> Build()
var packageFilePath = destinationPath.GetFile(
PackageNameUtility.PackageFileName(packageName, generatedVersion.ToString()));

var packageContent = GeneratePackageContent(_buildResults).Concat(
var packageContent = GeneratePackageContent(_buildResults)
.Concat(
GenerateVersionFile(generatedVersion),
GenerateDescriptorFile(packageDescriptorForEmbedding)
).ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ public void OnStartupComplete(ref Array custom)
{
}

static ResolveEventHandler HandleSelfLoad()
static Assembly HandleSelfLoad(object src, ResolveEventArgs ev)
{
return (src, ev) =>
{
var currentAssembly = typeof(AddInAppDomainManager).Assembly;
return (new AssemblyName(ev.Name).Name == currentAssembly.GetName().Name) ? currentAssembly : null;
};
}

string GetRootLocation(string fullName)
Expand Down Expand Up @@ -137,9 +134,9 @@ void LoadAppDomain()

// replace that with the location in the codebase we just registered, ensuring the correct version is loaded
var location = Type.GetTypeFromProgID(_progId).Assembly.Location;
AppDomain.CurrentDomain.AssemblyResolve += HandleSelfLoad();
AppDomain.CurrentDomain.AssemblyResolve += HandleSelfLoad;
_appDomainManager = (IDisposable)_appDomain.CreateInstanceFromAndUnwrap(location, typeof(AddInAppDomainManager).FullName);
AppDomain.CurrentDomain.AssemblyResolve -= HandleSelfLoad();
AppDomain.CurrentDomain.AssemblyResolve -= HandleSelfLoad;
_appDomain.DomainUnload += HandleAppDomainChange;
}
catch (Exception e)
Expand Down
34 changes: 9 additions & 25 deletions src/OpenWrap/Commands/Cli/ShellRunner.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Mono.Cecil;
using OpenFileSystem.IO;
using OpenFileSystem.IO.FileSystems.Local;
using OpenRasta.Client;
using OpenWrap.Commands.Cli.Locators;
using OpenWrap.PackageManagement;
using OpenWrap.PackageManagement.AssemblyResolvers;
using OpenWrap.PackageManagement.DependencyResolvers;
using OpenWrap.PackageManagement.Deployers;
using OpenWrap.PackageManagement.Exporters;
using OpenWrap.PackageManagement.Exporters.Assemblies;
using OpenWrap.PackageManagement.Exporters.Commands;
using OpenWrap.Repositories;
using OpenWrap.Repositories.FileSystem;
using OpenWrap.Repositories.Http;
using OpenWrap.Repositories.NuFeed;
using OpenWrap.Runtime;
using OpenWrap.Services;
using OpenWrap.Tasks;

namespace OpenWrap.Commands.Cli
{
Expand All @@ -39,20 +23,20 @@ public static int Main(string[] args)
public static int Main(IDictionary<string, object> env)
{
var serviceRegistry = new ServiceRegistry().Override<IEnvironment>(() =>
{
var cdenv = new CurrentDirectoryEnvironment(LocalFileSystem.Instance.GetDirectory(env.CurrentDirectory()));
if (env.SysPath() != null)
cdenv.SystemRepositoryDirectory = LocalFileSystem.Instance.GetDirectory(new Path(env.SysPath()).Combine("wraps"));
return cdenv;
});
{
var cdenv = new CurrentDirectoryEnvironment(LocalFileSystem.Instance.GetDirectory(env.CurrentDirectory()));
if (env.SysPath() != null)
cdenv.SystemRepositoryDirectory = LocalFileSystem.Instance.GetDirectory(new Path(env.SysPath()).Combine("wraps"));
return cdenv;
});
var formatterType = env.Formatter();
if(formatterType != null)
if (formatterType != null)
{
serviceRegistry.Override<ICommandOutputFormatter>(() => (ICommandOutputFormatter)Activator.CreateInstance(Type.GetType(formatterType)));
serviceRegistry.Override(() => (ICommandOutputFormatter)Activator.CreateInstance(Type.GetType(formatterType)));
}
serviceRegistry.Initialize();

return new ConsoleCommandExecutor(ServiceLocator.GetService<IEnumerable<ICommandLocator>>(), ServiceLocator.GetService<IEventHub>(),ServiceLocator.GetService<ICommandOutputFormatter>())
return new ConsoleCommandExecutor(ServiceLocator.GetService<IEnumerable<ICommandLocator>>(), ServiceLocator.GetService<IEventHub>(), ServiceLocator.GetService<ICommandOutputFormatter>())
.Execute(env.CommandLine(), env.ShellArgs());
}
#pragma warning restore 28
Expand Down
8 changes: 1 addition & 7 deletions src/OpenWrap/Repositories/DirectoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ public static class DirectoryExtensions
{
public static IDirectory FindProjectRepositoryDirectory(this IDirectory root)
{
// TODO: Review if we should not *only* take the wraps folder where the .wrapdesc is
return root == null
? null
: root.AncestorsAndSelf()
.SelectMany(x => x.Directories("wraps"))
.Where(x => x != null)
.FirstOrDefault();
return root == null ? null : root.GetDirectory("wraps");
}
}
}
33 changes: 17 additions & 16 deletions src/OpenWrap/Runtime/CurrentDirectoryEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ public IPackageRepository ProjectRepository
{
get
{
TryInitializeProject(); return _projectRepository;
if (_projectRepository == null)
TryInitializeProject();

return _projectRepository;
}
set { _projectRepository = value; }
}

public IPackageRepository SystemRepository { get; private set; }
public IDirectory SystemRepositoryDirectory { get; set; }

public void Initialize()
{

FileSystem = LocalFileSystem.Instance;
SystemRepositoryDirectory = SystemRepositoryDirectory ?? FileSystem.GetDirectory(DefaultInstallationPaths.SystemRepositoryDirectory);

Expand All @@ -69,16 +73,16 @@ public void Initialize()

SystemRepository = new FolderRepository(SystemRepositoryDirectory)
{
Name = "System repository"
Name = "System repository"
};

ConfigurationDirectory = FileSystem.GetDirectory(DefaultInstallationPaths.ConfigurationDirectory);


ExecutionEnvironment = new ExecutionEnvironment
{
Platform = IntPtr.Size == 4 ? "x86" : "x64",
Profile = Environment.Version.Major >= 4 ? "net40" : "net35"
Platform = IntPtr.Size == 4 ? "x86" : "x64",
Profile = Environment.Version.Major >= 4 ? "net40" : "net35"
};
}

Expand All @@ -96,19 +100,16 @@ void TryInitializeProjectRepository()
{
if (Descriptor.UseProjectRepository)
{
var projectRepositoryDirectory = DescriptorFile.Parent.FindProjectRepositoryDirectory();
var projectRepositoryDirectory = DescriptorFile.Parent.FindProjectRepositoryDirectory().MustExist();


if (projectRepositoryDirectory != null)
var repositoryOptions = FolderRepositoryOptions.AnchoringEnabled;
if (Descriptor.UseSymLinks)
repositoryOptions |= FolderRepositoryOptions.UseSymLinks;
_projectRepository = new FolderRepository(projectRepositoryDirectory, repositoryOptions)
{
var repositoryOptions = FolderRepositoryOptions.AnchoringEnabled;
if (Descriptor.UseSymLinks)
repositoryOptions |= FolderRepositoryOptions.UseSymLinks;
_projectRepository = new FolderRepository(projectRepositoryDirectory, repositoryOptions)
{
Name = "Project repository"
};
}
Name = "Project repository"
};
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/OpenWrap/Services/ServiceRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public ServiceRegistry()
Get<IPackageManager>().CommandExports(Get<IEnvironment>())
.SelectMany(x => x)
.Select(x => x.Descriptor)));

Register(() => new RuntimeAssemblyResolver());
Register<IPackageDescriptorMonitor>(() => new PackageDescriptorMonitor());
Register<ICommandOutputFormatter>(() => new ConsoleCommandOutputFormatter());
Expand Down
Binary file modified wraps/openwrap/bin-net35/OpenWrap.VisualStudio.Shared.dll
Binary file not shown.
Binary file modified wraps/openwrap/bin-net35/OpenWrap.VisualStudio.Shared.pdb
Binary file not shown.
Binary file modified wraps/openwrap/bin-net35/OpenWrap.VisualStudio.SolutionAddIn.dll
Binary file not shown.
Binary file not shown.
Binary file modified wraps/openwrap/bin-net35/OpenWrap.dll
Binary file not shown.
Binary file modified wraps/openwrap/bin-net35/OpenWrap.pdb
Binary file not shown.
Binary file modified wraps/openwrap/build/OpenWrap.Build.Bootstrap.dll
Binary file not shown.
Binary file modified wraps/openwrap/build/OpenWrap.Build.Bootstrap.pdb
Binary file not shown.
Binary file modified wraps/openwrap/build/OpenWrap.Build.Tasks.dll
Binary file not shown.
Binary file modified wraps/openwrap/build/OpenWrap.Build.Tasks.pdb
Binary file not shown.
Binary file removed wraps/openwrap/commands/OpenWrap.Commands.dll
Binary file not shown.
Binary file removed wraps/openwrap/commands/OpenWrap.Commands.pdb
Binary file not shown.
6 changes: 3 additions & 3 deletions wraps/openwrap/openwrap.wrapdesc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
depends: sharpziplib
depends: sharpziplib = 0.86
depends: openfilesystem
depends: openwrap content
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
name: openwrap
depends: tdnet-framework
use-symlinks: true
depends: Mono.Cecil
depends: Mono.Cecil = 0.9.4
directory-structure: src\*{scope: Tests=tests}*\**
directory-structure: src\{scope: Tests.VisualStudio=tests}\**
version: 2.0.0.81011175
version: 2.0.0.81138879
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.450.dll
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.450.pdb
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.500.dll
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.500.pdb
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.510.dll
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.510.pdb
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.600.dll
Binary file not shown.
Binary file modified wraps/openwrap/solution/OpenWrap.Resharper.600.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion wraps/openwrap/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0.81011175
2.0.0.81138879

0 comments on commit 0486a79

Please sign in to comment.