forked from netz98/n98-magerun2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·91 lines (66 loc) · 1.97 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
#!/bin/bash
#
# build from clean checkout
#
set -euo pipefail
IFS=$'\n\t'
name="$(awk '/<project name="([^"]*)"/ && !done {print gensub(/<project name="([^"]*)".*/, "\\1", "g"); done=1}' build.xml
)"
phar="${name}.phar"
echo "Building ${phar}..."
echo "$0 executed in $(pwd -P)"
build_dir="build/output"
if [ -d "${build_dir}" ]; then
rm -rf "${build_dir}"
fi
if [ -d "${build_dir}" ]; then
echo "Can not remove build-dir '${build_dir}'"
fi
mkdir "${build_dir}"
if [ ! -d "${build_dir}" ]; then
echo "Can not create build-dir '${build_dir}'"
echo "aborting."
exit 1
fi
git clone -l -- . "${build_dir}"
composer="${build_dir}/composer.phar"
if [ -e "${composer}" ]; then
rm "${composer}"
fi
if [ ! -e "${composer}" ]; then
echo "Downloading composer.phar..."
wget -O "${composer}" https://getcomposer.org/download/1.1.3/composer.phar
chmod +x "${composer}"
fi
"${composer}" --version
php --version
if ! "${composer}" -d="${build_dir}" --profile -q install --no-dev --no-interaction; then
echo "failed to install from composer.lock, installing without lockfile now"
rm "${build_dir}"/composer.lock
"${composer}" -d="${build_dir}" --profile -q install --no-dev --no-interaction
fi
"${composer}" -d="${build_dir}"/build --profile -q install --no-interaction
if [ -e "${phar}" ]; then
echo "Remove earlier created ${phar} file"
rm "${phar}"
fi
cd "${build_dir}"
echo "building in $(pwd -P)"
git log --oneline -1
ulimit -Sn $(ulimit -Hn)
set +e
php -f build/vendor/phing/phing/bin/phing -dphar.readonly=0 -- -verbose dist
BUILD_STATUS=$?
set -e
if [ ${BUILD_STATUS} -ne 0 ]; then
>&2 echo "error: phing build failed with exit status ${BUILD_STATUS}"
exit ${BUILD_STATUS}
fi
php -f build/phar/phar-timestamp.php
php -f "${phar}" -- --version
ls -l "${phar}"
php -r 'echo "SHA1: ", sha1_file("'"${phar}"'"), "\nMD5.: ", md5_file("'"${phar}"'"), "\n";'
cd -
cp -vip "${build_dir}"/"${phar}" "${phar}"
rm -rf "${build_dir}"
echo "done."