Skip to content

Commit

Permalink
Trying to get a handle on UWP CI, and adding remaining comments for DB3
Browse files Browse the repository at this point in the history
  • Loading branch information
borrrden committed Mar 17, 2017
1 parent 09ac391 commit 8ab0690
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 60 deletions.
37 changes: 0 additions & 37 deletions src/Couchbase.Lite.Support.UWP/Activate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,6 @@ public static void Activate()
{
InjectableCollection.RegisterImplementation<IDefaultDirectoryResolver>(() => new DefaultDirectoryResolver());
InjectableCollection.RegisterImplementation<ILogger>(() => 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);
}
}
18 changes: 0 additions & 18 deletions src/Couchbase.Lite.Support.UWP/Couchbase.Lite.Support.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,6 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\vendor\couchbase-lite-core\build_cmake\x64\RelWithDebInfo\LiteCore.dll">
<Link>x64\LiteCore.dll</Link>
<LogicalName>LiteCore_x64</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="..\..\vendor\couchbase-lite-core\build_cmake\x64\RelWithDebInfo\sqlite3.dll">
<Link>x64\sqlite3.dll</Link>
<LogicalName>sqlite3_x64</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="..\..\vendor\couchbase-lite-core\build_cmake\x86\RelWithDebInfo\LiteCore.dll">
<Link>x86\LiteCore.dll</Link>
<LogicalName>LiteCore_x86</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="..\..\vendor\couchbase-lite-core\build_cmake\x86\RelWithDebInfo\sqlite3.dll">
<Link>x86\sqlite3.dll</Link>
<LogicalName>sqlite3_x86</LogicalName>
</EmbeddedResource>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
63 changes: 61 additions & 2 deletions src/Couchbase.Lite.Tests.UWP/Couchbase.Lite.Tests.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,47 @@
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Packaging|x86'">
<OutputPath>bin\x86\Packaging\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;LITECORE_PACKAGED;;CODE_ANALYSIS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Packaging|ARM'">
<OutputPath>bin\ARM\Packaging\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;LITECORE_PACKAGED;;CODE_ANALYSIS</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Packaging|x64'">
<OutputPath>bin\x64\Packaging\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;LITECORE_PACKAGED;;CODE_ANALYSIS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<NoStdLib>true</NoStdLib>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<!--A reference to the entire .Net Framework and Windows SDK are automatically included-->
<None Include="project.json" />
Expand Down Expand Up @@ -128,19 +169,37 @@
<Content Include="Assets\C\tests\data\nested.json" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="TestPlatform.Universal, Version=14.0">
<SDKReference Include="TestPlatform.Universal, Version=15.0">
<Name>Microsoft Visual Studio Test Core</Name>
</SDKReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' != 'Packaging'">
<Content Include="..\..\vendor\couchbase-lite-core\build_cmake\x64\RelWithDebInfo\LiteCore.dll">
<Link>x64\LiteCore.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\vendor\couchbase-lite-core\build_cmake\x64\RelWithDebInfo\sqlite3.dll">
<Link>x64\sqlite3.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\vendor\couchbase-lite-core\build_cmake\x86\RelWithDebInfo\LiteCore.dll">
<Link>x86\LiteCore.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\vendor\couchbase-lite-core\build_cmake\x86\RelWithDebInfo\sqlite3.dll">
<Link>x86\sqlite3.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="..\Couchbase.Lite.Tests.Shared\Couchbase.Lite.Tests.Shared.projitems" Label="Shared" />
<Import Project="..\..\vendor\couchbase-lite-core\CSharp\test\LiteCore.Tests.Shared\LiteCore.Tests.Shared.projitems" Label="Shared" />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v14.0\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
6 changes: 3 additions & 3 deletions src/Couchbase.Lite.Tests.UWP/Couchbase.Lite.Tests.UWP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Global
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|ARM.ActiveCfg = Release|ARM
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|ARM.Build.0 = Release|ARM
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|ARM.Deploy.0 = Release|ARM
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x64.ActiveCfg = Release|x64
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x64.Build.0 = Release|x64
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x64.Deploy.0 = Release|x64
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x64.ActiveCfg = Packaging|x64
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x64.Build.0 = Packaging|x64
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x64.Deploy.0 = Packaging|x64
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x86.ActiveCfg = Release|x86
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x86.Build.0 = Release|x86
{389C22F9-8999-47A5-8EB1-289D2B709EAE}.Packaging|x86.Deploy.0 = Release|x86
Expand Down
25 changes: 25 additions & 0 deletions src/Couchbase.Lite/API/IThreadSafe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,37 @@ public interface IThreadSafe

#region Public Methods

/// <summary>
/// Convenience method for asynchronously scheduling a job for this
/// object
/// </summary>
/// <param name="a">The job to schedule</param>
/// <returns>An awaitable task representing the scheduled job</returns>
Task DoAsync(Action a);

/// <summary>
/// Convenience method for asynchronously scheduling a job for this
/// object
/// </summary>
/// <typeparam name="T">The return value for the job</typeparam>
/// <param name="f">The job to schedule</param>
/// <returns>An awaitable task representing the scheduled job</returns>
Task<T> DoAsync<T>(Func<T> f);

/// <summary>
/// Convenience method for scheduling and waiting for a job
/// on this object's queue
/// </summary>
/// <param name="a">The job to schedule</param>
void DoSync(Action a);

/// <summary>
/// Convenience method for scheduling a job on this object's queue,
/// waiting for it to finish and returning the result
/// </summary>
/// <typeparam name="T">The return type of the scheduled job</typeparam>
/// <param name="f">The job to schedule</param>
/// <returns>The result of the job</returns>
T DoSync<T>(Func<T> f);

#endregion
Expand Down

0 comments on commit 8ab0690

Please sign in to comment.