forked from nhibernate/NHibernate-Caches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildcommon.xml
166 lines (142 loc) · 7.89 KB
/
buildcommon.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" ?>
<project xmlns="http://nant.sf.net/release/0.85/nant.xsd">
<property name="framework.family" value="${framework::get-family(framework::get-target-framework())}"/>
<property name="framework.version" value="${framework::get-version(framework::get-target-framework())}"/>
<property name="key.file" value="../NHibernate.Caches.snk" />
<property name="net.target-fx" value="net461" />
<property name="net.core-fx" value="net8.0" />
<property name="nant-version.current" value="${assemblyname::get-version(assembly::get-name(nant::get-assembly()))}" />
<property name="nant-version.required" value="0.85.2478.0" />
<!-- Nant 0.85 release version -->
<property name="nant-version.beta1_086" value="0.86.2898.0" />
<!-- Nant 0.86 Beta 1 -->
<!-- This is used only for build folder -->
<!-- TODO: Either remove or refactor to use NHibernate.Caches.props -->
<property name="project.version" value="5.9.0" overwrite="false" />
<!-- named project configurations -->
<target name="set-debug-project-configuration" description="Perform a 'debug' build">
<property name="build.release" value="false" />
<property name="build.debug" value="true" />
<property name="build.name" value="NHibernate-Caches-${project.version}-${project.config}" />
<property name="build.config" value="Debug" />
</target>
<target name="set-release-project-configuration" description="Perform a 'release' build">
<property name="build.release" value="true" />
<property name="build.debug" value="pdbonly" />
<property name="build.name" value="NHibernate-Caches-${project.version}" />
<property name="build.config" value="Release" />
</target>
<target name="set-project-configuration">
<property name="project.config" value="debug" overwrite="false" />
<if test="${not(target::exists('set-' + project.config + '-project-configuration'))}">
<fail message="Unknown configuration: '${project.config}'" />
</if>
<call target="set-${project.config}-project-configuration" />
<property name="build.root.dir" value="${root.dir}/build/${build.name}" />
<property name="build.dir" value="${build.root.dir}" />
<property name="bin.dir" value="${build.dir}/bin" />
</target>
<target name="init" depends="set-project-configuration">
<property name="tools.dir" value="${root.dir}/Tools" />
<property name="testresults.dir" value="${build.dir}/bin/test-results" />
<property name="nuget.nupackages.dir" value="${path::get-full-path(path::combine(build.dir, 'nuget_gallery'))}" />
<mkdir dir="${bin.dir}"/>
<mkdir dir="${testresults.dir}"/>
</target>
<target name="bin-pack-common">
<property name="bin-pack.tmpdir" value="${build.dir}/tmp-bin" />
<property name="bin-pack.project.deploy" value="${bin-pack.tmpdir}/${bin-pack.project.name}" />
<property name="bin-pack.full-project.name" value="NHibernate.Caches.${bin-pack.project.name}" />
<mkdir dir="${bin-pack.project.deploy}"/>
<copy file="${root.dir}/NHibernate.Caches.snk" todir="${bin-pack.project.deploy}"/>
<copy todir="${bin-pack.project.deploy}">
<fileset basedir="${root.dir}/${bin-pack.project.name}/${bin-pack.full-project.name}/bin/${build.config}/${net.target-fx}">
<include name="${bin-pack.full-project.name}.*" />
</fileset>
</copy>
<copy todir="${bin.dir}/${bin-pack.project.name}">
<fileset basedir="${bin-pack.project.deploy}">
<include name="**/*" />
</fileset>
</copy>
</target>
<target name="common.compile-all" depends="init common.solution-restore">
<exec program="${path::combine(tools.dir, 'dotnet.cmd')}" verbose="true">
<arg value="${root.dir}/NHibernate.Caches.Everything.sln" />
<arg value="/p:Platform="Any CPU"" />
<arg value="/p:Configuration="${build.config}""/>
<arg value="/p:GeneratePackageOnBuild="True"" />
<arg value="/p:IncludeSymbols="True"" />
<arg value="/p:IncludeSource="True"" />
<arg value="/p:PackageOutputPath="${nuget.nupackages.dir}"" />
<arg value="/t:Restore" />
<arg value="/t:Rebuild" />
<arg value="/v:q" />
<arg value="/m" />
</exec>
</target>
<target name="common.tools-restore" depends="init">
<exec workingdir="${root.dir}" program="dotnet" verbose="true">
<arg line="tool restore" />
</exec>
<exec workingdir="${root.dir}/Tools" program="dotnet" verbose="true">
<arg line="restore ./packages.csproj --packages ." />
</exec>
</target>
<target name="common.solution-restore" depends="common.tools-restore">
<exec program="${path::combine(tools.dir, 'dotnet.cmd')}" verbose="true">
<arg value="/t:Restore" />
<arg value="${root.dir}/NHibernate.Caches.Everything.sln" />
</exec>
</target>
<target name="get-tool-info" depends="common.tools-restore">
<xmlpeek
file="${tools.dir}/packages.csproj"
xpath="/Project/ItemGroup/PackageReference[@Include = '${tool.id}']/@Version"
property="tool.version" />
<property name="tool.path" value="${tools.dir}/${tool.id}/${tool.version}/" />
</target>
<target name="common.find-nunit">
<property name="tool.id" value="NUnit.ConsoleRunner" />
<call target="get-tool-info" />
<property name="nunit-console" value="${tool.path}tools/nunit3-console.exe" />
</target>
<target name="common.run-tests"
description="Run NUnit tests">
<call target="common.find-nunit" unless="${property::exists('nunit.found')}" />
<property name="common.run-tests.failonerror" value="${not property::exists(test.file + '.IgnoreFail')}"/>
<property name="common.run-tests.x86" value="--x86" unless="${property::exists('nunit-x64')}" />
<property name="common.run-tests.x86" value="" if="${property::exists('nunit-x64')}" />
<exec program="${nunit-console}" failonerror="${common.run-tests.failonerror}">
<arg line="${root.dir}/${test.project}/${test.file}/bin/${build.config}/${net.target-fx}/${test.file}.dll --result=${testresults.dir}/${test.file}.dll-results.xml;format=nunit2 --framework=${framework::get-target-framework()} ${common.run-tests.x86}" />
</exec>
</target>
<target name="common.run-core-tests"
description="Run Core tests">
<property name="common.run-tests.failonerror" value="${not property::exists(test.file + '.IgnoreFail')}"/>
<exec program="dotnet" failonerror="${common.run-tests.failonerror}">
<arg line="${root.dir}/${test.project}/${test.file}/bin/${build.config}/${net.core-fx}/${test.file}.dll --labels=before --nocolor --result=${testresults.dir}/${test.file}.dll-core-results.xml" />
</exec>
</target>
<target name="common.nuget-pushbat"
description="Creates files for the release on nuget gallery.">
<property name="nuget.nupackages.pushbatfile" value="${path::combine(nuget.nupackages.dir, 'NuGetPush.bat')}" />
<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<echo message="nuget push -source https://api.nuget.org/v3/index.json ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
</target>
<target name="common.clean">
<delete dir="${root.dir}/${clean.project}/NHibernate.Caches.${clean.project}/bin" failonerror="false" />
<delete dir="${root.dir}/${clean.project}/NHibernate.Caches.${clean.project}/obj" failonerror="false" />
<delete dir="${root.dir}/${clean.project}/NHibernate.Caches.${clean.project}.Tests/bin" failonerror="false" />
<delete dir="${root.dir}/${clean.project}/NHibernate.Caches.${clean.project}.Tests/obj" failonerror="false" />
</target>
</project>