From 8ab06906eb892855156883f1a6f81591e79d74f2 Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Fri, 17 Mar 2017 11:55:32 +0900 Subject: [PATCH] Trying to get a handle on UWP CI, and adding remaining comments for DB3 --- src/Couchbase.Lite.Support.UWP/Activate.cs | 37 ----------- .../Couchbase.Lite.Support.UWP.csproj | 18 ------ .../Couchbase.Lite.Tests.UWP.csproj | 63 ++++++++++++++++++- .../Couchbase.Lite.Tests.UWP.sln | 6 +- src/Couchbase.Lite/API/IThreadSafe.cs | 25 ++++++++ 5 files changed, 89 insertions(+), 60 deletions(-) diff --git a/src/Couchbase.Lite.Support.UWP/Activate.cs b/src/Couchbase.Lite.Support.UWP/Activate.cs index 2e1465eb6..f7cffac12 100644 --- a/src/Couchbase.Lite.Support.UWP/Activate.cs +++ b/src/Couchbase.Lite.Support.UWP/Activate.cs @@ -43,43 +43,6 @@ public static void Activate() { InjectableCollection.RegisterImplementation(() => new DefaultDirectoryResolver()); InjectableCollection.RegisterImplementation(() => new UwpDefaultLogger()); - var assembly = typeof(UWP).GetTypeInfo().Assembly; - Directory.CreateDirectory(Path.Combine(ApplicationData.Current.LocalFolder.Path, "x86")); - Directory.CreateDirectory(Path.Combine(ApplicationData.Current.LocalFolder.Path, "x64")); - - foreach (var filename in new[] {"LiteCore", "sqlite3"}) { - var x86Path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "x86", $"{filename}.dll"); - if (!File.Exists(x86Path)) { - using (var x86Out = File.OpenWrite(x86Path)) - using (var x86In = assembly.GetManifestResourceStream($"{filename}_x86")) { - x86In.CopyTo(x86Out); - } - } - - var x64Path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "x64", $"{filename}.dll"); - if (!File.Exists(x64Path)) { - using (var x86Out = File.OpenWrite(x64Path)) - using (var x86In = assembly.GetManifestResourceStream($"{filename}_x64")) { - x86In.CopyTo(x86Out); - } - } - } - - var architecture = IntPtr.Size == 4 - ? "x86" - : "x64"; - var path = Path.Combine(ApplicationData.Current.LocalFolder.Path, architecture, "LiteCore.dll"); - const uint loadWithAlteredSearchPath = 8; - var ptr = LoadLibraryEx(path, IntPtr.Zero, loadWithAlteredSearchPath); - if (ptr != IntPtr.Zero) { - return; - } - - Debug.WriteLine("Could not load LiteCore.dll! Nothing is going to work!"); - throw new LiteCoreException(new C4Error(LiteCoreError.UnexpectedError)); } - - [DllImport("kernel32")] - private static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags); } } diff --git a/src/Couchbase.Lite.Support.UWP/Couchbase.Lite.Support.UWP.csproj b/src/Couchbase.Lite.Support.UWP/Couchbase.Lite.Support.UWP.csproj index a86501ab2..cc04e1ef1 100644 --- a/src/Couchbase.Lite.Support.UWP/Couchbase.Lite.Support.UWP.csproj +++ b/src/Couchbase.Lite.Support.UWP/Couchbase.Lite.Support.UWP.csproj @@ -138,24 +138,6 @@ - - - x64\LiteCore.dll - LiteCore_x64 - - - x64\sqlite3.dll - sqlite3_x64 - - - x86\LiteCore.dll - LiteCore_x86 - - - x86\sqlite3.dll - sqlite3_x86 - - 14.0 diff --git a/src/Couchbase.Lite.Tests.UWP/Couchbase.Lite.Tests.UWP.csproj b/src/Couchbase.Lite.Tests.UWP/Couchbase.Lite.Tests.UWP.csproj index 8d926ae65..862443cab 100644 --- a/src/Couchbase.Lite.Tests.UWP/Couchbase.Lite.Tests.UWP.csproj +++ b/src/Couchbase.Lite.Tests.UWP/Couchbase.Lite.Tests.UWP.csproj @@ -92,6 +92,47 @@ false true + + bin\x86\Packaging\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;LITECORE_PACKAGED;;CODE_ANALYSIS + true + true + ;2008 + true + pdbonly + x86 + false + prompt + MinimumRecommendedRules.ruleset + true + + + bin\ARM\Packaging\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;LITECORE_PACKAGED;;CODE_ANALYSIS + true + ;2008 + true + pdbonly + ARM + false + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Packaging\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;LITECORE_PACKAGED;;CODE_ANALYSIS + true + true + ;2008 + true + pdbonly + x64 + false + prompt + MinimumRecommendedRules.ruleset + true + @@ -128,19 +169,37 @@ - + Microsoft Visual Studio Test Core + + + x64\LiteCore.dll + PreserveNewest + + + x64\sqlite3.dll + PreserveNewest + + + x86\LiteCore.dll + PreserveNewest + + + x86\sqlite3.dll + PreserveNewest + + 14.0 - +