Skip to content

Commit 95c43e4

Browse files
bahusoidfredericDelaporte
authored andcommitted
Refactor to simplify netfx retargeting (#2024)
1 parent 11bc49d commit 95c43e4

File tree

7 files changed

+19
-25
lines changed

7 files changed

+19
-25
lines changed

build-common/NHibernate.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
<NhAppTargetFrameworks Condition ="$(NhAppTargetFrameworks) == ''">net461;netcoreapp2.0</NhAppTargetFrameworks>
1616
<NhLibTargetFrameworks Condition ="$(NhLibTargetFrameworks) == ''">net461;netcoreapp2.0;netstandard2.0</NhLibTargetFrameworks>
17+
<NhNetFx>false</NhNetFx>
18+
<NhNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</NhNetFx>
19+
<DefineConstants Condition="$(NhNetFx) AND $(NhVbNet) == ''" >NETFX;$(DefineConstants)</DefineConstants>
1720

1821
<Product>NHibernate</Product>
1922
<Company>NHibernate.info</Company>

default.build

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
>
77

88
<property name="root.dir" value="." />
9+
<property name="target.dir" value="net461" />
910

1011
<include buildfile="${root.dir}/build-common/common.xml" />
1112

@@ -144,7 +145,7 @@
144145
</target>
145146

146147
<target name="put-connection-settings-into-app-config">
147-
<property name="app.config" value="src/${test.file}/bin/${build.config}/net461/${test.file}.dll.config" />
148+
<property name="app.config" value="src/${test.file}/bin/${build.config}/${target.dir}/${test.file}.dll.config" />
148149
<call target="put-connection-settings-into-defined-app-config" />
149150
</target>
150151

@@ -156,15 +157,15 @@
156157

157158
<target name="run-tests" depends="find-nunit" description="Run NUnit tests">
158159
<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="${root.dir}/src/${test.file}/bin/${build.config}/${target.dir}/${test.file}.dll" />
160161
<arg value="--result=${testresults.dir}/${test.file}.dll-results.xml;format=nunit2" />
161162
<arg value="--teamcity" if="${property::exists('config.teamcity')}" />
162163
<arg value="--x86" unless="${property::exists('nunit-x64')}" />
163164
</exec>
164165
</target>
165166

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

169170
<xmlpoke
170171
file="${app.config}"
@@ -246,7 +247,7 @@
246247
</fileset>
247248
</copy>
248249
<copy todir="${bin-pack.required}">
249-
<fileset basedir="${root.dir}/src/NHibernate/bin/${build.config}/net461/">
250+
<fileset basedir="${root.dir}/src/NHibernate/bin/${build.config}/${target.dir}/">
250251
<include name="Antlr3.Runtime.???" />
251252
<include name="Iesi.Collections.???" />
252253
<include name="NHibernate.???" />
@@ -263,20 +264,20 @@
263264
</fileset>
264265
</copy>
265266
<copy todir="${bin-pack.tests}">
266-
<fileset basedir="${root.dir}/src/NHibernate.Test/bin/${build.config}/net461">
267+
<fileset basedir="${root.dir}/src/NHibernate.Test/bin/${build.config}/${target.dir}">
267268
<include name="log4net*" />
268269
<include name="NHibernate.DomainModel.*" />
269270
<include name="NHibernate.Test.*" />
270271
<include name="nunit*" />
271272
</fileset>
272273
</copy>
273274
<copy todir="${bin-pack.tests}">
274-
<fileset basedir="${root.dir}/src/NHibernate.Test.VisualBasic/bin/${build.config}/net461">
275+
<fileset basedir="${root.dir}/src/NHibernate.Test.VisualBasic/bin/${build.config}/${target.dir}">
275276
<include name="NHibernate.Test.VisualBasic.*" />
276277
</fileset>
277278
</copy>
278279
<copy todir="${bin-pack.tests}">
279-
<fileset basedir="${root.dir}/src/NHibernate.TestDatabaseSetup/bin/${build.config}/net461">
280+
<fileset basedir="${root.dir}/src/NHibernate.TestDatabaseSetup/bin/${build.config}/${target.dir}">
280281
<include name="NHibernate.TestDatabaseSetup.*" />
281282
</fileset>
282283
</copy>

src/NHibernate.DomainModel/NHibernate.DomainModel.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
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>
129
<ItemGroup>
1310
<None Remove="**\*.hbm.xml" />
1411
</ItemGroup>

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<NhVbNet>true</NhVbNet>
4+
</PropertyGroup>
25
<Import Project="../../build-common/NHibernate.props" />
36
<PropertyGroup>
47
<Description>The Visual Basic Unit Tests for NHibernate.</Description>
@@ -13,8 +16,8 @@
1316
<OutputType>Exe</OutputType>
1417
<GenerateProgramFile>false</GenerateProgramFile>
1518
</PropertyGroup>
16-
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
17-
<DefineConstants>NET461,$(DefineConstants)</DefineConstants>
19+
<PropertyGroup Condition="$(NhNetFx)">
20+
<DefineConstants>NETFX,$(DefineConstants)</DefineConstants>
1821
</PropertyGroup>
1922
<ItemGroup>
2023
<None Remove="**\*.hbm.xml" />
@@ -41,4 +44,4 @@
4144
<ItemGroup>
4245
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
4346
</ItemGroup>
44-
</Project>
47+
</Project>

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
88
<ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
99
</PropertyGroup>
10-
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
11-
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>
12-
</PropertyGroup>
1310
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
1411
<OutputType>Exe</OutputType>
1512
<GenerateProgramFile>false</GenerateProgramFile>
@@ -58,7 +55,7 @@
5855
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="6.3.0" />
5956
<PackageReference Include="Npgsql" Version="4.0.3" />
6057
</ItemGroup>
61-
<ItemGroup Condition="'$(TargetFramework)'=='net461'">
58+
<ItemGroup Condition="$(NhNetFx)">
6259
<Reference Include="System.Configuration" />
6360
<Reference Include="System.Runtime" />
6461
<Reference Include="System.Transactions" />

src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<IsTestProject>true</IsTestProject>
88
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
99
</PropertyGroup>
10-
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
11-
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>
12-
</PropertyGroup>
1310
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
1411
<OutputType>Exe</OutputType>
1512
<GenerateProgramFile>false</GenerateProgramFile>

src/NHibernate/NHibernate.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
<PackageTags>ORM; O/RM; DataBase; DAL; ObjectRelationalMapping; NHibernate; ADO.Net; Core</PackageTags>
1515
</PropertyGroup>
1616

17-
<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
18-
<DefineConstants>NETFX;$(DefineConstants)</DefineConstants>
19-
</PropertyGroup>
20-
2117
<ItemGroup>
2218
<None Remove="**\*.g" />
2319
<None Remove="**\*.xsd" />
@@ -46,7 +42,7 @@
4642
<PackageReference Include="Remotion.Linq.EagerFetching" Version="[2.2.0, 3.0)" />
4743
</ItemGroup>
4844

49-
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
45+
<ItemGroup Condition="$(NhNetFx)">
5046
<Reference Include="System.ServiceModel" />
5147
<Reference Include="System.Transactions" />
5248
<Reference Include="System.Configuration" />

0 commit comments

Comments
 (0)