-
-
Notifications
You must be signed in to change notification settings - Fork 226
/
set-version
executable file
·49 lines (37 loc) · 1.22 KB
/
set-version
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
#!/usr/bin/env bash
# Usage: set-version CORE_VERSION DEP_VERSION
#
# Bumps all core libraries to CORE_VERSION and their dependencies on
# other amazonka libraries to DEP_VERSION.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
# Output a message to stderr.
say() {
echo >&2 "$@"
}
if [ $# -ne 2 ]; then
echo "Usage: set-version CORE_VERSION DEP_VERSION"
exit 1
fi
core_version="$1"
dep_version="$2"
# Note: the version for the generated service's cabal file comes from
# Paths_amazonka_gen.version - so ensure amazonka-gen is bumped.
cabal_files=(
gen/amazonka-gen.cabal
examples/examples.cabal
lib/amazonka/amazonka.cabal
lib/amazonka-core/amazonka-core.cabal
lib/amazonka-test/amazonka-test.cabal
lib/amazonka-dynamodb-attributevalue/amazonka-dynamodb-attributevalue.cabal
lib/amazonka-s3-encryption/amazonka-s3-encryption.cabal
)
say "Setting version = $core_version and dependencies = $dep_version"
for cabal in "${cabal_files[@]}"; do
say "Updating $cabal"
sed -e "s/^\(version: *\).*$/\1$core_version/;" \
-e "s/^\(.*amazonka-[a-z0-9]* *== *\)\([0-9\.]\+\*\)$/\1$dep_version.*/" \
-e "s/^\(.*amazonka *== *\)\([0-9\.]\+\*\)$/\1$dep_version.*/" "$cabal" >"$cabal.new"
mv "$cabal.new" "$cabal"
done
say "Done."