-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbuild-examples.sh
executable file
·43 lines (33 loc) · 1.12 KB
/
build-examples.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
#!/bin/bash
exit_code=0
examples=("BugReport" "Docs" "KituraExample" "PerfectExample" "VaporExample" "Atlas" "AWSLambdaExample")
branch=${1}
# Ensure branch is non-empty
[ ! -z "${branch}" ] || { echo "ERROR: Missing branch name"; exit 1; }
for example_project in ${examples[@]}; do
echo "Building $example_project"
example_dir="Examples/${example_project}"
# replace version string with release branch name
etc/sed.sh -i "s/swift-driver\", .upToNextMajor[^)]*)/swift-driver\", .branch(\"${branch}\")/" "${example_dir}/Package.swift"
pushd "${example_dir}"
# don't exit on failure
set +e
if [ ${example_project} == "KituraExample" ]; then
export KITURA_NIO=1
fi
swift build
build_success=$?
set -e
rm -rf ./.build
rm Package.resolved
git checkout Package.swift
popd
if [ ${build_success} -eq 0 ]; then
echo "================= Building $example_project succeeded ================="
else
echo "================= Building $example_project failed ================="
exit_code=1
exit "${exit_code}"
fi
done
exit "${exit_code}"