-
Notifications
You must be signed in to change notification settings - Fork 14
/
update.sh
executable file
·102 lines (91 loc) · 2.56 KB
/
update.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
#!/usr/bin/env bash
set -e
variants=('32' '33' '34')
## Disabled creating extra node variants, rather just having a default for each SDK
#node_variants=('14' '18')
declare -A default_node_variants=(
['32']='18'
['33']='18'
['34']='20'
)
jdk_variants=('11' '17')
declare -A default_jdk_variants=(
['32']='11'
['33']='11'
['34']='17'
)
declare -A build_tools=(
['32']='32.0.0'
['33']='33.0.2'
['34']='34.0.0'
)
declare -A extra_packages=(
['32']='"build-tools;32.0.0"'
['33']='"build-tools;33.0.0 build-tools;33.0.1"'
['34']=''
)
for variant in "${variants[@]}"; do
# for node_variant in "${node_variants[@]}"; do
for jdk_variant in "${jdk_variants[@]}"; do
for type in 'default' 'emulator' 'ndk' 'stf-client'; do
template="Dockerfile.template"
default_node_variant="${default_node_variants[$variant]}"
default_jdk_variant="${default_jdk_variants[$variant]}"
node_variant="$default_node_variant"
if [ "$type" != "default" ]; then
dir="$variant-$type"
if [ "$node_variant" != "$default_node_variant" ]; then
break 1
fi
if [ "$jdk_variant" != "$default_jdk_variant" ]; then
break 1
fi
else
dir="$variant"
if [ "$node_variant" != "$default_node_variant" ] && [ "$jdk_variant" != "$default_jdk_variant" ]; then
break 1
fi
fi
if [ "$node_variant" != "$default_node_variant" ]; then
dir="$dir-node$node_variant"
fi
if [ "$jdk_variant" != "$default_jdk_variant" ]; then
dir="$dir-jdk$jdk_variant"
fi
echo "$dir"
rm -rf "$dir"
mkdir -p "$dir"
cp -r tools/ "$dir/tools/"
extra_sed=''
if [ "$type" = "emulator" ]; then
cp -r tools-emulator/ "$dir/tools-emulator/"
else
extra_sed='
'"$extra_sed"'
/##<emulator>##/,/##<\/emulator>##/d;
'
fi
if [ "$type" != "ndk" ]; then
extra_sed='
'"$extra_sed"'
/##<ndk>##/,/##<\/ndk>##/d;
'
fi
if [ "$type" != "stf-client" ]; then
extra_sed='
'"$extra_sed"'
/##<stf-client>##/,/##<\/stf-client>##/d;
'
fi
sed -E '
'"$extra_sed"'
s/%%VARIANT%%/'"$variant"'/;
s/%%NODE_VARIANT%%/'"$node_variant"'/;
s/%%BUILD_TOOLS%%/'"${build_tools[$variant]}"'/;
s/%%EXTRA_PACKAGES%%/'"${extra_packages[$variant]}"'/;
s/%%JDK_VERSION%%/'"$jdk_variant"'/;
' $template >"$dir/Dockerfile"
done
done
# done
done