Let's be Mono friendly

This is a massive overhaul that replaces System.Data.SQLite with Mono.Data.Sqlite. This should make it more compatible with Linux and Mac and has no known downsides for Windows.
This commit is contained in:
Matt Nadareski
2016-04-20 17:02:15 -07:00
parent ac575438a1
commit 39b66ed8a1
154 changed files with 79824 additions and 212766 deletions

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Windows Phone 8 properties -->
<PropertyGroup>
<MonoDataSqlitePortableHardware>netcore</MonoDataSqlitePortableHardware>
</PropertyGroup>
<!-- pre-build error checks -->
<Target Name="ValidateMonoDataSqlitePreRequisites" BeforeTargets="BeforeBuild">
<Error Condition=" '$(Platform)' != 'ARM' and '$(Platform)' != 'x86' "
Text="Mono.Data.Sqlite.Portable for Windows Store can only be used in builds that target x86 or ARM." />
</Target>
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Windows Phone 8 properties -->
<PropertyGroup>
<MonoDataSqlitePortableHardware>wp8</MonoDataSqlitePortableHardware>
</PropertyGroup>
<!-- pre-build error checks -->
<Target Name="ValidateMonoDataSqlitePreRequisites" BeforeTargets="BeforeBuild">
<Error Condition=" '$(Platform)' != 'ARM' and '$(Platform)' != 'x86' "
Text="Mono.Data.Sqlite.Portable for Windows Phone 8 can only be used in builds that target x86 or ARM." />
</Target>
</Project>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MonoDataSqlitePortableImported>true</MonoDataSqlitePortableImported>
</PropertyGroup>
<!--
Currently, if 'MonoDataSqlitePortableHardware' == '', then skip the hardware specific assemblies.
This may be required at a later stage for other types of devices or platforms.
-->
<!-- reference paths -->
<PropertyGroup Condition="'$(MonoDataSqlitePortableHardware)' != ''">
<MonoDataSqlitePortablePath Condition="'$(Platform)' == 'x86'">$(MonoDataSqlitePortableHardware)-x86</MonoDataSqlitePortablePath>
<MonoDataSqlitePortablePath Condition="'$(Platform)' == 'ARM'">$(MonoDataSqlitePortableHardware)-arm</MonoDataSqlitePortablePath>
</PropertyGroup>
<!-- references -->
<ItemGroup Condition="'$(MonoDataSqlitePortablePath)' != ''">
<Reference Include="Mono.Data.Sqlite">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildThisFileDirectory)lib\$(MonoDataSqlitePortablePath)\Mono.Data.Sqlite.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,38 @@
param($installPath, $toolsPath, $package, $project)
# This is the MSBuild targets file to add
$targetsFile = [System.IO.Path]::Combine($toolsPath, $package.Id + '.targets')
# Need to load MSBuild assembly if it's not loaded yet.
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
# Grab the loaded MSBuild project for the project
$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1
# Make the path to the targets file relative.
$projectUri = new-object Uri($project.FullName, [System.UriKind]::Absolute)
$targetUri = new-object Uri($targetsFile, [System.UriKind]::Absolute)
$relativePath = [System.Uri]::UnescapeDataString($projectUri.MakeRelativeUri($targetUri).ToString()).Replace([System.IO.Path]::AltDirectorySeparatorChar, [System.IO.Path]::DirectorySeparatorChar)
# Add the import with a condition, to allow the project to load without the targets present.
$import = $msbuild.Xml.AddImport($relativePath)
$import.Condition = "Exists('$relativePath')"
# Add a target to fail the build when our targets are not imported
$target = $msbuild.Xml.AddTarget("EnsureMonoDataSqlitePortableImported")
$target.BeforeTargets = "BeforeBuild"
$target.Condition = "'`$(MonoDataSqlitePortableImported)' == ''"
# if the targets don't exist at the time the target runs, package restore didn't run
$errorTask = $target.AddTask("Error")
$errorTask.Condition = "!Exists('$relativePath')"
$errorTask.SetParameter("Text", "This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.");
# if the targets exist at the time the target runs, package restore ran but the build didn't import the targets.
$errorTask = $target.AddTask("Error")
$errorTask.Condition = "Exists('$relativePath')"
$errorTask.SetParameter("Text", "The build restored NuGet packages. Build the project again to include these packages in the build.");
$project.Save()
Write-Host "Successfully updated the project file."

View File

@@ -0,0 +1,13 @@
param($installPath, $toolsPath, $package, $project)
# Add the SQLite SDK reference
$sqliteReference = $project.Object.References.AddSDK("SQLite for Windows Runtime", "SQLite.WinRT, version=3.8.7.4")
Write-Host "Successfully added a reference to the extension SDK SQLite for Windows Runtime."
Write-Host "Please, verify that the extension SDK SQLite for Windows Runtime v3.8.7.4, from the SQLite.org site (http://www.sqlite.org/2014/sqlite-winrt-3080704.vsix), has been properly installed."
# This is the global install file
$rootInstall = [System.IO.Path]::Combine($toolsPath, '../install.ps1')
$rootToolsPath = [System.IO.Path]::Combine($toolsPath, '../')
Write-Host $rootInstall
. $rootInstall -installPath $installPath -toolsPath $rootToolsPath -package $package -project $project

View File

@@ -0,0 +1,17 @@
param($installPath, $toolsPath, $package, $project)
$sqliteReference = $project.Object.References.Find("SQLite.WinRT, version=3.8.7.4")
if ($sqliteReference -eq $null) {
Write-Host "Unable to find a reference to the extension SDK SQLite for Windows Runtime."
Write-Host "Verify that the reference to the extension SDK SQLite for Windows Runtime has already been removed."
} else {
$sqliteReference.Remove()
Write-Host "Successfully removed the reference to the extension SDK SQLite for Windows Runtime."
}
# This is the global uninstall file
$rootInstall = [System.IO.Path]::Combine($toolsPath, '../uninstall.ps1')
$rootToolsPath = [System.IO.Path]::Combine($toolsPath, '../')
Write-Host $rootInstall
. $rootInstall -installPath $installPath -toolsPath $rootToolsPath -package $package -project $project

View File

@@ -0,0 +1,13 @@
param($installPath, $toolsPath, $package, $project)
# Add the SQLite SDK reference
$sqliteReference = $project.Object.References.AddSDK("SQLite for Windows Runtime (Windows 8.1)", "SQLite.WinRT81, version=3.8.7.4")
Write-Host "Successfully added a reference to the extension SDK SQLite for Windows Runtime (Windows 8.1)."
Write-Host "Please, verify that the extension SDK SQLite for Windows Runtime (Windows 8.1) v3.8.7.4, from the SQLite.org site (http://www.sqlite.org/2014/sqlite-winrt81-3080704.vsix), has been properly installed."
# This is the global install file
$rootInstall = [System.IO.Path]::Combine($toolsPath, '../install.ps1')
$rootToolsPath = [System.IO.Path]::Combine($toolsPath, '../')
Write-Host $rootInstall
. $rootInstall -installPath $installPath -toolsPath $rootToolsPath -package $package -project $project

View File

@@ -0,0 +1,17 @@
param($installPath, $toolsPath, $package, $project)
$sqliteReference = $project.Object.References.Find("SQLite.WinRT81, version=3.8.7.4")
if ($sqliteReference -eq $null) {
Write-Host "Unable to find a reference to the extension SDK SQLite for Windows Runtime (Windows 8.1)."
Write-Host "Verify that the reference to the extension SDK SQLite for Windows Runtime (Windows 8.1) has already been removed."
} else {
$sqliteReference.Remove()
Write-Host "Successfully removed the reference to the extension SDK SQLite for Windows Runtime (Windows 8.1)."
}
# This is the global uninstall file
$rootInstall = [System.IO.Path]::Combine($toolsPath, '../uninstall.ps1')
$rootToolsPath = [System.IO.Path]::Combine($toolsPath, '../')
Write-Host $rootInstall
. $rootInstall -installPath $installPath -toolsPath $rootToolsPath -package $package -project $project

View File

@@ -0,0 +1,25 @@
param($installPath, $toolsPath, $package, $project)
# Need to load MSBuild assembly if it's not loaded yet.
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
# Grab the loaded MSBuild project for the project
$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1
# Find all the imports and targets added by this package.
$itemsToRemove = @()
# Allow many in case a past package was incorrectly uninstalled
$itemsToRemove += $msbuild.Xml.Imports | Where-Object { $_.Project.EndsWith($package.Id + '.targets') }
$itemsToRemove += $msbuild.Xml.Targets | Where-Object { $_.Name -eq "EnsureMonoDataSqlitePortableImported" }
# Remove the elements and save the project
if ($itemsToRemove -and $itemsToRemove.length)
{
foreach ($itemToRemove in $itemsToRemove)
{
$msbuild.Xml.RemoveChild($itemToRemove) | out-null
}
$project.Save()
}

View File

@@ -0,0 +1,13 @@
param($installPath, $toolsPath, $package, $project)
# Add the SQLite SDK reference
$sqliteReference = $project.Object.References.AddSDK("SQLite for Windows Phone", "SQLite.WP80, version=3.8.7.4")
Write-Host "Successfully added a reference to the extension SDK SQLite for Windows Phone."
Write-Host "Please, verify that the extension SDK SQLite for Windows Phone v3.8.7.4, from the SQLite.org site (http://www.sqlite.org/2014/sqlite-wp80-winrt-3080707.vsix), has been properly installed."
# This is the global install file
$rootInstall = [System.IO.Path]::Combine($toolsPath, '../install.ps1')
$rootToolsPath = [System.IO.Path]::Combine($toolsPath, '../')
Write-Host $rootInstall
. $rootInstall -installPath $installPath -toolsPath $rootToolsPath -package $package -project $project

View File

@@ -0,0 +1,17 @@
param($installPath, $toolsPath, $package, $project)
$sqliteReference = $project.Object.References.Find("SQLite.WP80, version=3.8.7.4")
if ($sqliteReference -eq $null) {
Write-Host "Unable to find a reference to the extension SDK SQLite for Windows Phone."
Write-Host "Verify that the reference to the extension SDK SQLite for Windows Phone has already been removed."
} else {
$sqliteReference.Remove()
Write-Host "Successfully removed the reference to the extension SDK SQLite for Windows Phone."
}
# This is the global uninstall file
$rootInstall = [System.IO.Path]::Combine($toolsPath, '../uninstall.ps1')
$rootToolsPath = [System.IO.Path]::Combine($toolsPath, '../')
Write-Host $rootInstall
. $rootInstall -installPath $installPath -toolsPath $rootToolsPath -package $package -project $project