Skip to content

Commit

Permalink
Some rewrites to simplify deploy and dependency management
Browse files Browse the repository at this point in the history
* Added scripts for running PostgreSQL integration tests
* Replaced ILMerge with Costura.Fody
* Fixed some path problems

Packaging restructuring
* Changed all RoundhousE database DLLs to be nuget packages of their own.
* Simplified build scripts
  • Loading branch information
erikbra committed Feb 12, 2019
1 parent f4248c7 commit 47e51aa
Show file tree
Hide file tree
Showing 123 changed files with 6,957 additions and 6,882 deletions.
24 changes: 11 additions & 13 deletions build.ps1
Expand Up @@ -5,6 +5,7 @@ $MSBUILD=msbuild
$root = $PSScriptRoot;

$CODEDROP="$($root)/code_drop";
$PACKAGEDIR="$($CODEDROP)/packages";
$LOGDIR="$($CODEDROP)/log";

$TESTOUTDIR="$($root)/product/roundhouse.tests/bin"
Expand All @@ -25,12 +26,15 @@ If ($onAppVeyor) {
appveyor UpdateBuild -Version "$newVersion"
}

" * Updating NuGet"
nuget update -self

" * Restoring nuget packages"
nuget restore -NonInteractive -Verbosity quiet

# Create output and log dirs if they don't exist (don't know why this is necessary - works on my box...)
If (!(Test-Path $CODEDROP)) {
$null = mkdir $CODEDROP;
If (!(Test-Path $PACKAGEDIR)) {
$null = mkdir $PACKAGEDIR;
}
If (!(Test-Path $LOGDIR)) {
$null = mkdir $LOGDIR;
Expand All @@ -43,19 +47,13 @@ $file = $(Get-ChildItem -Recurse -Include MySql.Data.dll ~/.nuget/packages/mysql


" * Building and packaging"
msbuild /t:"Build" /p:DropFolder=$CODEDROP /p:Version="$($gitVersion.FullSemVer)" /p:NoPackageAnalysis=true /nologo /v:q /fl /flp:"LogFile=$LOGDIR/msbuild.log;Verbosity=n" /p:Configuration=Build /p:Platform="Any CPU"

"`n - Packaging net461 packages`n"

nuget pack product/roundhouse.console/roundhouse.nuspec -OutputDirectory "$CODEDROP/packages" -Properties "mergedExe=$CODEDROP/merge/rh.exe" -Verbosity quiet -NoPackageAnalysis -Version "$($gitVersion.FullSemVer)"
msbuild /t:"Pack" product/roundhouse.lib.merged/roundhouse.lib.merged.csproj /p:DropFolder=$CODEDROP /p:Version="$($gitVersion.FullSemVer)" /p:NoPackageAnalysis=true /nologo /v:q /fl /flp:"LogFile=$LOGDIR/msbuild.roundhouse.lib.pack.log;Verbosity=n" /p:Configuration=Build /p:Platform="Any CPU"
msbuild /t:"Pack" product/roundhouse.tasks/roundhouse.tasks.csproj /p:DropFolder=$CODEDROP /p:Version="$($gitVersion.FullSemVer)" /p:NoPackageAnalysis=true /nologo /v:q /fl /flp:"LogFile=$LOGDIR/msbuild.roundhouse.tasks.pack.log;Verbosity=n" /p:Configuration=Build /p:Platform="Any CPU"

"`n - Packaging netcoreapp2.1 global tool dotnet-roundhouse`n"
dotnet build --no-restore -v q -p:Version="$($gitVersion.FullSemVer)" -p:Configuration=Release -p:Platform="Any CPU"
dotnet publish --no-restore -v q -p:Version="$($gitVersion.FullSemVer)" -p:Configuration=Release -p:Platform="Any CPU" -p:TargetFramework=netcoreapp2.1 product/roundhouse.console
dotnet pack --no-build -v q -p:Version="$($gitVersion.FullSemVer)" -p:NoPackageAnalysis=true -p:Configuration=Release -p:Platform="Any CPU" -o ${PACKAGEDIR}

dotnet publish -v q --no-restore product/roundhouse.console -p:Version="$($gitVersion.FullSemVer)" -p:NoPackageAnalysis=true -p:TargetFramework=netcoreapp2.1 -p:Version="$($gitVersion.FullSemVer)" -p:RunILMerge=false -p:Configuration=Build -p:Platform="Any CPU"
dotnet pack -v q --no-restore product/roundhouse.console -p:NoPackageAnalysis=true -p:TargetFramework=netcoreapp2.1 -o $CODEDROP/packages -p:Version="$($gitVersion.FullSemVer)" -p:RunILMerge=false -p:Configuration=Build -p:Platform="Any CPU"
" * Packaging netcoreapp2.1 global tool dotnet-roundhouse`n"

nuget pack -Verbosity quiet -outputdirectory ${PACKAGEDIR} .\product\roundhouse.console\roundhouse.tool.nuspec -Properties "Version=$($gitVersion.FullSemVer);NoPackageAnalysis=true"

# AppVeyor runs the test automagically, no need to run explicitly with nunit-console.exe.
# But we want to run the tests on localhost too.
Expand Down
243 changes: 109 additions & 134 deletions product/roundhouse.console/roundhouse.console.csproj
@@ -1,135 +1,110 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFramework)' == ''">netcoreapp2.1;net461</TargetFrameworks>
<TargetFramework Condition="'$(TargetFramework)' == ''">net461</TargetFramework>
<CLSCompliant>true</CLSCompliant>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<OutputPath>bin\</OutputPath>
<RootNamespace>roundhouse.console</RootNamespace>
<AssemblyName>rh</AssemblyName>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<NoWarn>NU1701</NoWarn>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<VersionPrefix>0.8.9</VersionPrefix>
<VersionSuffix>alpha</VersionSuffix>
<Version Condition="'$(Version)' == ''">$(VersionPrefix)</Version>
<Version Condition="'$(Version)' == '$(VersionPrefix)' And '$(VersionSuffix)' != ''">$(Version)-$(VersionSuffix)</Version>
<NugetVersion Condition="'$(NugetVersion)' == ''">$(Version)</NugetVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<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" />
<PackageReference Include="NHibernate" Version="5.1.3" />
<PackageReference Include="NHibernate.JetDriver" Version="2.0.0.1002" />
<PackageReference Include="log4net" Version="2.0.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Polly" Version="6.1.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
<PackageReference Include="System.Security.Principal.Windows" Version="4.5.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ProjectReference Include="..\roundhouse.databases.access\roundhouse.databases.access.csproj" />
<ProjectReference Include="..\roundhouse.databases.oracle\roundhouse.databases.oracle.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\roundhouse.databases.sqlserver\roundhouse.databases.sqlserver.csproj" />
<ProjectReference Include="..\roundhouse.databases.sqlite\roundhouse.databases.sqlite.csproj" />
<ProjectReference Include="..\roundhouse.databases.postgresql\roundhouse.databases.postgresql.csproj" />
<ProjectReference Include="..\roundhouse.databases.sqlserverce\roundhouse.databases.sqlserverce.csproj" />
<ProjectReference Include="..\roundhouse.databases.mysql\roundhouse.databases.mysql.csproj" />
<ProjectReference Include="..\roundhouse.databases.sqlserver2000\roundhouse.databases.sqlserver2000.csproj" />
<ProjectReference Include="..\roundhouse\roundhouse.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\docs\logo\roundhouse.ico">
<Link>roundhouse.ico</Link>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="../../generated/MySql.Data/keywords.txt" Link="$(AssemblyName).keywords.txt">
<LogicalName>$(AssemblyName).keywords.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<None Include="rh" CopyToOutputDirectory="PreserveNewest" />
<None Include="rh.bat" CopyToOutputDirectory="PreserveNewest" />
<None Include="DotnetToolSettings.xml" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<PropertyGroup>
<DropDir>..\..\code_drop\merge\</DropDir>
<Extension>.dll</Extension>
</PropertyGroup>

<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=$(CopyDestination);version=$(NugetVersion)</NuspecProperties>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<NuspecFile>roundhouse.tool.nuspec</NuspecFile>
<NuspecProperties>version=$(NugetVersion)</NuspecProperties>
</PropertyGroup>


<!-- Copy to drop folder after packaging -->
<Target Name="CopyToDropFolder" AfterTargets="Pack" Condition="'$(DropFolder)' != ''">
<ItemGroup>
<NugetPackages Include="$(OutputPath)..\**\*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(NugetPackages)" DestinationFolder="$(DropFolder)\packages" />
</Target>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFramework)' == ''">netcoreapp2.1;net461</TargetFrameworks>
<TargetFramework Condition="'$(TargetFramework)' == ''">net461</TargetFramework>
<CLSCompliant>true</CLSCompliant>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<OutputPath>bin\</OutputPath>
<RootNamespace>roundhouse.console</RootNamespace>
<AssemblyName>rh</AssemblyName>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<NoWarn>NU1701</NoWarn>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Version Condition="'$(Version)' == ''">1.0.0</Version>
<NugetVersion Condition="'$(NugetVersion)' == ''">$(Version)</NugetVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<NuspecFile>roundhouse.tool.nuspec</NuspecFile>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.Security.Principal.Windows" Version="4.5.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="Costura.Fody" Version="3.3.2" />
<PackageReference Include="Fody" Version="3.3.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ProjectReference Include="..\roundhouse.databases.access\roundhouse.databases.access.csproj" />
<ProjectReference Include="..\roundhouse.databases.oracle\roundhouse.databases.oracle.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\roundhouse.databases.sqlserver\roundhouse.databases.sqlserver.csproj" />
<ProjectReference Include="..\roundhouse.databases.sqlite\roundhouse.databases.sqlite.csproj" />
<ProjectReference Include="..\roundhouse.databases.postgresql\roundhouse.databases.postgresql.csproj" />
<ProjectReference Include="..\roundhouse.databases.sqlserverce\roundhouse.databases.sqlserverce.csproj" />
<ProjectReference Include="..\roundhouse.databases.mysql\roundhouse.databases.mysql.csproj" />
<ProjectReference Include="..\roundhouse.databases.sqlserver2000\roundhouse.databases.sqlserver2000.csproj" />
<ProjectReference Include="..\roundhouse.core\roundhouse.core.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\docs\logo\roundhouse.ico">
<Link>roundhouse.ico</Link>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="../../generated/MySql.Data/keywords.txt" Link="$(AssemblyName).keywords.txt">
<LogicalName>$(AssemblyName).keywords.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<None Include="rh" CopyToOutputDirectory="PreserveNewest" />
<None Include="rh.bat" CopyToOutputDirectory="PreserveNewest" />
<None Include="DotnetToolSettings.xml" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>


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

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<NuspecFile>roundhouse.tool.nuspec</NuspecFile>
<NuspecProperties>version=$(NugetVersion)</NuspecProperties>
</PropertyGroup>


<!-- Copy to drop folder after packaging -->
<Target Name="CopyToDropFolder" AfterTargets="Pack" Condition="'$(DropFolder)' != ''">
<ItemGroup>
<NugetPackages Include="$(OutputPath)..\**\*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(NugetPackages)" DestinationFolder="$(DropFolder)\packages" />
</Target>
</Project>
6 changes: 3 additions & 3 deletions product/roundhouse.console/roundhouse.nuspec
Expand Up @@ -9,14 +9,14 @@
<summary>RoundhousE - Professional Database Change and Versioning Management</summary>
<description>RoundhousE is a Professional Database Change and Versioning Management tool. Type rh /? for options</description>
<projectUrl>http://projectroundhouse.org</projectUrl>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<license type="expression">Apache-2.0</license>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<tags>roundhouse db migration database migrator chucknorris</tags>
<dependencies />
<iconUrl>https://raw.github.com/chucknorris/roundhouse/master/nuget/RoundhousE_Logo.NuGet.jpg</iconUrl>
<iconUrl>https://raw.github.com/chucknorris/roundhouse/master/nuget/RoundhousE_Logo.NuGet.jpg</iconUrl>
</metadata>
<files>
<file src="$mergedExe$" target="tools\" />
<file src="bin\net461\win7-x86\rh.exe" target="tools\" />
<file src="..\..\docs\legal\*" target="tools\" />
</files>
</package>
4 changes: 2 additions & 2 deletions product/roundhouse.console/roundhouse.tool.nuspec
Expand Up @@ -6,10 +6,10 @@
<version>$version$</version>
<authors>Rob Reynolds, Andy Davis, Erik A. Brandstadmoen</authors>
<owners>Rob Reynolds, Andy Davis, Erik A. Brandstadmoen</owners>
<summary>.NET Core global too for RoundhousE - Professional Database Change and Versioning Management</summary>
<summary>.NET Core global tool for RoundhousE - Professional Database Change and Versioning Management</summary>
<description>RoundhousE is a Professional Database Change and Versioning Management tool. Type rh /? for options</description>
<projectUrl>http://projectroundhouse.org</projectUrl>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<license type="expression">Apache-2.0</license>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<tags>roundhouse db migration database migrator chucknorris</tags>
<packageTypes>
Expand Down

0 comments on commit 47e51aa

Please sign in to comment.