-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild
36 lines (28 loc) · 801 Bytes
/
build
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
#!/bin/bash
set -o errexit
set -o nounset
hg pull --rev default
hg update --clean --rev default
hg purge
PROFILE=prod
VERSION_FILE=src/main/resources/version.txt
MANIFEST_FILE=src/main/resources/manifest.txt
if [ -e "$VERSION_FILE" ]; then
echo "Error: $VERSION_FILE exists"
exit 1
fi
if [ -e "$MANIFEST_FILE" ]; then
echo "Error: $MANIFEST_FILE exists"
exit 1
fi
if [ "$PROFILE" = 'prod' -a "$(hg branch)" != 'default' ]; then
echo "Error: cannot build non-default branch in prod"
exit 2
fi
echo "Writing Mercurial manifest..."
hg parents --template '{node}\n\n' > "$MANIFEST_FILE"
hg diff --nodates >> "$MANIFEST_FILE"
echo "Run maven on $HOSTNAME using $PROFILE profile"
mvn -U -Dmaven.test.skip=true -P $PROFILE clean package
rm "$VERSION_FILE"
rm "$MANIFEST_FILE"