summaryrefslogtreecommitdiff
path: root/qpid/dotnet/client-010/default.build
blob: eb6ee371f7d1bf3ceaf0f710904bd41665b0ff20 (plain)
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?xml version="1.0"?>
<!--
 
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 
-->

<project name="Qpid.NET" default="build">

    <!-- Determines the formatter to use to format output of test results. -->
    <property name="nant.formatter" value="Plain" />

    <!-- Determines whether a 'debug' or 'release' build is to be done. Defaults to 'debug' -->
    <property name="build.config" value="debug" />

    <!-- Sets build properties consistently accross all assemblies in the project. -->
    <property name="build.version.major" value="0"/>
    <property name="build.version.minor" value="5"/>
    <property name="build.version.build" value="0"/>
    <property name="build.version.revision" value="0"/>
    <property name="build.company" value="Apache Software Foundation"/>
    <property name="build.copyright" value="Apache Software Foundation"/>
    <property name="build.description" value="Built from svn revision number: "/>

    <!-- Fileset with build files for each 'core' assembly. -->
    <fileset id="src.builds">
        <include name="client/default.build" />
        <include name="management/console/default.build" />        
        <include name="demo/default.build" />       
    </fileset>

    <!-- Fileset with build files for each 'core' assembly. -->
    <fileset id="examples.builds">
      <include name="examples/request-response/example-request-response-Client/default.build" />
      <include name="examples/request-response/example-request-response-Server/default.build" />
      <include name="examples/direct/example-direct-Listener/default.build" />
      <include name="examples/direct/example-direct-producer/default.build" />
      <include name="examples/fanout/example-fanout-Listener/default.build" />
      <include name="examples/fanout/example-fanout-Producer/default.build" />
      <include name="examples/pub-sub/example-pub-sub-Listener/default.build" />
      <include name="examples/pub-sub/example-pub-sub-Publisher/default.build" />
    </fileset>
  
    <!-- Fileset with build files for 'integration' test assemblies. -->
    <fileset id="tests.builds">
        <include name="test/default.build" />	
    </fileset>	
    
     <!-- Fileset with build files for 'performence' test assemblies. -->
    <fileset id="perftest.builds">
        <include name="perftest/default.build" />	
    </fileset>	

    <!-- Prepare environment for a debug build. -->
    <target name="debug">
        <property name="build.debug" value="true" />
        <property name="build.defines" value="DEBUG;TRACE"/>
    </target>

    <!-- Prepare environment for a release build. -->
    <target name="release">
        <property name="build.debug" value="false" />
        <property name="build.defines" value=""/>
    </target>
    
    <!-- Prepare environment for build. -->
    <target name="init">
        <property name="base.dir" value="${project::get-base-directory()}" />
        <property name="build.dir" value="${base.dir}/bin/${framework::get-target-framework()}/${build.config}" />
        <call target="${build.config}" />	
    </target>   
    
    <!-- Cleans up the build output directory. -->
    <target name="clean" depends="init">
        <delete dir="${build.dir}" failonerror="false" />
    </target>

    <!-- Runs 'svnversion' to get the repository revision into the build property 'build.svnversion'. -->
    <target name="svnversion" description="Runs svnversion to get the current repository version into a build script property.">
        <exec program="svnversion" output="svnversion_tmp.txt">
            <arg value="-n"/>
        </exec>

        <loadfile file="svnversion_tmp.txt" property="build.svnversion"/>
        <delete file="svnversion_tmp.txt"/>       
       
        <!-- For some competely retarted reason the '-n' parameter to svnversion doesn't really work under windows... 
             Here is some code to strip the unwanted newlines. -->
        <script language="C#">
            <code><![CDATA[
            public static void ScriptMain(Project project)
            {
                project.Properties["build.svnversion"] = project.Properties["build.svnversion"].Trim("\n\r".ToCharArray());
            }
            ]]>
            </code>
        </script>

    </target>

    <!-- Performs a regex find-and-replace on assembly info files, substituting fields defined as build properties. -->
    <target name="setversion" description="Stamp the version info onto assemblyinfo.cs files" depends="svnversion">

        <echo>build.svnversion = ${build.svnversion}</echo>

        <foreach item="File" property="filename">
            <in>
                <items basedir=".">
                    <include name="**\AssemblyInfo.cs"></include>
                </items>
            </in>
            <do>
                <script language="C#">
                    <code><![CDATA[
                    public static void ScriptMain(Project project)
                    {
                        // Read in the entire file to perform the substitution in.
                        StreamReader reader = new StreamReader(project.Properties["filename"]);
                        string contents = reader.ReadToEnd();
                        reader.Close();

                        // Substitute the version numbers.
                        string replacement = string.Format("[assembly: AssemblyVersion(\"{0}.{1}.{2}.{3}\")]",
                                                           project.Properties["build.version.major"],
                                                           project.Properties["build.version.minor"],
                                                           project.Properties["build.version.build"],
                                                           project.Properties["build.version.revision"]);
                        contents = Regex.Replace(contents, @"\[assembly: AssemblyVersion\("".*""\)\]", replacement);

                        // Substitute the company name and copyright.
                        replacement = string.Format("[assembly: AssemblyCompany(\"{0}\")]",
                                                    project.Properties["build.company"]);
                        contents = Regex.Replace(contents, @"\[assembly: AssemblyCompany\("".*""\)\]", replacement);

                        replacement = string.Format("[assembly: AssemblyCopyright(\"{0}\")]",
                                                    project.Properties["build.copyright"]);
                        contents = Regex.Replace(contents, @"\[assembly: AssemblyCopyright\("".*""\)\]", replacement);

                        // Update the description.
                        //replacement = string.Format("[assembly: AssemblyDescription(\"{0} {1}\")]",
                        //                            project.Properties["build.description"],
                        //                            project.Properties["build.svnversion"]);
                        replacement = string.Format("[assembly: AssemblyDescription(\"{0}\")]",
                                                    project.Properties["build.description"]);
                        contents = Regex.Replace(contents, @"\[assembly: AssemblyDescription\("".*""\)\]", replacement);

                        // Write out the file with the substituted version.
                        StreamWriter writer = new StreamWriter(project.Properties["filename"], false);
                        writer.Write(contents);
                        writer.Close();
                    }
                    ]]>
                    </code>
                </script>
            </do>
        </foreach>
    </target>

    <!-- Do the build. -->
    <target name="build" depends="init, setversion">
        <echo message="Building all modules including tests."/>

        <!-- Make sure output folder exists. -->
        <mkdir dir="${build.dir}" />

				<echo message="Output folder: ${build.dir}"/>
				
        <!-- copy reference assemblies over to the output dir -->
        <copy todir="${build.dir}" file="lib/log4net/log4net.dll"/>
        <copy todir="${build.dir}" file="lib/nunit/nunit.framework.dll"/>
        <copy todir="${build.dir}" file="lib/plossum/C5.dll"/>
        <copy todir="${build.dir}" file="lib/plossum/Plossum CommandLine.dll"/>

        <!-- Compile assemblies. -->
        <nant target="build">
            <buildfiles refid="src.builds" />
        </nant>

        <!-- Compile test assemblies. -->
        <nant target="build">
           <buildfiles refid="examples.builds" />
        </nant>
      
        <!-- Compile test assemblies. -->
        <nant target="build">
            <buildfiles refid="tests.builds" />
        </nant>
        
        <!-- Compile test assemblies. -->
        <nant target="build">
            <buildfiles refid="perftest.builds" />
        </nant>
      
        <!-- copy config files over to the output dir -->
        <copy todir="${build.dir}" file="test/Qpid Test.dll.config"/>
        <copy todir="${build.dir}" file="log.xml"/>

        
    </target>
    
    <!-- Runs all 'pure unit' tests. -->
    <target name="test" depends="build">
        <echo message="Running all pure unit tests."/>
        <nant target="test">
            <buildfiles refid="tests.builds" />
        </nant>
    </target>

    <!-- Creates a release package. -->
    <target name="release-pkg">
        <echo message="Building and packaging a release."/>

        <call target="clean"/>
        <call target="build"/>

        <property name="build.date" value="${datetime::now()}"/>

        <zip zipfile="${build.dir}/Qpid.NET-${framework::get-target-framework()}-${datetime::get-year(build.date)}${datetime::get-month(build.date)}${datetime::get-day(build.date)}.zip">
            <fileset basedir="${build.dir}" prefix="qpid/lib">
                <include name="**/*.*"/>
                <exclude name="**/*.tests.*"/>
                <exclude name="**/example*.*"/>
                <exclude name="**/nunit.framework.dll"/>
                <exclude name="**/*.exe"/>
                <exclude name="**/*.pdb"/>
            </fileset>

            <fileset basedir="${build.dir}" prefix="qpid/examples/direct">
               <include name="**/example*direct*.exe"/>            
            </fileset>

            <fileset basedir="${build.dir}" prefix="qpid/examples/fanout">
              <include name="**/example*fanout*.exe"/>
            </fileset>

            <fileset basedir="${build.dir}" prefix="qpid/examples/pub-sub">
              <include name="**/example*pub-sub*.exe"/>
            </fileset>

          <fileset basedir="${build.dir}" prefix="qpid/examples/request-response">
            <include name="**/example*request-response*.exe"/>
          </fileset>
          
          <fileset basedir="${base.dir}/.." prefix="qpid">
              <include name="LICENSE.txt"/>
              <include name="NOTICE.txt"/>
              <include name="RELEASE_NOTES.txt"/>
              <include name="DISCLAIMER"/>
            </fileset>


            <fileset basedir="${base.dir}" prefix="qpid">
                <include name="README.txt"/>
            </fileset>
        </zip>
    </target>
    
</project>