@@ -58,6 +58,13 @@ EXTRA_ARGS="$SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS $IN
5858
5959UPLOAD_DEBUG_FILES=" \" $SENTRY_CLI_EXECUTABLE \" debug-files upload $EXTRA_ARGS \" $DWARF_DSYM_FOLDER_PATH \" "
6060
61+ # Print a message only when SENTRY_DSYM_DEBUG is set
62+ _sentry_dsym_log () {
63+ if [ -n " ${SENTRY_DSYM_DEBUG} " ]; then
64+ echo " $1 "
65+ fi
66+ }
67+
6168# Check if dSYM files are fully generated and ready to upload.
6269# Returns 0 (ready) or 1 (not ready yet), printing a status message in either case.
6370_sentry_check_dsym_ready () {
@@ -67,14 +74,14 @@ _sentry_check_dsym_ready() {
6774 local max_attempts=" $4 "
6875
6976 if [ ! -d " $dsym_folder " ]; then
70- echo " dSYM folder does not exist yet: $dsym_folder (attempt $attempt /$max_attempts )"
77+ _sentry_dsym_log " dSYM folder does not exist yet: $dsym_folder (attempt $attempt /$max_attempts )"
7178 return 1
7279 fi
7380
7481 local dsym_count
7582 dsym_count=$( find " $dsym_folder " -name " *.dSYM" -type d 2> /dev/null | wc -l | tr -d ' ' )
7683 if [ " $dsym_count " -eq 0 ]; then
77- echo " No dSYM bundles found yet in $dsym_folder (attempt $attempt /$max_attempts )"
84+ _sentry_dsym_log " No dSYM bundles found yet in $dsym_folder (attempt $attempt /$max_attempts )"
7885 return 1
7986 fi
8087
@@ -90,34 +97,34 @@ _sentry_check_dsym_ready() {
9097 return 0
9198 fi
9299 done
93- echo " Found dSYM bundle(s) but none have complete DWARF content yet (attempt $attempt /$max_attempts )"
100+ _sentry_dsym_log " Found dSYM bundle(s) but none have complete DWARF content yet (attempt $attempt /$max_attempts )"
94101 return 1
95102 fi
96103
97104 # DWARF_DSYM_FILE_NAME set: verify the main app dSYM is complete
98105 local main_dsym=" $dsym_folder /$dsym_file_name "
99106 if [ ! -d " $main_dsym " ]; then
100- echo " Main app dSYM not found yet: $dsym_file_name (attempt $attempt /$max_attempts )"
107+ _sentry_dsym_log " Main app dSYM not found yet: $dsym_file_name (attempt $attempt /$max_attempts )"
101108 return 1
102109 fi
103110
104111 local dwarf_dir=" $main_dsym /Contents/Resources/DWARF"
105112 if [ ! -d " $dwarf_dir " ]; then
106- echo " Main app dSYM structure incomplete (missing DWARF directory): $dsym_file_name (attempt $attempt /$max_attempts )"
113+ _sentry_dsym_log " Main app dSYM structure incomplete (missing DWARF directory): $dsym_file_name (attempt $attempt /$max_attempts )"
107114 return 1
108115 fi
109116
110117 local dwarf_files
111118 dwarf_files=$( find " $dwarf_dir " -type f 2> /dev/null | head -1)
112119 if [ -z " $dwarf_files " ]; then
113- echo " Main app dSYM DWARF directory is empty: $dsym_file_name (attempt $attempt /$max_attempts )"
120+ _sentry_dsym_log " Main app dSYM DWARF directory is empty: $dsym_file_name (attempt $attempt /$max_attempts )"
114121 return 1
115122 fi
116123
117124 local dwarf_size
118125 dwarf_size=$( find " $dwarf_dir " -type f -size +0 2> /dev/null | head -1)
119126 if [ -z " $dwarf_size " ]; then
120- echo " Main app dSYM DWARF binary is empty (still being written): $dsym_file_name (attempt $attempt /$max_attempts )"
127+ _sentry_dsym_log " Main app dSYM DWARF binary is empty (still being written): $dsym_file_name (attempt $attempt /$max_attempts )"
121128 return 1
122129 fi
123130
@@ -148,17 +155,9 @@ wait_for_dsym_files() {
148155 echo " Checking for dSYM files in: $DWARF_DSYM_FOLDER_PATH "
149156
150157 # Debug information to help diagnose issues
151- if [ -n " ${SENTRY_DSYM_DEBUG} " ]; then
152- echo " DEBUG: DWARF_DSYM_FOLDER_PATH=$DWARF_DSYM_FOLDER_PATH "
153- echo " DEBUG: DWARF_DSYM_FILE_NAME=$DWARF_DSYM_FILE_NAME "
154- echo " DEBUG: PRODUCT_NAME=$PRODUCT_NAME "
155- if [ -d " $DWARF_DSYM_FOLDER_PATH " ]; then
156- echo " DEBUG: Contents of dSYM folder:"
157- ls -la " $DWARF_DSYM_FOLDER_PATH " 2> /dev/null || echo " Cannot list folder"
158- else
159- echo " DEBUG: dSYM folder does not exist yet"
160- fi
161- fi
158+ _sentry_dsym_log " DEBUG: DWARF_DSYM_FOLDER_PATH=$DWARF_DSYM_FOLDER_PATH "
159+ _sentry_dsym_log " DEBUG: DWARF_DSYM_FILE_NAME=$DWARF_DSYM_FILE_NAME "
160+ _sentry_dsym_log " DEBUG: PRODUCT_NAME=$PRODUCT_NAME "
162161
163162 while [ $attempt -le $max_attempts ]; do
164163 if _sentry_check_dsym_ready " $DWARF_DSYM_FOLDER_PATH " " $DWARF_DSYM_FILE_NAME " " $attempt " " $max_attempts " ; then
0 commit comments