-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·143 lines (111 loc) · 3.92 KB
/
build.sh
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
#!/bin/bash
#
# 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.
#
set -xe
cd "${0%/*}"
VERSION=$(<VERSION.txt)
usage() {
echo "Usage: $0 {test|dist|sign|clean|docker-test|rat}"
exit 1
}
(( $# == 0 )) && usage
while (( "$#" ))
do
target="$1"
shift
case "$target" in
test)
(dotnet build --configuration Release Proton.sln)
(LANG=en_US.UTF-8 dotnet test --configuration Release --no-build Proton.sln)
;;
rat)
mvn apache-rat:check -pl :qpid-proton-dotnet
;;
dist)
# build source tarball for upload to apache dist staging
mkdir -p dist
SRC_DIR=qpid-proton-dotnet-src-$VERSION
BIN_DIR=qpid-proton-dotnet-bin-$VERSION
DOC_DIR=qpid-proton-dotnet-docs-$VERSION
rm -rf "dist/${SRC_DIR}"
rm -rf "dist/${BIN_DIR}"
rm -rf "dist/${DOC_DIR}"
rm -rf "dist/${VERSION}"
if [ -d .git ]; then
mkdir -p "dist/${SRC_DIR}"
mkdir -p "dist/${BIN_DIR}"
mkdir -p "dist/${DOC_DIR}"
mkdir -p "dist/${VERSION}"
git archive HEAD | tar -x -C "dist/${SRC_DIR}"
else
echo "Not a GIT repo .. cannot continue"
exit 255
fi
# runs RAT on artifacts
mvn -N apache-rat:check
(cd dist; tar czf "../dist/${VERSION}/${SRC_DIR}.tar.gz" "${SRC_DIR}")
# pack NuGet packages
dotnet pack --configuration Release Proton.sln
# Move binary artifacts to dist lib folder
mkdir -p "dist/${BIN_DIR}/lib"
cp -R src/Proton/bin/Release/* dist/${BIN_DIR}/lib/
cp -R src/Proton.Client/bin/Release/* dist/${BIN_DIR}/lib/
# add the binary LICENSE and NOTICE to the tarball
cp README.md LICENSE NOTICE dist/${BIN_DIR}
(cd dist; tar czf "../dist/${VERSION}/${BIN_DIR}.tar.gz" "${BIN_DIR}")
# build documentation release archive
(env DOXYGEN_OUTPUT_PATH="dist/${DOC_DIR}" doxygen Proton.dox)
(cd dist; tar czf "../dist/${VERSION}/${DOC_DIR}.tar.gz" "${DOC_DIR}")
;;
sign)
set +x
echo -n "Enter password: "
stty -echo
read -r password
stty echo
for f in $(find dist//${VERSION} -type f \
\! -name '*.sha512' \! -name '*.sha256' \
\! -name '*.asc' \! -name '*.txt' \
-name '*.tar.gz');
do
(cd "${f%/*}" && shasum -a 512 "${f##*/}") > "$f.sha512"
gpg --passphrase "$password" --armor --output "$f.asc" --detach-sig "$f"
done
set -x
;;
clean)
dotnet clean
rm -rf src/{Proton,Proton.Client,Proton.TestPeer}/{obj,bin}
rm -rf test/{Proton.Tests,Proton.Client.Tests,Proton.TestPeer.Tests}/{obj,bin}
rm -rf dist
rm -rf target
;;
docker-test)
tar -cf- docker/Dockerfile |
docker build -t proton-test -f docker/Dockerfile -
docker run --rm -v "${PWD}:/proton${DOCKER_MOUNT_FLAG}" -w "/proton" --env "JAVA=${JAVA:-11}" proton-test /proton/docker/run-tests.sh
;;
podman-test)
tar -cf- docker/Dockerfile |
podman build -t proton-test -f docker/Dockerfile -
podman run --rm -v "${PWD}:/proton${DOCKER_MOUNT_FLAG}:Z,U" -w "/proton" --env "JAVA=${JAVA:-11}" proton-test /proton/docker/run-tests.sh
;;
*)
usage
;;
esac
done