Skip to content

Commit 90a6d1a

Browse files
committed
Add .NET Core 2.0 and .NET Standard 2.0 builds
1 parent c4eb575 commit 90a6d1a

File tree

95 files changed

+695
-337
lines changed

Some content is hidden

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

95 files changed

+695
-337
lines changed

Tools/packages.config

+1-1
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>

build-common/NHibernate.props

+2
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

+3-8
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

default.build

+28-41
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

-37
This file was deleted.

doc/NHibernate.shfbproj.template

+3-5
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

+2-2
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}/**" />

src/NHibernate.DomainModel/NHibernate.DomainModel.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
<Import Project="../../build-common/NHibernate.props" />
33
<PropertyGroup>
44
<Description>The Domain Model used by the Unit Tests.</Description>
5-
<TargetFramework>net461</TargetFramework>
5+
<TargetFrameworks>netstandard2.0;net461;netcoreapp2.0</TargetFrameworks>
66
<IsTestProject>true</IsTestProject>
77
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
88
</PropertyGroup>
9+
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
10+
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>
11+
</PropertyGroup>
912
<ItemGroup>
1013
<None Remove="**\*.hbm.xml" />
1114
</ItemGroup>

src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22
<Import Project="../../build-common/NHibernate.props" />
33
<PropertyGroup>
44
<Description>The Visual Basic Unit Tests for NHibernate.</Description>
5-
<TargetFramework>net461</TargetFramework>
5+
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
66
<IsTestProject>true</IsTestProject>
77
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
88
<OptionExplicit>On</OptionExplicit>
99
<OptionStrict>On</OptionStrict>
1010
</PropertyGroup>
11+
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
12+
<DefineConstants>NETCOREAPP2_0,$(DefineConstants)</DefineConstants>
13+
</PropertyGroup>
14+
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
15+
<DefineConstants>NETFX,NET461,$(DefineConstants)</DefineConstants>
16+
</PropertyGroup>
1117
<ItemGroup>
1218
<None Remove="**\*.hbm.xml" />
1319
</ItemGroup>
20+
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
21+
<Compile Remove="**\Issues\NH3302\**" />
22+
</ItemGroup>
1423
<ItemGroup>
1524
<EmbeddedResource Include="**\*.hbm.xml" Exclude="bin\**\*.*" />
1625
</ItemGroup>

src/NHibernate.Test/Ado/BatcherFixture.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public void OneRoundTripUpdate()
8686
Cleanup();
8787
}
8888

89+
#if NETFX
8990
[Test, Ignore("Not fixed yet.")]
9091
[Description("SqlClient: The batcher should run all different INSERT queries in only one roundtrip.")]
9192
public void SqlClientOneRoundTripForUpdateAndInsert()
@@ -95,7 +96,7 @@ public void SqlClientOneRoundTripForUpdateAndInsert()
9596

9697
FillDb();
9798

98-
using(var sqlLog = new SqlLogSpy())
99+
using (var sqlLog = new SqlLogSpy())
99100
using (ISession s = Sfi.OpenSession())
100101
using (ITransaction tx = s.BeginTransaction())
101102
{
@@ -140,7 +141,7 @@ public void BatchedoutputShouldBeFormatted()
140141

141142
Cleanup();
142143
}
143-
144+
#endif
144145

145146
[Test]
146147
[Description("The batcher should run all DELETE queries in only one roundtrip.")]

src/NHibernate.Test/App.config

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@
3131
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
3232

3333
<property name="connection.driver_class">NHibernate.Driver.Sql2008ClientDriver</property> <!-- Shouldn't be necessary, but is required by some tests -->
34-
<property name="connection.connection_string_name">TestConnectionString</property>
34+
<property name="connection.connection_string">Server=localhost\sqlexpress;Database=nhibernate;Integrated Security=SSPI</property>
3535
<property name="connection.provider">NHibernate.Test.DebugConnectionProvider, NHibernate.Test</property>
3636
<property name="connection.isolation">ReadCommitted</property> <!-- See System.Data.IsolationLevel for valid values -->
37-
<!--property name="connection.connection_string" /-->
3837

3938
<property name="cache.provider_class">NHibernate.Cache.HashtableCacheProvider, NHibernate</property>
4039
<property name="cache.use_query_cache">true</property>

src/NHibernate.Test/Async/Ado/BatcherFixture.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public async Task OneRoundTripUpdateAsync()
9898
await (CleanupAsync());
9999
}
100100

101+
#if NETFX
101102
[Test, Ignore("Not fixed yet.")]
102103
[Description("SqlClient: The batcher should run all different INSERT queries in only one roundtrip.")]
103104
public async Task SqlClientOneRoundTripForUpdateAndInsertAsync()
@@ -107,7 +108,7 @@ public async Task SqlClientOneRoundTripForUpdateAndInsertAsync()
107108

108109
await (FillDbAsync());
109110

110-
using(var sqlLog = new SqlLogSpy())
111+
using (var sqlLog = new SqlLogSpy())
111112
using (ISession s = Sfi.OpenSession())
112113
using (ITransaction tx = s.BeginTransaction())
113114
{
@@ -152,7 +153,7 @@ public async Task BatchedoutputShouldBeFormattedAsync()
152153

153154
await (CleanupAsync());
154155
}
155-
156+
#endif
156157

157158
[Test]
158159
[Description("The batcher should run all DELETE queries in only one roundtrip.")]

src/NHibernate.Test/Async/CfgTest/ConfigurationSerializationTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class ConfigurationSerializationTestsAsync
2828
[Test]
2929
public async Task Basic_CRUD_should_workAsync()
3030
{
31+
TestsContext.AssumeSystemTypeIsSerializable();
32+
3133
Assembly assembly = Assembly.Load("NHibernate.DomainModel");
3234
var cfg = new Configuration();
3335
if (TestConfigurationHelper.hibernateConfigFile != null)

src/NHibernate.Test/Async/ConnectionTest/AggressiveReleaseTest.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ protected override void Done()
5858
[Test]
5959
public async Task SerializationOnAfterStatementAggressiveReleaseAsync()
6060
{
61+
TestsContext.AssumeSystemTypeIsSerializable();
62+
6163
Prepare();
6264
ISession s = GetSessionUnderTest();
6365
Silly silly = new Silly("silly");
@@ -79,6 +81,8 @@ public async Task SerializationOnAfterStatementAggressiveReleaseAsync()
7981
[Test]
8082
public async Task SerializationFailsOnAfterStatementAggressiveReleaseWithOpenResourcesAsync()
8183
{
84+
TestsContext.AssumeSystemTypeIsSerializable();
85+
8286
Prepare();
8387
ISession s = GetSessionUnderTest();
8488

@@ -258,4 +262,4 @@ public async Task ConnectionMaintanenceDuringFlushAsync()
258262
Done();
259263
}
260264
}
261-
}
265+
}

0 commit comments

Comments
 (0)