Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions bump-native-dd-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a bash script that will allow us to automatically update all needed files when bumping a native sdk. All we need is pass the platform and the new version to it and it will update all version numbers on the needed files.


set -euo pipefail

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <ios|android> <new_version>"
exit 1
fi

sdk="$1"
new_version="$2"

build_gradle_files=(
"packages/core/android/build.gradle"
"packages/react-native-session-replay/android/build.gradle"
"packages/react-native-webview/android/build.gradle"
)

podspec_files=(
"packages/core/DatadogSDKReactNative.podspec"
"packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec"
"packages/react-native-webview/DatadogSDKReactNativeWebView.podspec"
)

ios_pattern="('Datadog[^']+', '~> )[0-9.]+'"
android_pattern='(com\.datadoghq:dd-sdk-android-[^:"]+):[0-9.]+'

if [[ "$sdk" == "ios" ]]; then
pattern="$ios_pattern"
files=("${podspec_files[@]}")
sed_pattern="s/${pattern}/\1${new_version}'/"
elif [[ "$sdk" == "android" ]]; then
pattern="$android_pattern"
files=("${build_gradle_files[@]}")
sed_pattern="s/${pattern}/\1:${new_version}/"
else
echo "Unknown platform '$sdk'"
echo "Usage: $0 <ios|android> <new_version>"
exit 1
fi

for file in "${files[@]}"; do
if [[ ! -f "$file" ]]; then
echo "❌ File not found: $file"
continue
fi

echo -e "\nUpdating: $file"

updated=false
tmp_file="${file}.tmp"

while IFS= read -r line; do
if [[ "$line" =~ $pattern ]]; then
old_line="$line"
new_line=$(echo "$line" | sed -E "$sed_pattern")
if [[ "$new_line" != "$old_line" ]]; then
echo "✅ $new_line"
updated=true
echo "$new_line" >> "$tmp_file"
else
echo "$line" >> "$tmp_file"
fi
else
echo "$line" >> "$tmp_file"
fi
done < "$file"

if $updated; then
mv "$tmp_file" "$file"
else
echo "ℹ️ No updates needed in $file"
rm "$tmp_file"
fi
done
8 changes: 4 additions & 4 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly "com.squareup.okhttp3:okhttp:3.12.13"

implementation "com.datadoghq:dd-sdk-android-rum:2.19.2"
implementation "com.datadoghq:dd-sdk-android-logs:2.19.2"
implementation "com.datadoghq:dd-sdk-android-trace:2.19.2"
implementation "com.datadoghq:dd-sdk-android-webview:2.19.2"
implementation "com.datadoghq:dd-sdk-android-rum:2.21.0"
implementation "com.datadoghq:dd-sdk-android-logs:2.21.0"
implementation "com.datadoghq:dd-sdk-android-trace:2.21.0"
implementation "com.datadoghq:dd-sdk-android-webview:2.21.0"
implementation "com.google.code.gson:gson:2.10.0"
testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-session-replay/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ dependencies {
api "com.facebook.react:react-android:$reactNativeVersion"
}
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.datadoghq:dd-sdk-android-session-replay:2.19.2"
implementation "com.datadoghq:dd-sdk-android-internal:2.19.2"
implementation "com.datadoghq:dd-sdk-android-session-replay:2.21.0"
implementation "com.datadoghq:dd-sdk-android-internal:2.21.0"
implementation project(path: ':datadog_mobile-react-native')

testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-webview/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ dependencies {
implementation "com.facebook.react:react-android:$reactNativeVersion"
}

implementation "com.datadoghq:dd-sdk-android-webview:2.14.0"
implementation "com.datadoghq:dd-sdk-android-webview:2.21.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation project(path: ':datadog_mobile-react-native')
Expand Down
1 change: 1 addition & 0 deletions update-native-sdk-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ podspec_files=(
build_gradle_files=(
"packages/core/android/build.gradle"
"packages/react-native-session-replay/android/build.gradle"
"packages/react-native-webview/android/build.gradle"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing.

)

extract_and_validate_version() {
Expand Down
Loading