Skip to content

Commit b1cbdc4

Browse files
committed
NH-802 - Use msbuild instead of csc/vbc
- Add AssemblyInfo.* to the project files - Add links to SharedAssemblyInfo.* to the project files - Integrate il-repack into MsBuild pipeline - Remove junk from project files Credits are going to @jrauber
1 parent 8fd9e45 commit b1cbdc4

25 files changed

+178
-767
lines changed

.hgignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ _ReSharper*/
3434
*.[Pp]ublish.xml
3535
glob:NHibernate.dll
3636
glob:nhibernate\build\
37-
glob:AssemblyInfo.cs

build-common/common-project.xml

Lines changed: 35 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@
2525
2626
Other predefined targets are:
2727
28-
- common.compile-tests
29-
compile NUnit tests and copy App.config file to the output directory,
30-
if it exists.
31-
32-
- common.compile-dll
33-
compile a DLL, generating the documentation file (.xml)
28+
- common.compile-all
29+
compile a solution, generating the documentation file (.xml)
3430
3531
- common.generate-assemblyinfo
3632
generate an AssemblyInfo.cs file from assembly.* NAnt properties.
@@ -48,209 +44,53 @@
4844

4945
<include buildfile="common.xml" />
5046

51-
<target name="common.compile-tests"
52-
description="Compile NUnit tests and copy App.config file to the output directory, if it exists.">
53-
54-
<csc
55-
target="library"
56-
define="${current.build.defines}"
57-
debug="${build.debug}"
58-
keyfile="${key.file}"
59-
nostdlib="true"
60-
noconfig="true"
61-
output="${bin.dir}/${project::get-name()}.dll"
62-
if="${sign}"
63-
>
64-
<sources refid="project.sources" />
65-
<references refid="project.references" />
66-
<resources refid="project.resources" />
67-
</csc>
68-
69-
<csc
70-
target="library"
71-
define="${current.build.defines}"
72-
debug="${build.debug}"
73-
nostdlib="true"
74-
noconfig="true"
75-
output="${bin.dir}/${project::get-name()}.dll"
76-
unless="${sign}"
77-
>
78-
<sources refid="project.sources" />
79-
<references refid="project.references" />
80-
<resources refid="project.resources" />
81-
</csc>
82-
83-
84-
<copy
85-
file="App.config"
86-
tofile="${bin.dir}/${project::get-name()}.dll.config"
87-
if="${file::exists('App.config')}"
88-
/>
89-
90-
</target>
91-
92-
<target name="common.compile-tests-vb" description="Compile NUnit tests and copy App.config file to the output directory, if it exists.">
93-
94-
<vbc
95-
target="library"
96-
define="${current.build.defines}"
97-
debug="${build.debug}"
98-
keyfile="${key.file}"
99-
output="${bin.dir}/${project::get-name()}.dll"
100-
rootnamespace="${project::get-name()}"
101-
if="${sign}"
102-
>
103-
<sources refid="project.sources" />
104-
<references refid="project.references" />
105-
<resources refid="project.resources" />
106-
<imports refid="project.imports" />
107-
<arg line="/sdkpath:&quot;${referenceassemblies.dir}&quot;"/>
108-
</vbc>
109-
110-
<vbc
111-
target="library"
112-
define="${current.build.defines}"
113-
debug="${build.debug}"
114-
output="${bin.dir}/${project::get-name()}.dll"
115-
rootnamespace="${project::get-name()}"
116-
unless="${sign}"
117-
>
118-
<sources refid="project.sources" />
119-
<references refid="project.references" />
120-
<resources refid="project.resources" />
121-
<imports refid="project.imports" />
122-
<arg line="/sdkpath:&quot;${referenceassemblies.dir}&quot;"/>
123-
</vbc>
124-
125-
<copy
126-
file="App.config"
127-
tofile="${bin.dir}/${project::get-name()}.dll.config"
128-
if="${file::exists('App.config')}"
129-
/>
130-
131-
</target>
132-
133-
<target name="common.compile-dll" description="Compile sources into a DLL">
134-
135-
<property name="project.output" value="${bin.dir}/${project::get-name()}.dll" unless="${property::exists('project.output')}"/>
136-
137-
<csc
138-
target="library"
139-
define="${current.build.defines}"
140-
debug="${build.debug}"
141-
keyfile="${key.file}"
142-
nostdlib="true"
143-
noconfig="true"
144-
output="${project.output}"
145-
doc="${bin.dir}/${project::get-name()}.xml"
146-
if="${sign}"
147-
optimize="${build.release}"
148-
>
149-
<nowarn>
150-
<warning number="1591" /> <!-- No XML comment for publicly visible member -->
151-
</nowarn>
152-
<sources refid="project.sources" />
153-
<references refid="project.references" />
154-
<resources refid="project.resources" />
155-
</csc>
156-
157-
<csc
158-
target="library"
159-
define="${current.build.defines}"
160-
debug="${build.debug}"
161-
nostdlib="true"
162-
noconfig="true"
163-
output="${project.output}"
164-
doc="${bin.dir}/${project::get-name()}.xml"
165-
unless="${sign}"
166-
optimize="${build.release}"
167-
>
168-
<nowarn>
169-
<warning number="1591" /> <!-- No XML comment for publicly visible member -->
170-
</nowarn>
171-
<sources refid="project.sources" />
172-
<references refid="project.references" />
173-
<resources refid="project.resources" />
174-
</csc>
175-
176-
</target>
177-
178-
<target name="common.compile-exe" description="Compile sources into a console executable">
179-
180-
<csc
181-
target="exe"
182-
keyfile="${key.file}"
183-
define="${current.build.defines}"
184-
debug="${build.debug}"
185-
output="${bin.dir}/${project::get-name()}.exe"
186-
if="${sign}"
187-
optimize="${build.release}"
188-
>
189-
<nowarn>
190-
<warning number="1591" /> <!-- No XML comment for publicly visible member -->
191-
</nowarn>
192-
<sources refid="project.sources" />
193-
<references refid="project.references" />
194-
<resources refid="project.resources" />
195-
</csc>
196-
197-
<csc
198-
target="exe"
199-
define="${current.build.defines}"
200-
debug="${build.debug}"
201-
output="${bin.dir}/${project::get-name()}.exe"
202-
unless="${sign}"
203-
optimize="${build.release}"
204-
>
205-
<nowarn>
206-
<warning number="1591" /> <!-- No XML comment for publicly visible member -->
207-
</nowarn>
208-
<sources refid="project.sources" />
209-
<references refid="project.references" />
210-
<resources refid="project.resources" />
211-
</csc>
47+
<target name="common.compile-all" depends="common.generate-assemblyinfo">
48+
<!--property name="msbuild.cmd" value="${cmd.sln} ${cmd.out} ${cmd.platform} ${cmd.debug} ${cmd.optimize} ${cmd.doc} /t:Rebuild /v:q /m" /-->
49+
50+
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe" verbose="true">
51+
<arg value="${root.dir}/src/NHibernate.sln" />
52+
<arg value="/p:OutputPath=&quot;${path::get-full-path(bin.dir)}&quot;" />
53+
<arg value="/p:Platform=&quot;Any CPU&quot;" />
54+
<arg value="/p:Configuration=&quot;Debug&quot;" if="${build.debug == 'true'}" />
55+
<arg value="/p:Configuration=&quot;Release&quot;" if="${build.release == 'true'}" />
56+
<arg value="/t:Rebuild" />
57+
<arg value="/v:q" />
58+
<arg value="/m" />
59+
</exec>
21260
</target>
213-
61+
21462
<target name="common.set-assembly-attribute-values">
215-
<property overwrite="false" name="assembly.is-cls-compliant" value="true" />
216-
<property overwrite="false" name="assembly.allow-partially-trusted-callers" value="false" />
217-
<property overwrite="false" name="assembly.description" value="" />
218-
<property overwrite="false" name="assembly.product" value="${project::get-name()}" />
219-
<property overwrite="false" name="assembly.company" value="${project.company}" />
220-
<property overwrite="false" name="assembly.title" value="${project::get-name()}" />
22163
<property overwrite="false" name="assembly.version" value="${project.default-assembly-version}" />
22264
<property overwrite="false" name="assembly.version.informational" value="${project.version}" />
22365
<property overwrite="false" name="assembly.version.file" value="${project.version.numeric}" />
224-
<property overwrite="false" name="assembly.copyright" value="Licensed under LGPL." />
225-
<property overwrite="false" name="assembly.sign" value="${sign}" />
22666
</target>
22767

22868
<target name="common.generate-assemblyinfo"
22969
depends="common.init common.set-assembly-attribute-values"
230-
description="Generate AssemblyInfo.cs using assembly.* properties."
70+
description="Generate SharedAssemblyInfo.* using assembly.* properties."
23171
>
232-
<asminfo output="AssemblyInfo.cs" language="CSharp">
72+
<asminfo output="${root.dir}/src/SharedAssemblyInfo.cs" language="CSharp">
73+
<imports>
74+
<import namespace="System" />
75+
<import namespace="System.Reflection" />
76+
<import namespace="System.Runtime.CompilerServices" />
77+
</imports>
78+
<attributes>
79+
<attribute type="AssemblyVersionAttribute" value="${assembly.version}" />
80+
<attribute type="AssemblyInformationalVersionAttribute" value="${assembly.version.informational}" />
81+
<attribute type="AssemblyFileVersionAttribute" value="${assembly.version.file}" />
82+
</attributes>
83+
</asminfo>
84+
<asminfo output="${root.dir}/src/SharedAssemblyInfo.vb" language="VB">
23385
<imports>
23486
<import namespace="System" />
23587
<import namespace="System.Reflection" />
23688
<import namespace="System.Runtime.CompilerServices" />
237-
<import namespace="System.Security" if="${assembly.allow-partially-trusted-callers}" />
23889
</imports>
23990
<attributes>
240-
<attribute type="CLSCompliantAttribute" value="${assembly.is-cls-compliant}" />
241-
<attribute type="AssemblyTitleAttribute" value="${assembly.title}" />
242-
<attribute type="AssemblyDescriptionAttribute" value="${assembly.description}" />
243-
<attribute type="AssemblyCompanyAttribute" value="${assembly.company}" />
244-
<attribute type="AssemblyProductAttribute" value="${assembly.product}" />
245-
<attribute type="AssemblyCopyrightAttribute" value="${assembly.copyright}" />
24691
<attribute type="AssemblyVersionAttribute" value="${assembly.version}" />
24792
<attribute type="AssemblyInformationalVersionAttribute" value="${assembly.version.informational}" />
24893
<attribute type="AssemblyFileVersionAttribute" value="${assembly.version.file}" />
249-
<attribute type="AssemblyDelaySignAttribute" value="false" />
250-
251-
<!-- For some reason, NAnt doesn't detect that APTCA has a public no-argument constructor -->
252-
<attribute asis="true" type="AllowPartiallyTrustedCallersAttribute" if="${assembly.allow-partially-trusted-callers}" />
253-
<attribute asis="true" type="SecurityRulesAttribute" value="SecurityRuleSet.Level1" if="${assembly.allow-partially-trusted-callers}" />
25494
</attributes>
25595
</asminfo>
25696
</target>
@@ -260,7 +100,7 @@
260100
<call target="common.find-nunit" unless="${property::exists('nunit.found')}" />
261101
<property name="common.run-tests.failonerror" value="${not property::exists(project::get-name() + '.IgnoreFail')}"/>
262102
<exec program="${nunit-console}" failonerror="${common.run-tests.failonerror}">
263-
<arg line="${bin.dir}/${project::get-name()}.dll /xml:${testresults.dir}/${project::get-name()}.dll-results.xml /framework:${framework::get-target-framework()}" />
103+
<arg line="${bin.dir}/${test.file}.dll /xml:${testresults.dir}/${test.file}.dll-results.xml /framework:${framework::get-target-framework()}" />
264104
</exec>
265105

266106
<!--<nunit2>
@@ -271,8 +111,8 @@
271111
outputdir="${bin.dir}"
272112
/>
273113
<test
274-
assemblyname="${bin.dir}/${project::get-name()}.dll"
275-
appconfig="${bin.dir}/${project::get-name()}.dll.config" />
114+
assemblyname="${bin.dir}/${test.file}.dll"
115+
appconfig="${bin.dir}/${test.file}.dll.config" />
276116
</nunit2>-->
277117

278118
</target>
@@ -281,7 +121,7 @@
281121
depends="common.put-connection-settings-into-app-config common.run-tests common.remove-connection-settings-from-app-config" />
282122

283123
<target name="common.put-connection-settings-into-app-config">
284-
<property name="app.config" value="${bin.dir}/${project::get-name()}.dll.config" />
124+
<property name="app.config" value="${bin.dir}/${test.file}.dll.config" />
285125
<call target="common.put-connection-settings-into-defined-app-config" />
286126
</target>
287127

@@ -326,7 +166,7 @@
326166
</target>
327167

328168
<target name="common.remove-connection-settings-from-app-config">
329-
<property name="app.config" value="${bin.dir}/${project::get-name()}.dll.config" />
169+
<property name="app.config" value="${bin.dir}/${test.file}.dll.config" />
330170

331171
<xmlpoke
332172
file="${app.config}"

build-common/common.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
in CVS.
88
-->
99
<property name="sign" value="true" overwrite="false" />
10-
<property name="key.file" value="${root.dir}/src/NHibernate.snk" />
11-
12-
<!-- Generating AssemblyInfo files for Visual Studio -->
13-
<property name="visual-studio" value="false" overwrite="false" />
14-
15-
<if test="${visual-studio}">
16-
<property name="key.file" value="../../${key.file}" />
17-
</if>
1810

1911
<!--
2012
if Visual Studio Help Integration Kit has been installed

0 commit comments

Comments
 (0)