Skip to content

Commit 54856a2

Browse files
NHV-136 - Support .Net Core/Standard
1 parent 00b7d42 commit 54856a2

File tree

66 files changed

+755
-1569
lines changed

Some content is hidden

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

66 files changed

+755
-1569
lines changed

NHibernate.Validator.nuspec

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<id>NHibernate.Validator</id>
55
<title>NHibernate Validator</title>
6-
<version>5.0.0.4000</version>
6+
<version>5.0.0</version>
77
<authors>Dario Quintana, Fabio Maulo, Gustavo Ringel, NHibernate community</authors>
88
<owners>Dario Quintana, Fabio Maulo, Gustavo Ringel</owners>
99
<licenseUrl>https://raw.githubusercontent.com/nhibernate/NHibernate-Validator/master/LICENSE.txt</licenseUrl>
@@ -16,14 +16,19 @@
1616
<description>NHibernate Validator is a powerful and extensible framework to validate objects using the .Net Platform. Born as a port of Hibernate Validator 3.0.0 project at december of 2007. Later on, many improvements and changes were made to the Core and API, and now we can say that NHibernate Validator is more than just a port. NHibernate Validator is entirely written in C#. The first release of NHibernate Validator was entirely developed by Dario Quintana, Gustavo Ringel and Fabio Maulo.</description>
1717
<tags>NHibernate Validator Validation NHV</tags>
1818
<dependencies>
19-
<group targetFramework=".NETFramework4.6.1">
19+
<group targetFramework="net461">
2020
<dependency id="Iesi.Collections" version="4.0.2" exclude="Build,Analyzers" />
2121
<dependency id="NHibernate" version="5.0.0" exclude="Build,Analyzers" />
2222
</group>
23+
<group targetFramework="netstandard2.0">
24+
<dependency id="Iesi.Collections" version="4.0.4" exclude="Build,Analyzers" />
25+
<dependency id="NHibernate" version="5.1.0" exclude="Build,Analyzers" />
26+
</group>
2327
</dependencies>
2428
</metadata>
2529
<files>
26-
<file src="Build\NuGetDeploy\bin\**\*" target="lib\net461" />
30+
<file src="Build\NuGetDeploy\bin\net461\**\*" target="lib\net461" />
31+
<file src="Build\NuGetDeploy\bin\netstandard2.0\**\*" target="lib\netstandard2.0" />
2732
<file src="Build\NuGetDeploy\*" target="." />
2833
</files>
29-
</package>
34+
</package>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project>
2+
<PropertyGroup>
3+
<VersionMajor Condition="'$(VersionMajor)' == ''">5</VersionMajor>
4+
<VersionMinor Condition="'$(VersionMinor)' == ''">0</VersionMinor>
5+
<VersionPatch Condition="'$(VersionPatch)' == ''">0</VersionPatch>
6+
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
7+
8+
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
9+
<AssemblyVersion>$(VersionMajor).$(VersionMinor).0.0</AssemblyVersion>
10+
<FileVersion>$(VersionPrefix).0</FileVersion>
11+
12+
<Company>NHibernate.info</Company>
13+
<Copyright>Licensed under LGPL.</Copyright>
14+
<Authors>Dario Quintana, Fabio Maulo, Gustavo Ringel, NHibernate community</Authors>
15+
<NeutralLanguage>en-US</NeutralLanguage>
16+
<PackageIconUrl>https://raw.githubusercontent.com/nhibernate/NHibernate-Validator/master/art/logo-nhv-for-nuget.jpg</PackageIconUrl>
17+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
18+
<PackageLicenseUrl>https://raw.githubusercontent.com/nhibernate/NHibernate-Validator/master/LICENSE.txt</PackageLicenseUrl>
19+
<PackageProjectUrl>https://github.com/nhibernate/nhibernate-validator</PackageProjectUrl>
20+
<PackageTags>NHibernate; Validator; Validation; NHV</PackageTags>
21+
<RepositoryUrl>https://github.com/nhibernate/NHibernate-Validator.git</RepositoryUrl>
22+
<RepositoryType>git</RepositoryType>
23+
24+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
25+
<TreatSpecificWarningsAsErrors />
26+
</PropertyGroup>
27+
</Project>

build-common/common-project.xml

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
2727
Other predefined targets are:
2828
29-
- common.generate-assemblyinfo
30-
generate an AssemblyInfo.cs file from assembly.* NAnt properties.
31-
3229
- common.run-tests
3330
run compiled NUnit tests.
3431
@@ -38,54 +35,14 @@
3835

3936
<include buildfile="common.xml" />
4037

41-
<target name="common.set-assembly-attribute-values">
42-
<property overwrite="false" name="assembly.is-cls-compliant" value="true" />
43-
<property overwrite="false" name="assembly.allow-partially-trusted-callers" value="true" />
44-
<property overwrite="false" name="assembly.description" value="" />
45-
<property overwrite="false" name="assembly.product" value="${project::get-name()}" />
46-
<property overwrite="false" name="assembly.company" value="${project.company}" />
47-
<property overwrite="false" name="assembly.title" value="${project::get-name()}" />
48-
<property overwrite="false" name="assembly.version" value="${project.version.numeric}" />
49-
<property overwrite="false" name="assembly.version.informational" value="${project.version.numeric}" />
50-
<property overwrite="false" name="assembly.version.file" value="${project.version.numeric}" />
51-
<property overwrite="false" name="assembly.copyright" value="Licensed under LGPL." />
52-
</target>
53-
54-
<target name="common.generate-assemblyinfo"
55-
depends="common.init common.set-assembly-attribute-values"
56-
description="Generate AssemblyInfo.cs using assembly.* properties."
57-
>
58-
<asminfo output="Properties\AssemblyInfo.cs" language="CSharp">
59-
<imports>
60-
<import namespace="System" />
61-
<import namespace="System.Reflection" />
62-
<import namespace="System.Runtime.CompilerServices" />
63-
<import namespace="System.Security" if="${assembly.allow-partially-trusted-callers}" />
64-
</imports>
65-
<attributes>
66-
<attribute type="CLSCompliantAttribute" value="${assembly.is-cls-compliant}" />
67-
<attribute type="AssemblyTitleAttribute" value="${assembly.title}" />
68-
<attribute type="AssemblyDescriptionAttribute" value="${assembly.description}" />
69-
<attribute type="AssemblyCompanyAttribute" value="${assembly.company}" />
70-
<attribute type="AssemblyProductAttribute" value="${assembly.product}" />
71-
<attribute type="AssemblyCopyrightAttribute" value="${assembly.copyright}" />
72-
<attribute type="AssemblyVersionAttribute" value="${assembly.version}" />
73-
<attribute type="AssemblyInformationalVersionAttribute" value="${assembly.version.informational}" />
74-
<attribute type="AssemblyFileVersionAttribute" value="${assembly.version.file}" />
75-
<attribute type="AssemblyDelaySignAttribute" value="false" />
76-
<!--<attribute type="AssemblyKeyFileAttribute" value="..\..\..\..\src\NHibernate.Validator.snk" />-->
77-
78-
<!-- For some reason, NAnt doesn't detect that APTCA has a public no-argument constructor -->
79-
<attribute asis="true" type="AllowPartiallyTrustedCallersAttribute" if="${assembly.allow-partially-trusted-callers}" />
80-
</attributes>
81-
</asminfo>
82-
</target>
83-
8438
<target name="common.run-tests"
8539
description="Run NUnit tests">
8640
<call target="common.find-nunit" unless="${property::exists('nunit.found')}" />
8741
<exec program="${nunit-console}">
88-
<arg line="${bin.dir}/${project::get-name()}.dll --result=${testresults.dir}/${project::get-name()}.dll-results.xml;format=nunit2" />
42+
<arg line="bin/${build.config}/${net.target-fx}/${project::get-name()}.dll --result=${testresults.dir}/${project::get-name()}.dll-${net.target-fx}-results.xml;format=nunit2" />
43+
</exec>
44+
<exec program="dotnet">
45+
<arg line="bin/${build.config}/${net.core-fx}/${project::get-name()}.dll --labels=before --nocolor --result=${testresults.dir}/${project::get-name()}.dll-${net.core-fx}-results.xml" />
8946
</exec>
9047
</target>
9148

build-common/common.xml

Lines changed: 5 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,28 @@
11
<?xml version="1.0" ?>
22
<project xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd">
3-
4-
5-
6-
<!-- Generating AssemblyInfo files for Visual Studio -->
7-
<property name="visual-studio" value="false" overwrite="false" />
83

94
<property name="framework.family" value="${framework::get-family(framework::get-target-framework())}"/>
105
<property name="framework.version" value="${framework::get-version(framework::get-target-framework())}"/>
116

12-
<property name="NHibernate.lib" value="../../lib/${framework.family}/${framework.version}" />
13-
14-
<!--
15-
These are used to set the correct attributes in AssemblyInfo.cs.
16-
-->
17-
<property name="project.company" value="NHibernate Community - http://nhibernate.info/" />
18-
19-
<!--
20-
Version number computation
21-
22-
JBoss product versioning guidelines (http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossProductVersioning)
23-
say we are supposed to use version numbers formatted like major.minor.patch.qualifier, where
24-
qualifier is alphanumeric (Alpha#, Beta#, CR#, GA, SP#), and the numeric part may be anything, e.g.
25-
a time/date stamp, a SVN revision number and so on.
26-
27-
I'm only going to use simple sequential numbers for now and the script below is used to translate
28-
the alphanumeric version into a numeric assembly version: x.y.z.qN is translated into x.y.z.(base+N)
29-
where base is 1000 for Alpha, 2000 for Beta, 3000 for CR, and 4000 for both GA and SP (so GA is
30-
effectively SP0).
31-
-->
32-
33-
<property name="project.version" value="5.0.0.GA" overwrite="false" />
34-
35-
<!-- Compute short project version (major.minor) using a regex -->
36-
<regex input="${project.version}" pattern="^(?'shortversion'\d+\.\d+)" />
37-
<property name="project.version.short" value="${shortversion}" />
38-
39-
<!-- Compute and set project.version.numeric from project.version if it hasn't been set already -->
40-
<if test="${not property::exists('project.version.numeric')}">
41-
42-
<script language="C#">
43-
<code><![CDATA[
44-
public const int BaseAlpha = 4000;
45-
public const int BaseBeta = 1000;
46-
public const int BaseCR = 0000;
47-
public const int BaseGA = 4000;
48-
// SP is same as GA because GA has no number and SP's start with 1.
49-
public const int BaseSP = 4000;
50-
51-
public static void ScriptMain(Project project)
52-
{
53-
project.Properties["project.version.numeric"] = ToNumericVersion(
54-
project.Properties["project.version"]);
55-
}
56-
57-
public static string ToNumericVersion(string version)
58-
{
59-
int qualifierStart = version.LastIndexOf('.') + 1;
60-
int qualifierNumberStart = version.IndexOfAny(
61-
"0123456789".ToCharArray(),
62-
qualifierStart);
63-
64-
if (qualifierNumberStart < 0) qualifierNumberStart = version.Length;
65-
66-
string qualifier = version.Substring(qualifierStart, qualifierNumberStart - qualifierStart);
67-
int qualifierNumber = qualifierNumberStart < version.Length
68-
? int.Parse(version.Substring(qualifierNumberStart))
69-
: 0;
70-
71-
int revisionBase;
72-
73-
switch (qualifier)
74-
{
75-
case "Alpha": revisionBase = BaseAlpha; break;
76-
case "Beta": revisionBase = BaseBeta; break;
77-
case "CR": revisionBase = BaseCR; break;
78-
case "GA": revisionBase = BaseGA; break;
79-
case "SP": revisionBase = BaseSP; break;
80-
81-
default: throw new BuildException("Unknown version qualifier " + qualifier);
82-
}
83-
84-
string revisionNumber = (revisionBase + qualifierNumber).ToString();
85-
86-
return version.Substring(0, qualifierStart) + revisionNumber;
87-
}
88-
]]></code>
89-
</script>
90-
</if>
91-
92-
<!-- debug|release -->
93-
<property name="build.defines" value="" />
7+
<property name="NHibernate.lib" value="../../lib/${framework.family}/${framework.version}" />
948

95-
<!-- platform specific properties. These are the defaults -->
96-
<property name="current.build.defines" value="${build.defines}" />
9+
<property name="project.version" value="5.0.0" overwrite="false" />
9710

9811
<!-- named project configurations -->
9912
<target name="set-debug-project-configuration" description="Perform a 'debug' build">
10013
<property name="build.debug" value="Full" />
10114
<property name="build.optimize" value="false" />
10215
<property name="build.name" value="NHibernate.Validator-${project.version}-${project.config}" />
10316
<property name="build.release" value="false" />
17+
<property name="build.config" value="Debug" />
10418
</target>
10519

10620
<target name="set-release-project-configuration" description="Perform a 'release' build">
10721
<property name="build.debug" value="None" />
10822
<property name="build.optimize" value="true" />
10923
<property name="build.name" value="NHibernate.Validator-${project.version}" />
11024
<property name="build.release" value="true" />
25+
<property name="build.config" value="Release" />
11126
</target>
11227

11328
<target name="set-project-configuration">
@@ -122,7 +37,7 @@
12237
<property name="build.nuget.dir" value="${root.dir}/build/NuGetDeploy" />
12338
<property name="build.dir" value="${build.root.dir}" />
12439
<property name="bin.dir" value="${build.dir}/bin/${nant.settings.currentframework}" dynamic="true" />
125-
<property name="testresults.dir" value="${bin.dir}/test-results" />
40+
<property name="testresults.dir" value="${build.dir}/test-results" />
12641
<property name="tools.dir" value="${root.dir}/Tools"/>
12742
</target>
12843

default.build

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
<property name="root.dir" value="." />
88
<include buildfile="${root.dir}/build-common/common.xml" />
99
<property name="lib.dir" value="${root.dir}/lib" />
10-
<property name="package.dir" value="${root.dir}/src/packages" />
1110
<property name="doc.dir" value="${root.dir}/doc" />
1211
<property name="example.dir" value="${root.dir}/examples" />
1312

13+
<property name="net.target-fx" value="net461" />
14+
<property name="net.core-fx" value="netcoreapp2.0" />
15+
<property name="net.standard" value="netstandard2.0" />
1416

1517
<!-- Pass -D:skip.tests=true to NAnt to skip running tests when building -->
1618
<property name="skip.tests" value="false" overwrite="false" />
@@ -54,13 +56,15 @@
5456
<nant target="build">
5557
<buildfiles refid="buildfiles.all" />
5658
</nant>
57-
<exec program="${path::combine(tools.dir, 'msbuild.cmd')}" verbose="true">
59+
<exec program="${path::combine(tools.dir, 'dotnet.cmd')}" verbose="true">
5860
<arg value="${root.dir}/src/NHibernate.Validator.sln" />
59-
<arg value="/p:OutputPath=&quot;${path::get-full-path(bin.dir)}&quot;" />
6061
<arg value="/p:Platform=&quot;Any CPU&quot;" />
61-
<arg value="/p:Configuration=&quot;Debug&quot;" if="${build.release == 'false'}" />
62-
<arg value="/p:Configuration=&quot;Release&quot;" if="${build.release == 'true'}" />
63-
<arg value="/p:NoWarn=&quot;1591&quot;" />
62+
<arg value="/p:Configuration=&quot;${build.config}&quot;" />
63+
<!-- 6.0 TODO: pack projects separately
64+
<arg value="/p:GeneratePackageOnBuild=&quot;True&quot;" if="${build.release == 'true'}" />
65+
<arg value="/p:IncludeSymbols=&quot;True&quot;" />
66+
<arg value="/p:IncludeSource=&quot;True&quot;" />
67+
<arg value="/p:PackageOutputPath=&quot;${path::get-full-path(path::combine(root.dir, 'build'))}&quot;" /> -->
6468
<arg value="/t:Restore" />
6569
<arg value="/t:Rebuild" />
6670
<arg value="/v:q" />
@@ -94,7 +98,6 @@
9498
<fileset>
9599
<!-- copy dlls used by this build -->
96100
<include name="${lib.dir}/**" />
97-
<include name="${package.dir}/**" />
98101

99102
<include name="${example.dir}/**" />
100103

@@ -141,7 +144,7 @@
141144

142145
<target name="binaries" depends="init build">
143146
<copy todir="${bin.dir}../../../testsbins">
144-
<fileset basedir="${bin.dir}">
147+
<fileset basedir="src/NHibernate.Validator.Specific.Tests/bin/${build.config}/${net.target-fx}">
145148
<include name="*Test*dll" />
146149
<include name="nunit.*.dll" />
147150
<include name="SharpTestsEx*.dll" />
@@ -150,26 +153,28 @@
150153
<include name="NHibernate.Envers.*" />
151154
</fileset>
152155
</copy>
153-
154-
<delete>
155-
<fileset basedir="${bin.dir}">
156-
<include name="nhvalidator.cfg.xml"/>
157-
<include name="nunit.*.dll" />
158-
<include name="SharpTestsEx*.dll" />
159-
<include name="*.Test*" />
160-
<include name="NHibernate.Envers.*" />
156+
<copy todir="${bin.dir}">
157+
<fileset basedir="src/NHibernate.Validator.Specific/bin/${build.config}/${net.target-fx}">
158+
<include name="**/*" />
161159
</fileset>
162-
</delete>
160+
</copy>
163161
</target>
164-
162+
165163
<target name="nugetdeploy" depends="init build">
166-
167-
<copy todir="${build.nuget.dir}/bin">
164+
165+
<copy todir="${build.nuget.dir}/bin/${net.target-fx}">
168166
<fileset basedir="${bin.dir}">
169167
<include name="**/*" />
170168
</fileset>
171169
</copy>
172-
170+
171+
<copy todir="${build.nuget.dir}/bin/${net.standard}">
172+
<fileset basedir="src/NHibernate.Validator.Specific/bin/${build.config}/${net.standard}">
173+
<include name="**/*" />
174+
<exclude name="**/*.deps.json" />
175+
</fileset>
176+
</copy>
177+
173178
<copy todir="${build.nuget.dir}">
174179
<fileset basedir="${build.dir}/schema">
175180
<include name="*" />
@@ -181,7 +186,7 @@
181186
<copy file="readme.md" todir="${build.nuget.dir}" />
182187

183188
<delete>
184-
<fileset basedir="${build.nuget.dir}/bin">
189+
<fileset basedir="${build.nuget.dir}/bin/${net.target-fx}">
185190
<include name="test-results/**/*.*" />
186191
<include name="NHibernate.dll" />
187192
<include name="NHibernate.xml" />
@@ -242,13 +247,6 @@
242247
<echo message="Created a '${project.config}' package in ${dist.output.dir}" />
243248
</target>
244249

245-
<target name="visual-studio" depends="init" description="Modifies AssemblyInfo.cs files to work with Visual Studio">
246-
<property name="visual-studio" value="true" />
247-
<nant target="generate-assemblyinfo">
248-
<buildfiles refid="buildfiles.all" />
249-
</nant>
250-
</target>
251-
252250
<target name="cleanall" description="Deletes every build configuration">
253251
<echo message="Deleting all builds from all configurations" />
254252
<delete dir="build" failonerror="false" />

src/NHibernate.Tool.HbmXsd/HowUse.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
1) Clean and rebuild NHibernate.Validator.sln
22
2) Open the command line
3-
3) change the working dir to YourWorkingCopyPath\trunk\src\NHibernate.Validator\src\NHibernate.Tool.HbmXsd\bin\Debug
4-
4) NhvXsd ..\..\..\NHibernate.Validator\Cfg\MappingSchema\Validator.GeneratedSchema.cs
3+
3) change the working dir to YourWorkingCopyPath\NHibernate-Validator\src\NHibernate.Tool.HbmXsd\bin\Debug\net461
4+
4) NhvXsd ..\..\..\..\NHibernate.Validator\Cfg\MappingSchema\Validator.GeneratedSchema.cs

0 commit comments

Comments
 (0)