-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathbuild_for_ultimaker.sh
More file actions
executable file
·125 lines (108 loc) · 2.29 KB
/
build_for_ultimaker.sh
File metadata and controls
executable file
·125 lines (108 loc) · 2.29 KB
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
#!/bin/bash
#
# SPDX-License-Identifier: LGPL-3.0+
#
# Copyright (C) 2019 Ultimaker B.V.
#
set -eu
ARCH="armhf"
SRC_DIR="$(pwd)"
RELEASE_VERSION="${RELEASE_VERSION:-999.999.999}"
DOCKER_WORK_DIR="/build"
BUILD_DIR_TEMPLATE="_build_${ARCH}"
BUILD_DIR="${BUILD_DIR:-${SRC_DIR}/${BUILD_DIR_TEMPLATE}}"
run_env_check="yes"
run_verification="yes"
action="none"
env_check()
{
run_in_docker "./docker_env/buildenv_check.sh"
}
run_build()
{
run_in_docker "./build.sh" "${@}"
}
run_verification()
{
echo "Testing!"
# These tests should never fail!
./run_check_material_profiles.sh || echo "Material Profile Check Failed!"
}
run_shellcheck()
{
docker run \
--rm \
-v "$(pwd):${DOCKER_WORK_DIR}" \
-w "${DOCKER_WORK_DIR}" \
"registry.hub.docker.com/koalaman/shellcheck-alpine:stable" \
"./run_shellcheck.sh"
}
usage()
{
echo "Usage: ${0} [OPTIONS]"
echo " -c Skip build environment checks"
echo " -h Print usage"
echo " -s Skip code verification"
}
while getopts ":a:chls" options; do
case "${options}" in
a)
action="${OPTARG}"
;;
c)
run_env_check="no"
;;
h)
usage
exit 0
;;
s)
run_verification="no"
;;
:)
echo "Option -${OPTARG} requires an argument."
exit 1
;;
?)
echo "Invalid option: -${OPTARG}"
exit 1
;;
esac
done
shift "$((OPTIND - 1))"
if ! command -V docker; then
echo "Docker not found, docker-less builds are not supported."
exit 1
fi
case "${action}" in
shellcheck)
run_shellcheck
exit 0
;;
build)
source ./docker_env/make_docker.sh ""
run_build
exit 0
;;
build_docker_cache)
DOCKER_BUILD_ONLY_CACHE="yes"
source ./docker_env/make_docker.sh ""
exit 0
;;
none)
;;
?)
echo "Invalid action: -${OPTARG}"
exit 1
;;
esac
# Make sure to pass an empty argument to make_docker, else any arguments passed to build_for_ultimaker is passed to make_docker instead!
source ./docker_env/make_docker.sh ""
if [ "${run_env_check}" = "yes" ]; then
env_check
fi
run_build "${@}"
if [ "${run_verification}" = "yes" ]; then
run_verification
fi
exit 0