Skip to content

Commit dd3b35a

Browse files
committed
debug echo for grep
1 parent 63624d1 commit dd3b35a

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

extract-expose-version.sh

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
#!/bin/bash
22

3-
# Debugging output to check script execution
4-
echo "Script is being executed..."
5-
6-
# Check if the build.gradle.kts file exists
7-
if [ ! -f "app/build.gradle.kts" ]; then
8-
echo "Error: app/build.gradle.kts file not found."
9-
exit 1
10-
fi
11-
123
# Extract Android version code
13-
if [ "$EXPOSE_CODE" == 'true' ]; then
14-
ANDROID_VERSION_CODE=$(grep "versionCode" app/build.gradle.kts | sed "s/.*versionCode\\s*=\\s*\\([0-9]*\\).*/\\1/")
15-
echo "ANDROID_VERSION_CODE extracted: $ANDROID_VERSION_CODE"
4+
ANDROID_VERSION_CODE=$(grep "versionCode" app/build.gradle.kts | sed "s/.*versionCode\\s*=\\s*\\([0-9]*\\).*/\\1/")
5+
if [ -z "$ANDROID_VERSION_CODE" ]; then
6+
echo "Error: Unable to extract version code."
7+
exit 1
168
fi
179

1810
# Extract Android version name
19-
if [ "$EXPOSE_NAME" == 'true' ]; then
20-
ANDROID_VERSION_NAME=$(grep "versionName" app/build.gradle.kts | sed "s/.*versionName\\s*=\\s*'\\(.*\\)'.*/\\1/" | tr -d '[:space:]' | sed 's/"//g' | sed 's/versionName=//')
21-
echo "ANDROID_VERSION_NAME extracted: $ANDROID_VERSION_NAME"
11+
ANDROID_VERSION_NAME=$(grep "versionName" app/build.gradle.kts | sed "s/.*versionName\\s*=\\s*'\\(.*\\)'.*/\\1/")
12+
if [ -z "$ANDROID_VERSION_NAME" ]; then
13+
echo "Error: Unable to extract version name."
14+
exit 1
2215
fi
2316

2417
# Write the extracted values to a temporary file
2518
echo "ANDROID_VERSION_CODE=$ANDROID_VERSION_CODE" > extracted_values.txt
2619
echo "ANDROID_VERSION_NAME=$ANDROID_VERSION_NAME" >> extracted_values.txt
2720

2821
# Debugging output to indicate script completion
29-
echo "Script execution complete."
22+
echo "Script execution complete."

0 commit comments

Comments
 (0)