Skip to content

Commit 45a63bf

Browse files
authored
Merge pull request #1523 from hazzik/netcoreapp2.0
.NET Core 2.0 and .NET Standard 2.0 support
2 parents 7810b9c + d9df26a commit 45a63bf

File tree

103 files changed

+1170
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1170
-371
lines changed

.travis.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
language: csharp
2+
mono: none
3+
dotnet: 2.1.2
4+
sudo: required
5+
services:
6+
- mysql
7+
- postgresql
8+
- docker
9+
env:
10+
- DB=SqlServer2008 CONNECTION_STRING="Server=localhost;initial catalog=nhibernate;User Id=sa;Password=P@ssw0rd;"
11+
- DB=PostgreSQL CONNECTION_STRING="Host=localhost;Port=5432;Username=postgres;Database=nhibernate;Enlist=true;"
12+
- DB=Firebird
13+
- DB=MySQL CONNECTION_STRING="Server=127.0.0.1;Uid=root;Database=nhibernate;Old Guids=True;"
14+
matrix:
15+
allow_failures:
16+
- env: DB=MySQL CONNECTION_STRING="Server=127.0.0.1;Uid=root;Database=nhibernate;Old Guids=True;"
17+
before_install:
18+
- curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
19+
- curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
20+
- sudo apt-get update -qq
21+
- sudo apt-get install -y powershell
22+
- |-
23+
if [[ "$DB" == "MySQL" ]]
24+
then
25+
echo -e '[server]\nlower_case_table_names=1' | sudo tee -a /etc/mysql/my.cnf
26+
sudo service mysql restart
27+
fi
28+
- |-
29+
if [[ "$DB" == "Firebird" ]]
30+
then
31+
sudo apt-get install -y libicu-dev libtommath-dev curl
32+
curl -L -O https://github.com/FirebirdSQL/firebird/releases/download/R3_0_3/Firebird-3.0.3.32900-0.amd64.tar.gz
33+
tar xzvf Firebird-3.0.3.32900-0.amd64.tar.gz
34+
pushd Firebird-3.0.3.32900-0.amd64
35+
sudo ./install.sh -silent
36+
popd
37+
export $(sudo cat /opt/firebird/SYSDBA.password | grep -v ^# | xargs)
38+
sudo chmod 775 /tmp/firebird
39+
echo -e "nhibernate = /tmp/firebird/nhibernate.fdb" | sudo tee -a /opt/firebird/databases.conf
40+
echo -e "AuthServer = Srp\nAuthClient = Srp\nUserManager = Srp\nWireCrypt = Enabled" | sudo tee -a /opt/firebird/firebird.conf
41+
sudo /opt/firebird/bin/gsec -modify SYSDBA -pw masterkey -admin yes
42+
sudo service firebird restart
43+
fi
44+
before_script:
45+
- if [[ "$DB" == "SqlServer2008" ]]; then docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd" -e "MSSQL_PID=Express" -p 1433:1433 -d --name sqlexpress microsoft/mssql-server-linux:latest; fi
46+
- if [[ "$DB" == "PostgreSQL" ]]; then psql -c "CREATE DATABASE nhibernate;" -U postgres; fi
47+
- if [[ "$DB" == "MySQL" ]]; then mysql -e "CREATE DATABASE IF NOT EXISTS nhibernate;"; fi
48+
script:
49+
- pwsh -noprofile -command "& ./build.ps1 -TaskList Set-Configuration,Test -properties @{\"Database\" = \"$DB\";\"ConnectionString\"=\"$CONNECTION_STRING\"}"

Tools/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net461" />
88
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net461" />
99
<package id="NUnit.Extension.VSProjectLoader" version="3.6.0" targetFramework="net461" />
10-
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.1" targetFramework="net461" />
10+
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2" targetFramework="net461" />
1111
<package id="vswhere" version="2.1.4" targetFramework="net461" />
1212
</packages>

appveyor.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
version: 5.1.0.{build}
2+
image: Visual Studio 2017
3+
environment:
4+
matrix:
5+
- DB: SqlServer2008
6+
CONNECTION_STRING: Server=(local)\SQL2017;User ID=sa;Password=Password12!;initial catalog=nhibernate;
7+
- DB: PostgreSQL
8+
CONNECTION_STRING: Host=localhost;Port=5432;Username=postgres;Password=Password12!;Database=nhibernate;Enlist=true;
9+
- DB: Firebird
10+
- DB: MySQL
11+
CONNECTION_STRING: Server=127.0.0.1;Uid=root;Pwd=Password12!;Database=nhibernate;Old Guids=True;
12+
init:
13+
# Required for having windows endlines in sources zip
14+
- git config --global core.autocrlf true
15+
matrix:
16+
allow_failures:
17+
- DB: MySQL
18+
build: off
19+
before_test:
20+
- ps: |-
21+
switch ($env:DB) {
22+
'Firebird' {
23+
$FireBirdPath = 'C:\firebird'
24+
# Install Firebird
25+
New-Item -ItemType Directory -Force $FireBirdPath > $null
26+
Push-Location $FireBirdPath
27+
Invoke-WebRequest 'https://github.com/FirebirdSQL/firebird/releases/download/R3_0_3/Firebird-3.0.3.32900-0_x64.zip' -OutFile firebird.zip
28+
Unblock-File firebird.zip
29+
7z x firebird.zip
30+
New-Item -ItemType Directory -Force Data
31+
# Declare nhibernate db
32+
Add-Content -Path '.\databases.conf' -Value "`r`nnhibernate = $FireBirdPath\Data\nhibernate.fdb"
33+
# Minimal db settings
34+
Add-Content -Path '.\firebird.conf' -Value "`r`nAuthServer = Srp`r`nAuthClient = Srp`r`nUserManager = Srp`r`nWireCrypt = Enabled"
35+
# Create SYSDBA account
36+
New-Item SYSDBA.sql -Type File
37+
Add-Content -Path '.\SYSDBA.sql' -Value "CREATE USER SYSDBA PASSWORD 'masterkey';`r`nCOMMIT;`r`nQUIT;"
38+
.\isql -user sysdba employee -input SYSDBA.sql
39+
# Start Firebird
40+
.\firebird.exe -a
41+
Pop-Location
42+
}
43+
'MySQL' {
44+
Start-Service 'MySQL57'
45+
# Create nhibernate database (not handled by NHibernate.TestDatabaseSetup.dll)
46+
$env:MYSQL_PWD = 'Password12!'
47+
& 'C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql' -e 'CREATE DATABASE nhibernate;' --user=root
48+
}
49+
'Odbc' { Start-Service 'MSSQL$SQL2017' }
50+
'PostgreSQL' {
51+
# Enable prepared transactions
52+
Add-Content -Path 'C:\Program Files\PostgreSQL\10\data\postgresql.conf' -Value "`r`nmax_prepared_transactions = 100"
53+
Start-Service 'postgresql-x64-10'
54+
}
55+
'SqlServer2008' { Start-Service 'MSSQL$SQL2017' }
56+
'SqlServer2012' { Start-Service 'MSSQL$SQL2017' }
57+
}
58+
test_script:
59+
- cmd: powershell -noprofile -command "& ./build.ps1 -TaskList Set-Configuration,Test -properties @{\"Database\" = \"%DB%\";\"ConnectionString\"=\"%CONNECTION_STRING%\"}"
60+
deploy: off
61+
on_finish:
62+
- ps: |-
63+
$wc = New-Object 'System.Net.WebClient'
64+
Get-Item '*-TestResult.xml' | ForEach-Object {
65+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", $_)
66+
}

build-common/NHibernate.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@
2424

2525
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
2626
<TreatSpecificWarningsAsErrors />
27+
28+
<DisableImplicitPackageTargetFallback>True</DisableImplicitPackageTargetFallback>
2729
</PropertyGroup>
2830
</Project>

build-common/common.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
<property name="vshik.installed" value="false" overwrite="false" />
99
<property name="vshik.path" value="${environment::get-folder-path('ProgramFiles')}/Microsoft Help 2.0 SDK" />
1010

11-
<!--
12-
if nunit2report tasks from http://nunit2report.sourceforge.net/ has been installed
13-
then change this to true. It generates a nice looking html report for the test files
14-
-->
15-
<property name="nunit2report.installed" value="false" overwrite="false" />
16-
1711
<!-- Path to the folder that contain the external assemblies -->
1812
<property name="lib.dir" value="lib" dynamic="true" />
1913

@@ -29,10 +23,11 @@
2923
<property name="project.config" value="debug" overwrite="false" />
3024
<property name="build.name" value="NHibernate-${project.version}" if="${project.config == 'release'}"/>
3125
<property name="build.name" value="NHibernate-${project.version}-${project.config}" unless="${project.config == 'release'}" />
26+
<property name="build.config" value="Release" if="${project.config == 'release'}"/>
27+
<property name="build.config" value="Debug" unless="${project.config == 'release'}" />
3228
<property name="build.root.dir" value="${root.dir}/build/${build.name}" />
3329
<property name="build.dir" value="${build.root.dir}" />
34-
<property name="bin.dir" value="${build.dir}/bin" />
35-
<property name="testresults.dir" value="${bin.dir}/test-results" />
30+
<property name="testresults.dir" value="${build.dir}/bin/test-results" />
3631
<property name="tools.dir" value="${root.dir}/Tools"/>
3732
</target>
3833

build.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
param (
2+
$TaskList = 'Default',
3+
[hashtable]$Properties = @{}
4+
)
5+
6+
Install-Module psake -Force -Scope CurrentUser
7+
Import-Module psake
8+
Invoke-psake -buildFile .\psake.ps1 -nologo -taskList $TaskList -properties $Properties
9+
exit ( [int] ( -not $psake.build_success ) )

default.build

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<target name="init" depends="common.init" description="Initializes build properties" />
1717

1818
<target name="prepare-build-directory" depends="init">
19-
<mkdir dir="${bin.dir}" />
2019
<mkdir dir="${testresults.dir}" />
2120
</target>
2221

@@ -33,10 +32,8 @@
3332
<exec program="dotnet" verbose="true">
3433
<arg value="msbuild" />
3534
<arg value="${root.dir}/src/NHibernate.sln" />
36-
<arg value="/p:OutputPath=&quot;${path::get-full-path(bin.dir)}&quot;" />
3735
<arg value="/p:Platform=&quot;Any CPU&quot;" />
38-
<arg value="/p:Configuration=&quot;Debug&quot;" if="${project.config == 'debug'}" />
39-
<arg value="/p:Configuration=&quot;Release&quot;" if="${project.config == 'release'}" />
36+
<arg value="/p:Configuration=&quot;${build.config}&quot;"/>
4037
<arg value="/p:GeneratePackageOnBuild=&quot;True&quot;" />
4138
<arg value="/p:IncludeSymbols=&quot;True&quot;" />
4239
<arg value="/p:IncludeSource=&quot;True&quot;" />
@@ -76,15 +73,6 @@
7673
program="${async-generator-console}" />
7774
</target>
7875

79-
<target name="test-report" if="${nunit2report.installed}">
80-
<mkdir dir="${build.dir}/testresults" />
81-
<nunit2report out="${build.dir}/testresults/index.html" format="Frames" todir="${build.dir}/testresults">
82-
<fileset>
83-
<include name="${bin.dir}/*results.xml" />
84-
</fileset>
85-
</nunit2report>
86-
</target>
87-
8876
<target name="put-connection-settings-into-defined-app-config">
8977

9078
<!-- make sure the config file is writable -->
@@ -156,7 +144,7 @@
156144
</target>
157145

158146
<target name="put-connection-settings-into-app-config">
159-
<property name="app.config" value="${bin.dir}/${test.file}.dll.config" />
147+
<property name="app.config" value="src/${test.file}/bin/${build.config}/net461/${test.file}.dll.config" />
160148
<call target="put-connection-settings-into-defined-app-config" />
161149
</target>
162150

@@ -166,20 +154,17 @@
166154
<property name="nunit-console" value="${nuget-package-path}/tools/nunit3-console.exe" />
167155
</target>
168156

169-
<target name="run-tests" depends="find-nunit"
170-
description="Run NUnit tests">
171-
<property name="run-tests.failonerror" value="${not property::exists(test.file + '.IgnoreFail')}"/>
172-
<property name="run-tests.x86" value="--x86" unless="${property::exists('nunit-x64')}" />
173-
<property name="run-tests.x86" value="" if="${property::exists('nunit-x64')}" />
174-
<property name="run-tests.teamcity" value="--teamcity" if="${property::exists('config.teamcity')}" />
175-
<property name="run-tests.teamcity" value="" unless="${property::exists('run-tests.teamcity')}" />
176-
<exec program="${nunit-console}" failonerror="${run-tests.failonerror}">
177-
<arg line="${bin.dir}/${test.file}.dll --result=${testresults.dir}/${test.file}.dll-results.xml;format=nunit2 --framework=${framework::get-target-framework()} ${run-tests.teamcity} ${run-tests.x86}" />
157+
<target name="run-tests" depends="find-nunit" description="Run NUnit tests">
158+
<exec program="${nunit-console}" failonerror="${not property::exists(test.file + '.IgnoreFail')}">
159+
<arg value="${root.dir}/src/${test.file}/bin/${build.config}/net461/${test.file}.dll" />
160+
<arg value="--result=${testresults.dir}/${test.file}.dll-results.xml;format=nunit2" />
161+
<arg value="--teamcity" if="${property::exists('config.teamcity')}" />
162+
<arg value="--x86" unless="${property::exists('nunit-x64')}" />
178163
</exec>
179164
</target>
180165

181166
<target name="remove-connection-settings-from-app-config">
182-
<property name="app.config" value="${bin.dir}/${test.file}.dll.config" />
167+
<property name="app.config" value="${root.dir}/src/${test.file}/bin/${build.config}/net461/${test.file}.dll.config" />
183168

184169
<xmlpoke
185170
file="${app.config}"
@@ -222,12 +207,6 @@
222207
<call target="build" />
223208
</target>
224209

225-
<target name="reports" depends="init">
226-
<call target="test-all-frameworks" />
227-
<call target="test-report" />
228-
<call target="coverage-report" />
229-
</target>
230-
231210
<target name="sources-zip" depends="init">
232211
<exec program="git" commandline="archive HEAD --format zip --output &quot;${build.dir}/NHibernate-${project.version}-src.zip&quot;"/>
233212
</target>
@@ -255,42 +234,50 @@
255234

256235
<!--Configuration templates-->
257236
<copy todir="${bin-pack.conf-template}">
258-
<fileset basedir="src/NHibernate.Config.Templates">
237+
<fileset basedir="${root.dir}/src/NHibernate.Config.Templates">
259238
<include name="*"/>
260239
</fileset>
261240
</copy>
262241

263242
<!--Minimal Required Bins-->
264243
<copy todir="${bin-pack.required}">
265-
<fileset basedir="src/NHibernate">
244+
<fileset basedir="${root.dir}/src/NHibernate">
266245
<include name="*.xsd" />
267246
</fileset>
268247
</copy>
269248
<copy todir="${bin-pack.required}">
270-
<fileset basedir="${bin.dir}">
249+
<fileset basedir="${root.dir}/src/NHibernate/bin/${build.config}/net461/">
271250
<include name="Antlr3.Runtime.???" />
272251
<include name="Iesi.Collections.???" />
273252
<include name="NHibernate.???" />
274253
<include name="Remotion.Linq.???" />
275254
<include name="Remotion.Linq.EagerFetching.???" />
276255
</fileset>
277256
</copy>
278-
<!--Required Bins for lazy loading NHibernate.ByteCode.Castle.dll-->
279257
<!-- Tests -->
280-
<copy file="${bin.dir}/TestEmbeddedConfig.cfg.xml" todir="${bin-pack.tests}"/>
281-
<copy file="${bin.dir}/ABC.hbm.xml" todir="${bin-pack.tests}"/>
258+
<copy file="${root.dir}/src/NHibernate.Test/TestEmbeddedConfig.cfg.xml" todir="${bin-pack.tests}"/>
259+
<copy file="${root.dir}/src/NHibernate.DomainModel/ABC.hbm.xml" todir="${bin-pack.tests}"/>
282260
<copy todir="${bin-pack.tests}/DbScripts">
283261
<fileset basedir="${root.dir}/src/NHibernate.Test/DbScripts">
284262
<include name="*.sql" />
285263
</fileset>
286264
</copy>
287265
<copy todir="${bin-pack.tests}">
288-
<fileset basedir="${bin.dir}">
289-
<include name="nunit*" />
290-
<include name="SharpTestsEx*" />
291-
<include name="NHibernate.Domain*" />
292-
<include name="NHibernate.Test*" />
266+
<fileset basedir="${root.dir}/src/NHibernate.Test/bin/${build.config}/net461">
293267
<include name="log4net*" />
268+
<include name="NHibernate.DomainModel.*" />
269+
<include name="NHibernate.Test.*" />
270+
<include name="nunit*" />
271+
</fileset>
272+
</copy>
273+
<copy todir="${bin-pack.tests}">
274+
<fileset basedir="${root.dir}/src/NHibernate.Test.VisualBasic/bin/${build.config}/net461">
275+
<include name="NHibernate.Test.VisualBasic.*" />
276+
</fileset>
277+
</copy>
278+
<copy todir="${bin-pack.tests}">
279+
<fileset basedir="${root.dir}/src/NHibernate.TestDatabaseSetup/bin/${build.config}/net461">
280+
<include name="NHibernate.TestDatabaseSetup.*" />
294281
</fileset>
295282
</copy>
296283
</target>

doc/NHibernate.ndoc.in

Lines changed: 0 additions & 37 deletions
This file was deleted.

doc/NHibernate.shfbproj.template

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@
2525
<IndentHtml>False</IndentHtml>
2626
<HelpFileVersion>${project.version.numeric}</HelpFileVersion>
2727
<DocumentationSources>
28-
<DocumentationSource sourceFile="${bin.dir}/Iesi.Collections.dll" />
29-
<DocumentationSource sourceFile="${bin.dir}/Iesi.Collections.xml" />
30-
<DocumentationSource sourceFile="${bin.dir}/NHibernate.dll" />
31-
<DocumentationSource sourceFile="${bin.dir}/Nhibernate.xml" />
32-
</DocumentationSources>
28+
<DocumentationSource sourceFile="${root.dir}/src/NHibernate/bin/${build.config}/NHibernate.dll" />
29+
<DocumentationSource sourceFile="${root.dir}/src/NHibernate/bin/${build.config}/Nhibernate.xml" />
30+
</DocumentationSources>
3331
</PropertyGroup>
3432
<!-- There are no properties for these two groups but they need to appear in
3533
order for Visual Studio to perform the build. -->

doc/documentation.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
<target name="api" depends="init apidocbuilder-project" description="Generates the API documentation (in MSDN style if available)">
5454
<uptodate property="api.uptodate">
5555
<sourcefiles>
56-
<include name="${bin.dir}/*.dll" />
57-
<include name="${bin.dir}/*.xml" />
56+
<include name="${root.dir}/src/NHibernate/bin/${build.config}/net461/*.dll" />
57+
<include name="${root.dir}/src/NHibernate/bin/${build.config}/net461/*.xml" />
5858
</sourcefiles>
5959
<targetfiles>
6060
<include name="${doc.help2.out.dir}/**" />

0 commit comments

Comments
 (0)