Skip to content

Commit b53e526

Browse files
authored
chore: add script to update sdk versions table (#3239)
* Update * Update * Update update-sdk-versions-table.sh
1 parent be0d714 commit b53e526

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

docs/sdk-versions.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SDK Versions
2+
3+
This document shows which version of the various Sentry SDKs are used in which Sentry Flutter SDK version.
4+
5+
## Version Table
6+
7+
| Sentry Flutter SDK | Sentry Android SDK | Sentry Cocoa SDK | Sentry JavaScript SDK | Sentry Native SDK |
8+
| ------------------ | ------------------ | ---------------- | --------------------- | ----------------- |
9+
| 9.6.0 | 8.17.0 | 8.52.1 | 9.40.0 | 0.9.1 |
10+
| 9.5.0 | 8.13.2 | 8.52.1 | 9.40.0 | 0.9.1 |
11+
| 9.4.1 | 8.13.2 | 8.52.1 | 9.5.0 | 0.9.0 |
12+
| 9.4.0 | 8.13.2 | 8.52.1 | 9.5.0 | 0.9.0 |
13+
| 9.3.0 | 8.12.0 | 8.52.1 | 9.5.0 | 0.9.0 |
14+
| 9.2.0 | 8.12.0 | 8.52.1 | 9.5.0 | 0.9.0 |
15+
| 9.1.0 | 8.12.0 | 8.52.1 | 9.5.0 | 0.9.0 |
16+
| 9.0.0 | 8.12.0 | 8.51.0 | 9.5.0 | 0.8.4 |

scripts/bump-version.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ done
2121
perl -pi -e "s/sdkVersion = '.*'/sdkVersion = '$NEW_VERSION'/" packages/*/lib/src/version.dart
2222
# Bump version in flutter example
2323
perl -pi -e "s/^version: .*/version: $NEW_VERSION/" packages/flutter/example/pubspec.yaml
24+
25+
# Update SDK versions table mapping for this Flutter release
26+
"${SCRIPT_DIR}/update-sdk-versions-table.sh" "$NEW_VERSION"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
detect_repo_root() {
6+
local git_root
7+
if command -v git >/dev/null 2>&1; then
8+
if git_root=$(git rev-parse --show-toplevel 2>/dev/null); then
9+
echo "${git_root}"
10+
return 0
11+
fi
12+
fi
13+
14+
# Fallback to script directory's parent (repo layout assumption)
15+
local script_dir
16+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17+
echo "$(cd "${script_dir}/.." && pwd)"
18+
}
19+
20+
REPO_ROOT="$(detect_repo_root)"
21+
22+
DOC="${REPO_ROOT}/docs/sdk-versions.md"
23+
24+
print_usage() {
25+
cat <<'USAGE'
26+
Usage: scripts/update-sdk-versions-table.sh <flutter_version>
27+
28+
Arguments:
29+
<flutter_version> Required. The Sentry Flutter SDK version (e.g., 9.9.9 or 9.5.0-beta.1).
30+
USAGE
31+
}
32+
33+
# Parse flags (support -h/--help only for now)
34+
for arg in "$@"; do
35+
case "$arg" in
36+
-h|--help)
37+
print_usage
38+
exit 0
39+
;;
40+
esac
41+
done
42+
43+
# Positional argument: Flutter version (required)
44+
FLUTTER_VERSION=${1:-}
45+
if [[ -z "${FLUTTER_VERSION}" ]]; then
46+
echo "Error: Missing required <flutter_version> argument." >&2
47+
echo >&2
48+
print_usage >&2
49+
exit 2
50+
fi
51+
52+
ANDROID_VERSION="$(${REPO_ROOT}/packages/flutter/scripts/update-android.sh get-version)"
53+
COCOA_VERSION="$(${REPO_ROOT}/packages/flutter/scripts/update-cocoa.sh get-version)"
54+
JS_VERSION="$(${REPO_ROOT}/packages/flutter/scripts/update-js.sh get-version)"
55+
NATIVE_VERSION="$(${REPO_ROOT}/packages/flutter/scripts/update-native.sh get-version)"
56+
57+
ROW="| ${FLUTTER_VERSION} | ${ANDROID_VERSION} | ${COCOA_VERSION} | ${JS_VERSION} | ${NATIVE_VERSION} |"
58+
59+
# Bootstrap docs file if missing
60+
if [[ ! -f "${DOC}" ]]; then
61+
{
62+
echo '# SDK Versions'
63+
echo
64+
echo 'This document shows which version of the various Sentry SDKs are used in which Sentry Flutter SDK version.'
65+
echo
66+
echo '## Version Table'
67+
echo
68+
echo '| Sentry Flutter SDK | Sentry Android SDK | Sentry Cocoa SDK | Sentry JavaScript SDK | Sentry Native SDK |'
69+
echo '| ------------------ | ------------------ | ---------------- | --------------------- | ----------------- |'
70+
echo "${ROW}"
71+
} > "${DOC}"
72+
exit 0
73+
fi
74+
75+
# Always insert the new row directly below the table separator of the first table
76+
awk -v row="$ROW" '
77+
BEGIN { in_table=0; inserted=0 }
78+
{
79+
print $0
80+
if (!in_table && $0 ~ /^\| Sentry Flutter SDK \|/) {
81+
in_table=1
82+
next
83+
}
84+
if (in_table && !inserted && $0 ~ /^\| *-+ *\|/) {
85+
print row
86+
inserted=1
87+
in_table=0
88+
}
89+
}
90+
END {
91+
if (!inserted) {
92+
# If no header/separator found, append at end for robustness
93+
print row
94+
}
95+
}
96+
' "$DOC" >"$DOC.tmp"
97+
98+
mv "$DOC.tmp" "$DOC"
99+
100+
exit 0
101+
102+

0 commit comments

Comments
 (0)