Skip to content
Permalink
Browse files

Issue 363 (#364)

* Added scripts for running PostgreSQL integration tests

* Replaced ILMerge with Costura.Fody

* Fixed some path problems
  • Loading branch information...
erikbra committed Feb 3, 2019
1 parent a00e81a commit 0047ffbce33b912030374b1fcb880e4776a03296
@@ -30,8 +30,8 @@ If (! (Test-Path $OutputFile)) {
}

#Powershell and powershell Core have different ways of doing this, so safeguard.
$IsWin = ($IsWindows -or $env:OS -eq "Windows_NT")
If ($IsWin) {
$IsFullFramework = ($PSVersionTable.PSEdition -eq "Desktop")
If ($IsFullFramework) {
[System.Reflection.Assembly] $assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom($f);
} Else {
[System.Reflection.Assembly] $assembly = [System.Reflection.Assembly]::LoadFile($f);
@@ -0,0 +1,5 @@
#!/usr/bin/env pwsh

$Root="$($PSScriptRoot)/..";

& "$Root/code_drop/merge/rh.exe" --dt postgres --cs "host=localhost; port=5432; database=db; username=postgres; password=monkeybusiness;"
@@ -0,0 +1,5 @@
#! /usr/bin/env pwsh

docker pull postgres
docker run -d --name postgres-rh-test -e 'POSTGRES_PASSWORD=monkeybusiness' -p 5432:5432 postgres

@@ -0,0 +1,3 @@
#! /usr/bin/env pwsh

docker start postgres-rh-test

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -65,6 +65,8 @@ private static void Main(string[] args)
run_migrator(cf);
}
}


catch (Exception ex)
{
the_logger.Error(ex.Message, ex);

This file was deleted.

Oops, something went wrong.
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFramework)' == ''" >netcoreapp2.1;net461</TargetFrameworks>
<TargetFramework Condition="'$(TargetFramework)' == ''" >net461</TargetFramework>
<TargetFrameworks Condition="'$(TargetFramework)' == ''">netcoreapp2.1;net461</TargetFrameworks>
<TargetFramework Condition="'$(TargetFramework)' == ''">net461</TargetFramework>
<CLSCompliant>true</CLSCompliant>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -45,7 +45,12 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody" Version="3.3.2" />
<PackageReference Include="FluentNHibernate" Version="2.1.2" />
<PackageReference Include="Fody" Version="3.3.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
<PackageReference Include="Microsoft.Build.Framework" Version="15.9.20" />
<PackageReference Include="MySql.Data" Version="8.0.13" />
@@ -77,7 +82,7 @@
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="../../generated/MySql.Data/keywords.txt" Link="$(AssemblyName).keywords.txt" >
<EmbeddedResource Include="../../generated/MySql.Data/keywords.txt" Link="$(AssemblyName).keywords.txt">
<LogicalName>$(AssemblyName).keywords.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>
@@ -87,34 +92,31 @@
<None Include="rh.bat" CopyToOutputDirectory="PreserveNewest" />
<None Include="DotnetToolSettings.xml" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<!-- Merge properties and target -->

<PropertyGroup>
<ILMergeDir>..\..\code_drop\merge\</ILMergeDir>
<LogDir>..\..\code_drop\log\</LogDir>
<ILMergeTarget>$(ILMergeDir)$(AssemblyName).exe</ILMergeTarget>
<DropDir>..\..\code_drop\merge\</DropDir>
<Extension>.dll</Extension>
</PropertyGroup>
<Target Name="ILMerge" AfterTargets="Build" Condition="'$(BuildingInsideVisualStudio)' != 'true' and '$(TargetFramework)' == 'net461'">
<ItemGroup>
<ILMergeAssemblies Include="$(OutputPath)*.dll" />
</ItemGroup>
<PropertyGroup>
<IgnoreFile>..\..\build.custom\ilmerge.internalize.ignore.txt</IgnoreFile>
<ILMerge>..\..\lib\ILMerge\ILMerge.exe</ILMerge>
<ILMergeLog>$(LogDir)roundhouse.console.ILMerge.log</ILMergeLog>
<ILMergeSource>$(OutputPath)$(AssemblyName).exe</ILMergeSource>
<ILMergeCommand>$(ILMerge) /internalize:$(IgnoreFile) /target:exe /out:$(ILMergeTarget) /log:$(ILMergeLog) /ndebug /zeroPeKind /allowDup $(ILMergeSource) @(ILMergeAssemblies, ' ')</ILMergeCommand>
</PropertyGroup>
<Delete Files="$(ILMergeLog);$(ILMergeTarget)" Condition="Exists($(ILMergeDir))" />
<MakeDir Directories="$(ILMergeDir)" />
<Message Importance="high" Text="ILMerge-ing into $(ILMergeTarget)" />
<Exec Command="$(ILMergeCommand)" />

<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<Extension>.exe</Extension>
</PropertyGroup>

<PropertyGroup>
<CopySource>$(MSBuildProjectDirectory)/$(OutputPath)/$(TargetFramework)/$(RuntimeIdentifier)/$(AssemblyName)$(Extension)</CopySource>
<CopyDestination>$(DropDir)$(AssemblyName)$(Extension)</CopyDestination>
</PropertyGroup>

<Target Name="CopyOutput" AfterTargets="Build" Condition="'$(BuildingInsideVisualStudio)' != 'true' and '$(TargetFramework)' == 'net461'">
<Message Importance="high" Text="Source: $(CopySource)" />
<Copy SourceFiles="$(CopySource)" DestinationFolder="$(DropDir)" />
</Target>


<!-- Nuspec properties (for generating NuGet package) -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<NuspecFile>roundhouse.nuspec</NuspecFile>
<NuspecProperties>mergedExe=$(ILMergeTarget);version=$(NugetVersion)</NuspecProperties>
<NuspecProperties>mergedExe=$(CopyDestination);version=$(NugetVersion)</NuspecProperties>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
@@ -40,7 +40,7 @@
<PackageReference Include="FluentNHibernate" Version="2.1.2" />
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
<PackageReference Include="NHibernate" Version="5.1.3" />
<PackageReference Include="Npgsql" Version="3.2.7" />
<PackageReference Include="Npgsql" Version="4.0.4" />
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
@@ -74,10 +74,13 @@
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="../../generated/MySql.Data/keywords.txt" Link="$(AssemblyName).keywords.txt" >
<EmbeddedResource Include="../../generated/MySql.Data/keywords.txt" Link="$(AssemblyName).keywords.txt">
<LogicalName>$(AssemblyName).keywords.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="ILMerge" Version="3.0.21" />
</ItemGroup>


<!-- Merge properties and target -->
@@ -95,6 +98,7 @@
<PropertyGroup>
<IgnoreFile>..\..\build.custom\ilmerge.internalize.ignore.txt</IgnoreFile>
<ILMerge>..\..\lib\ILMerge\ILMerge.exe</ILMerge>
<ILMerge>$(NugetPackageRoot)\ilmerge\3.0.21\tools\net452\ILMerge.exe</ILMerge>
<ILMergeLog>$(LogDir)roundhouse.ILMerge.log</ILMergeLog>
<ILMergeCommand>$(ILMerge) /internalize:$(IgnoreFile) /target:dll /out:$(ILMergeTarget) /log:$(ILMergeLog) /ndebug /zeroPeKind /allowDup @(ILMergeAssemblies, ' ')</ILMergeCommand>
</PropertyGroup>
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<CLSCompliant>true</CLSCompliant>
@@ -25,7 +25,7 @@
<PackageReference Include="Microsoft.SqlServer.Compact" Version="4.0.8876.1" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="MySql.Data" Version="8.0.13" />
<PackageReference Include="Npgsql" Version="3.2.7" />
<PackageReference Include="Npgsql" Version="4.0.4" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
@@ -1,4 +1,7 @@
using System;
using System.Data;
using System.Linq;
using System.Reflection;

namespace roundhouse.connections
{
@@ -15,7 +18,26 @@ public AdoNetConnection(IDbConnection server_connection)

public void open()
{
server_connection.Open();
try
{

server_connection.Open(); }

catch (ReflectionTypeLoadException rtle)
{
throw rtle.LoaderExceptions.First();

}

catch (TypeInitializationException tie)
{
var inner = tie.InnerException;
if (inner is ReflectionTypeLoadException r)
{
throw r.LoaderExceptions.First();
}
}

}

public void clear_pool()
Oops, something went wrong.

0 comments on commit 0047ffb

Please sign in to comment.
You can’t perform that action at this time.