瀏覽代碼

remove core plugin output from source control

LukePulverenti 12 年之前
父節點
當前提交
509156cbc3

+ 1 - 0
.gitignore

@@ -31,6 +31,7 @@ local.properties
 #################
 ## Media Browser
 #################
+CorePlugins*/
 ProgramData*/
 ProgramData-Server*/
 ProgramData-UI*/

+ 0 - 49
.hgignore

@@ -1,49 +0,0 @@
-# use glob syntax
-syntax: glob
-
-*.obj
-*.pdb
-*.user
-*.aps
-*.pch
-*.vspscc
-*.vssscc
-*_i.c
-*_p.c
-*.ncb
-*.suo
-*.tlb
-*.tlh
-*.bak
-*.cache
-*.ilk
-*.log
-*.lib
-*.sbr
-*.scc
-*.psess
-*.vsp
-*.vspx
-*.orig
-*.rej
-*.sdf
-*.opensdf
-*.ipch
-[Bb]in
-[Dd]ebug*/
-obj/
-[Rr]elease*/
-ProgramData*/
-ProgramData-Server*/
-ProgramData-UI*/
-_ReSharper*/
-[Tt]humbs.db
-[Tt]est[Rr]esult*
-[Bb]uild[Ll]og.*
-*.[Pp]ublish.xml
-*.resharper
-
-# ncrunch files
-*.ncrunchsolution
-*.ncrunchproject
-Setup/*

+ 0 - 5
.hgtags

@@ -1,5 +0,0 @@
-811bcaa9490681194bd72a01c4b0f91d78a0ec97 CO Version 0.12.12.25
-811bcaa9490681194bd72a01c4b0f91d78a0ec97 CO Version 0.12.12.25
-0000000000000000000000000000000000000000 CO Version 0.12.12.25
-0000000000000000000000000000000000000000 CO Version 0.12.12.25
-e98137e38224a0d82cd7d98a71264e0cddc91ca4 CO Version 0.12.12.25

+ 1 - 1
MediaBrowser.Api/MediaBrowser.Api.csproj

@@ -148,7 +148,7 @@
   <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\" /y</PostBuildEvent>
+    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\CorePlugins\" /y</PostBuildEvent>
   </PropertyGroup>
   <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 1 - 1
MediaBrowser.ApiInteraction.Javascript/MediaBrowser.ApiInteraction.Javascript.csproj

@@ -102,7 +102,7 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\" /y</PostBuildEvent>
+    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\CorePlugins\" /y</PostBuildEvent>
   </PropertyGroup>
   <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 25 - 2
MediaBrowser.Common/Kernel/BaseKernel.cs

@@ -3,7 +3,6 @@ using MediaBrowser.Common.IO;
 using MediaBrowser.Common.Localization;
 using MediaBrowser.Common.Mef;
 using MediaBrowser.Common.Net;
-using MediaBrowser.Common.Net.Handlers;
 using MediaBrowser.Common.Plugins;
 using MediaBrowser.Common.ScheduledTasks;
 using MediaBrowser.Common.Serialization;
@@ -17,7 +16,6 @@ using System;
 using System.Collections.Generic;
 using System.ComponentModel.Composition;
 using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
 using System.Deployment.Application;
 using System.Diagnostics;
 using System.IO;
@@ -517,6 +515,31 @@ namespace MediaBrowser.Common.Kernel
                 yield return pluginAssembly;
             }
 
+            var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
+            var corePluginDirectory = Path.Combine(runningDirectory, "CorePlugins");
+
+            // This will prevent the .dll file from getting locked, and allow us to replace it when needed
+            pluginAssemblies = Directory.EnumerateFiles(corePluginDirectory, "*.dll", SearchOption.TopDirectoryOnly)
+                .Select(file =>
+                {
+                    try
+                    {
+                        return Assembly.Load(File.ReadAllBytes((file)));
+                    }
+                    catch (Exception ex)
+                    {
+                        _failedPluginAssemblies.Add(file);
+                        Logger.ErrorException("Error loading {0}", ex, file);
+                        return null;
+                    }
+
+                }).Where(a => a != null);
+
+            foreach (var pluginAssembly in pluginAssemblies)
+            {
+                yield return pluginAssembly;
+            }
+            
             // Include composable parts in the Model assembly 
             yield return typeof (SystemInfo).Assembly;
             

+ 38 - 42
MediaBrowser.Common/Net/HttpServer.cs

@@ -209,56 +209,52 @@ namespace MediaBrowser.Common.Net
 
             RaiseReceiveWebRequest(context);
 
-            Task.Run(() =>
+            try
             {
-                try
-                {
-                    ProcessRequest(context);
-                }
-                catch (InvalidOperationException ex)
-                {
-                    HandleException(context.Response, ex, 422);
-
-                    throw;
-                }
-                catch (ResourceNotFoundException ex)
-                {
-                    HandleException(context.Response, ex, 404);
+                ProcessRequest(context);
+            }
+            catch (InvalidOperationException ex)
+            {
+                HandleException(context.Response, ex, 422);
 
-                    throw;
-                }
-                catch (FileNotFoundException ex)
-                {
-                    HandleException(context.Response, ex, 404);
+                throw;
+            }
+            catch (ResourceNotFoundException ex)
+            {
+                HandleException(context.Response, ex, 404);
 
-                    throw;
-                }
-                catch (DirectoryNotFoundException ex)
-                {
-                    HandleException(context.Response, ex, 404);
+                throw;
+            }
+            catch (FileNotFoundException ex)
+            {
+                HandleException(context.Response, ex, 404);
 
-                    throw;
-                }
-                catch (UnauthorizedAccessException ex)
-                {
-                    HandleException(context.Response, ex, 401);
+                throw;
+            }
+            catch (DirectoryNotFoundException ex)
+            {
+                HandleException(context.Response, ex, 404);
 
-                    throw;
-                }
-                catch (ArgumentException ex)
-                {
-                    HandleException(context.Response, ex, 400);
+                throw;
+            }
+            catch (UnauthorizedAccessException ex)
+            {
+                HandleException(context.Response, ex, 401);
 
-                    throw;
-                }
-                catch (Exception ex)
-                {
-                    HandleException(context.Response, ex, 500);
+                throw;
+            }
+            catch (ArgumentException ex)
+            {
+                HandleException(context.Response, ex, 400);
 
-                    throw;
-                }
+                throw;
+            }
+            catch (Exception ex)
+            {
+                HandleException(context.Response, ex, 500);
 
-            });
+                throw;
+            }
         }
 
         /// <summary>

+ 0 - 12
MediaBrowser.Controller/Kernel.cs

@@ -412,18 +412,6 @@ namespace MediaBrowser.Controller
             await Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask).ConfigureAwait(false);
         }
 
-        protected override IEnumerable<Assembly> GetComposablePartAssemblies()
-        {
-            var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
-
-            return base.GetComposablePartAssemblies().Concat(new[] { 
-            
-                Assembly.Load(File.ReadAllBytes(Path.Combine(runningDirectory, "MediaBrowser.Api.dll"))),
-                Assembly.Load(File.ReadAllBytes(Path.Combine(runningDirectory, "MediaBrowser.ApiInteraction.Javascript.dll"))),
-                Assembly.Load(File.ReadAllBytes(Path.Combine(runningDirectory, "MediaBrowser.WebDashboard.dll")))
-            });
-        }
-
         /// <summary>
         /// Gets a repository by name from a list, and returns the default if not found
         /// </summary>

+ 3 - 3
MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj

@@ -314,13 +314,13 @@
     </BootstrapperPackage>
   </ItemGroup>
   <ItemGroup>
-    <Content Include="MediaBrowser.Api.dll">
+    <Content Include="CorePlugins\MediaBrowser.Api.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-    <Content Include="MediaBrowser.ApiInteraction.Javascript.dll">
+    <Content Include="CorePlugins\MediaBrowser.ApiInteraction.Javascript.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-    <Content Include="MediaBrowser.WebDashboard.dll">
+    <Content Include="CorePlugins\MediaBrowser.WebDashboard.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
     <Content Include="x64\SQLite.Interop.dll">

+ 1 - 1
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -400,7 +400,7 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\" /y</PostBuildEvent>
+    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\CorePlugins\" /y</PostBuildEvent>
   </PropertyGroup>
   <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.