mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
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:
38
packages/Mono.Data.Sqlite.Portable.1.0.3.5/tools/install.ps1
vendored
Normal file
38
packages/Mono.Data.Sqlite.Portable.1.0.3.5/tools/install.ps1
vendored
Normal 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."
|
||||
Reference in New Issue
Block a user