Skip to content

Commit 42547f3

Browse files
author
Emile Joubert
committed
Separate lib for common release functions
1 parent 1e6b7ad commit 42547f3

File tree

3 files changed

+80
-37
lines changed

3 files changed

+80
-37
lines changed

dist-lib.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#! /bin/bash
2+
3+
## This source code is dual-licensed under the Apache License, version
4+
## 2.0, and the Mozilla Public License, version 1.1.
5+
##
6+
## The APL v2.0:
7+
##
8+
##---------------------------------------------------------------------------
9+
## Copyright (C) 2007-2011 VMware, Inc.
10+
##
11+
## Licensed under the Apache License, Version 2.0 (the "License");
12+
## you may not use this file except in compliance with the License.
13+
## You may obtain a copy of the License at
14+
##
15+
## http:##www.apache.org/licenses/LICENSE-2.0
16+
##
17+
## Unless required by applicable law or agreed to in writing, software
18+
## distributed under the License is distributed on an "AS IS" BASIS,
19+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
## See the License for the specific language governing permissions and
21+
## limitations under the License.
22+
##---------------------------------------------------------------------------
23+
##
24+
## The MPL v1.1:
25+
##
26+
##---------------------------------------------------------------------------
27+
## The contents of this file are subject to the Mozilla Public License
28+
## Version 1.1 (the "License"); you may not use this file except in
29+
## compliance with the License. You may obtain a copy of the License
30+
## at http:##www.mozilla.org/MPL/
31+
##
32+
## Software distributed under the License is distributed on an "AS IS"
33+
## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
34+
## the License for the specific language governing rights and
35+
## limitations under the License.
36+
##
37+
## The Original Code is RabbitMQ.
38+
##
39+
## The Initial Developer of the Original Code is VMware, Inc.
40+
## Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
41+
##---------------------------------------------------------------------------
42+
43+
function assembly-version {
44+
local RELEASE_PATTERN="^[0-9]+(\.[0-9]+){2}$"
45+
local NIGHTLY_PATTERN="^[0-9]+(\.[0-9]+){3}$"
46+
if [[ $1 =~ $RELEASE_PATTERN ]] ; then
47+
ASSEMBLY_VSN=$RABBIT_VSN.0
48+
elif [[ $1 =~ $NIGHTLY_PATTERN ]] ; then
49+
ASSEMBLY_VSN=$RABBIT_VSN
50+
else
51+
echo "Error: invalid version pattern: '$1'" >&2
52+
exit 1
53+
fi
54+
}
55+
56+
function safe-rm-deep-dir {
57+
### Workaround for the path-too-long bug in cygwin
58+
if [ -e "$1" ]; then
59+
mv -f $1 /tmp/del
60+
rm -rf /tmp/del
61+
fi
62+
}
63+

dist-msi.sh

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ set -x
4848
### Disable sharing files by default (it causes things not to work properly)
4949
CYGWIN=nontsec
5050

51+
. dist-lib.sh
52+
5153
### Overrideable vars
5254
test "$RABBIT_VSN" || RABBIT_VSN=0.0.0.0
5355
test "$SKIP_MSIVAL2" || SKIP_MSIVAL2=
@@ -57,10 +59,7 @@ NAME=rabbitmq-dotnet-client
5759
NAME_VSN=$NAME-$RABBIT_VSN
5860
RELEASE_DIR=release
5961

60-
RELEASE_PATTERN=^[0-9]+\.[0-9]+\.[0-9]+$
61-
if [[ $RABBIT_VSN =~ $RELEASE_PATTERN ]] ; then
62-
RABBIT_VSN=$RABBIT_VSN.0
63-
fi
62+
assembly-version $RABBIT_VSN
6463

6564
function main {
6665
get-sources
@@ -84,7 +83,7 @@ function build-msm-msi {
8483
candle -out ../tmp/wix/rabbitmq-dotnet-client-msm.wixobj dotnet-client-merge-module.wxs
8584
light -out ../tmp/wix/rabbitmq-dotnet-client.msm ../tmp/wix/rabbitmq-dotnet-client-msm.wixobj
8685
test "$SKIP_MSIVAL2" || MsiVal2.exe ../tmp/wix/rabbitmq-dotnet-client.msm ../lib/wix/mergemod.cub -f
87-
86+
8887
gen-wxs dotnet-client-product.wxs
8988
candle -out ../tmp/wix/rabbitmq-dotnet-client-msi.wixobj dotnet-client-product.wxs
9089
light -out ../tmp/wix/rabbitmq-dotnet-client.msi \
@@ -189,13 +188,4 @@ function gen-license-rtf {
189188
}
190189

191190

192-
function safe-rm-deep-dir {
193-
### Workaround for the path-too-long bug in cygwin
194-
if [ -e "$1" ]; then
195-
mv -f $1 /tmp/del
196-
rm -rf /tmp/del
197-
fi
198-
}
199-
200-
201191
main $@

dist.sh

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ set -x
4848
### Disable sharing files by default (it causes things not to work properly)
4949
CYGWIN=nontsec
5050

51+
. dist-lib.sh
52+
5153
### Overrideable vars
5254
test "$KEYFILE" || KEYFILE=rabbit-mock.snk
5355
test "$RABBIT_VSN" || RABBIT_VSN=0.0.0.0
@@ -69,10 +71,7 @@ else
6971
DOTNET_PROGRAM_PREPEND=
7072
fi
7173

72-
RELEASE_PATTERN=^[0-9]+\.[0-9]+\.[0-9]+$
73-
if [[ $RABBIT_VSN =~ $RELEASE_PATTERN ]] ; then
74-
RABBIT_VSN=$RABBIT_VSN.0
75-
fi
74+
assembly-version $RABBIT_VSN
7675

7776
function main {
7877
### Remove everything in the release dir and create the dir again
@@ -151,15 +150,6 @@ function cp-license-to {
151150
}
152151

153152

154-
function safe-rm-deep-dir {
155-
### Workaround for the path-too-long bug in cygwin
156-
if [ -e "$1" ]; then
157-
mv -f $1 /tmp/del
158-
rm -rf /tmp/del
159-
fi
160-
}
161-
162-
163153
function src-dist {
164154
### Copy files to be zipped to tmp/srcdist/
165155
mkdir -p tmp/srcdist/docs/specs tmp/srcdist/lib
@@ -181,7 +171,7 @@ function src-dist {
181171
cd tmp/srcdist
182172
zip -r ../../$RELEASE_DIR/$NAME_VSN.zip . -x \*.snk \*.resharper \*.csproj.user
183173
cd ../..
184-
174+
185175
### Remove tmp/srcdist
186176
rm -rf tmp/srcdist
187177
}
@@ -215,7 +205,7 @@ function dist-target-framework {
215205

216206
### Build
217207
$MSBUILD RabbitMQDotNetClient.sln /t:Build /property:Configuration="Release"
218-
208+
219209
### Copy bin files to be zipped to tmp/dist/
220210
cp projects/client/RabbitMQ.Client/build/bin/RabbitMQ.Client.xml tmp/dist/bin/
221211
cp projects/client/RabbitMQ.Client/build/bin/RabbitMQ.Client.dll tmp/dist/bin/
@@ -224,15 +214,15 @@ function dist-target-framework {
224214
done
225215
test "$BUILD_WCF" && cp projects/wcf/RabbitMQ.ServiceModel/build/bin/RabbitMQ.ServiceModel.dll tmp/dist/bin/
226216
cp-license-to tmp/dist/
227-
217+
228218
### Zip tmp/dist
229219
cd tmp/dist
230220
zip -r ../../$RELEASE_DIR/$NAME_VSN-$TARGET_FRAMEWORK.zip .
231221
cd ../..
232222

233223
### Remove tmp/dist
234224
rm -rf tmp/dist
235-
225+
236226
### Restore Local.props
237227
rm -f ./Local.props
238228
test "$LOCAL_PROPS_EXISTS" && mv ./Local.props.user ./Local.props || true
@@ -244,7 +234,7 @@ function gen-props {
244234
else
245235
USING_MONO="false"
246236
fi
247-
sed -e "s:@VERSION@:$RABBIT_VSN:g" \
237+
sed -e "s:@VERSION@:$ASSEMBLY_VSN:g" \
248238
-e "s:@KEYFILE@:$KEYFILE:g" \
249239
-e "s:@USINGMONO@:$USING_MONO:g" \
250240
< $1 > $2
@@ -266,14 +256,14 @@ function gendoc-dist {
266256

267257
cd $PROJECT_DIR
268258

269-
### Generate XMLs with ndocproc
259+
### Generate XMLs with ndocproc
270260
$DOTNET_PROGRAM_PREPEND $RELATIVE_DIR/lib/ndocproc-bin/bin/ndocproc.exe \
271261
/nosubtypes \
272262
$EXTRA_NDOCPROC_ARGS \
273263
$RELATIVE_DIR/tmp/gendoc/xml \
274264
$XML_SOURCE_FILE \
275265
$RELATIVE_DIR/docs/namespaces.xml
276-
266+
277267
cd $RELATIVE_DIR
278268

279269
### Zip ndocproc's output
@@ -282,17 +272,17 @@ function gendoc-dist {
282272
zip -r ../../../$RELEASE_DIR/$ZIP_TMP_XML_DOC_FILENAME .
283273
cd ../../..
284274
fi
285-
275+
286276
### Transform to html, using xsltproc
287277
genhtml index index
288278
genhtml namespace- namespace
289279
genhtml type- type
290-
280+
291281
### Remove generated XMLs and copy remaining files to be added to the .zip
292282
rm -rf tmp/gendoc/xml
293283
cp lib/ndocproc-bin/xsl/style.css tmp/gendoc/html/
294284
cp-license-to tmp/gendoc/
295-
285+
296286
### Zip tmp/gendoc
297287
cd tmp/gendoc
298288
zip -r ../../$RELEASE_DIR/$ZIP_DESTINATION_FILENAME .

0 commit comments

Comments
 (0)