fastlane-plugin-bugsnag 2.3.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/arm64-linux-bugsnag-cli +0 -0
- data/bin/arm64-macos-bugsnag-cli +0 -0
- data/bin/i386-linux-bugsnag-cli +0 -0
- data/bin/i386-windows-bugsnag-cli.exe +0 -0
- data/bin/x86_64-linux-bugsnag-cli +0 -0
- data/bin/x86_64-macos-bugsnag-cli +0 -0
- data/bin/x86_64-windows-bugsnag-cli.exe +0 -0
- data/lib/fastlane/plugin/bugsnag/actions/bugsnag_cli.rb +116 -0
- data/lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb +82 -86
- data/lib/fastlane/plugin/bugsnag/actions/upload_symbols_to_bugsnag.rb +72 -27
- data/lib/fastlane/plugin/bugsnag/version.rb +1 -1
- data/spec/bugsnag_upload_dsym_action_spec.rb +62 -74
- data/spec/fixtures/dummy_bugsnag_cli.sh +13 -0
- data/spec/send_build_to_bugsnag_spec.rb +32 -64
- data/spec/spec_helper.rb +8 -0
- metadata +26 -21
- data/bugsnag-dsym-upload +0 -222
data/bugsnag-dsym-upload
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# Given a directory, uploads any *.dSYM bundles with the directory to
|
|
4
|
-
# Bugsnag. As a pre-upload step, bitcode symbol maps can be combined with
|
|
5
|
-
# dSYM files to ensure symbols are sent for bitcode-enabled binaries.
|
|
6
|
-
#
|
|
7
|
-
# Depends on:
|
|
8
|
-
# * curl
|
|
9
|
-
# * dwarfdump
|
|
10
|
-
# * dsymutil (for --symbol-maps, optional)
|
|
11
|
-
# * unzip (for uploading a .zip file, optional)
|
|
12
|
-
|
|
13
|
-
function print_usage() {
|
|
14
|
-
echo "Usage: $0 [--symbol-maps DIR] dSYMS_PATH"
|
|
15
|
-
echo
|
|
16
|
-
echo "-h, --help Displays this message"
|
|
17
|
-
echo "-v, --verbose Print verbose logging output during execution"
|
|
18
|
-
echo "--api-key API_KEY The API key of the project the dSYM should be applied to"
|
|
19
|
-
echo "--symbol-maps DIR Path to a directory of bitcode symbol maps. The"
|
|
20
|
-
echo " dSYM files will be restored with symbols prior to"
|
|
21
|
-
echo " upload. Requires dsymutil."
|
|
22
|
-
echo "--upload-server URL The server receiving dSYM files. Set this value if"
|
|
23
|
-
echo " using an on-premise Bugsnag installation"
|
|
24
|
-
echo "--project-root DIR The root directory of the project. This will help to"
|
|
25
|
-
echo " group error reports by project"
|
|
26
|
-
echo "--ignore-missing-dwarf Throw warnings instead of errors when a dSYM with missing"
|
|
27
|
-
echo " DWARF data is found"
|
|
28
|
-
echo "--ignore-empty-dsym Throw warnings instead of errors when a *.dSYM file is found"
|
|
29
|
-
echo " rather than the expected *.dSYM directory"
|
|
30
|
-
echo "dSYMS_PATH A directory or .zip file containing *.dSYM bundles to"
|
|
31
|
-
echo " upload"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function exit_with_usage() {
|
|
35
|
-
echo $1
|
|
36
|
-
echo
|
|
37
|
-
print_usage
|
|
38
|
-
exit 1
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function log() {
|
|
42
|
-
if [[ $silent != 1 ]]; then
|
|
43
|
-
echo $@
|
|
44
|
-
fi
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function log_verbose() {
|
|
48
|
-
if [[ $verbose == 1 ]]; then
|
|
49
|
-
log $@
|
|
50
|
-
fi
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
upload_server=https://upload.bugsnag.com
|
|
54
|
-
unset symbol_maps
|
|
55
|
-
unset dsym_dir
|
|
56
|
-
unset verbose
|
|
57
|
-
unset ignore_empty_dsym
|
|
58
|
-
unset ignore_missing_dwarf
|
|
59
|
-
unset silent
|
|
60
|
-
unset project_root
|
|
61
|
-
unset api_key
|
|
62
|
-
|
|
63
|
-
while [[ $# -gt 0 ]]; do
|
|
64
|
-
case $1 in
|
|
65
|
-
-h|--help)
|
|
66
|
-
print_usage
|
|
67
|
-
exit 0;;
|
|
68
|
-
-s|--silent)
|
|
69
|
-
silent=1
|
|
70
|
-
shift;;
|
|
71
|
-
-v|--verbose)
|
|
72
|
-
verbose=1
|
|
73
|
-
shift;;
|
|
74
|
-
--ignore-missing-dwarf)
|
|
75
|
-
ignore_missing_dwarf=1
|
|
76
|
-
shift;;
|
|
77
|
-
--ignore-empty-dsym)
|
|
78
|
-
ignore_empty_dsym=1
|
|
79
|
-
shift;;
|
|
80
|
-
--symbol-maps)
|
|
81
|
-
symbol_maps=$2
|
|
82
|
-
shift
|
|
83
|
-
shift;;
|
|
84
|
-
--upload-server)
|
|
85
|
-
upload_server=$2
|
|
86
|
-
shift
|
|
87
|
-
shift;;
|
|
88
|
-
--api-key)
|
|
89
|
-
api_key=$2
|
|
90
|
-
shift
|
|
91
|
-
shift;;
|
|
92
|
-
--project-root)
|
|
93
|
-
project_root=$2
|
|
94
|
-
shift
|
|
95
|
-
shift;;
|
|
96
|
-
-*)
|
|
97
|
-
exit_with_usage "Invalid parameter provided: $1";;
|
|
98
|
-
*)
|
|
99
|
-
dsym_dir=$1
|
|
100
|
-
break;;
|
|
101
|
-
esac
|
|
102
|
-
done
|
|
103
|
-
|
|
104
|
-
# Set IFS to ensure that file paths with spaces in get processed correctly
|
|
105
|
-
IFS=$'\n'
|
|
106
|
-
|
|
107
|
-
if [[ ! -z $symbol_maps ]]; then
|
|
108
|
-
if [[ ! -d $symbol_maps ]]; then
|
|
109
|
-
exit_with_usage "Bitcode symbol map parameter is not a directory"
|
|
110
|
-
elif [[ ! -x "$(command -v dsymutil 2>/dev/null)" ]]; then
|
|
111
|
-
exit_with_usage "dsymutil command not found."
|
|
112
|
-
fi
|
|
113
|
-
fi
|
|
114
|
-
if [[ -z $dsym_dir ]]; then
|
|
115
|
-
exit_with_usage "No dSYM directory provided"
|
|
116
|
-
fi
|
|
117
|
-
if [[ ! -d $dsym_dir ]]; then
|
|
118
|
-
if [[ $dsym_dir == *".zip" ]]; then
|
|
119
|
-
if [[ ! -x "$(command -v unzip 2>/dev/null)" ]]; then
|
|
120
|
-
exit_with_usage "unzip command not found."
|
|
121
|
-
fi
|
|
122
|
-
temp_dir=$(mktemp -dt "bugsnag-dsym-upload.XXX")
|
|
123
|
-
unzip -qq $dsym_dir -d $temp_dir
|
|
124
|
-
dsym_dir=$temp_dir
|
|
125
|
-
else
|
|
126
|
-
exit_with_usage "'$dsym_dir' is not a directory or a zip file"
|
|
127
|
-
fi
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
log_verbose "Uploading files to $upload_server"
|
|
131
|
-
success_count=0
|
|
132
|
-
warning_count=0
|
|
133
|
-
fail_count=0
|
|
134
|
-
|
|
135
|
-
# Find all files and directories matching *.dSYM, except those in dir __MAXCOSX generated when using macOS Archive Utility
|
|
136
|
-
for dsym in $(find $dsym_dir -name "*.dSYM" ! -path "*/__MACOSX/*"); do
|
|
137
|
-
log_verbose "Preparing to upload $dsym"
|
|
138
|
-
|
|
139
|
-
# check if the .dSYM is a file. Throw an error (warning if --ignore-empty-dsym set) if detected as such;
|
|
140
|
-
# it should be a directory. This can happen due to a bug in Xcode: https://developer.apple.com/forums/thread/659187
|
|
141
|
-
if [ -f $dsym ]; then
|
|
142
|
-
dsym_size=$(wc -c < "$dsym" | xargs)
|
|
143
|
-
if [[ $ignore_empty_dsym == 1 ]]; then
|
|
144
|
-
log "[WARNING] Skipping $dsym as it is a file ($dsym_size bytes), not a directory with DWARF data";
|
|
145
|
-
warning_count=$((warning_count+1))
|
|
146
|
-
else
|
|
147
|
-
log "[ERROR] Skipping $dsym as it is a file ($dsym_size bytes), not a directory with DWARF data";
|
|
148
|
-
fail_count=$((fail_count+1))
|
|
149
|
-
fi
|
|
150
|
-
continue
|
|
151
|
-
fi
|
|
152
|
-
|
|
153
|
-
if [[ -d $symbol_maps ]]; then
|
|
154
|
-
log_verbose "Updating file with bitcode symbol maps in $symbol_maps"
|
|
155
|
-
dsymutil "$dsym" --symbol-map "$symbol_maps"
|
|
156
|
-
fi
|
|
157
|
-
|
|
158
|
-
dwarf_data=$dsym/Contents/Resources/DWARF
|
|
159
|
-
if [[ ! -d $dwarf_data ]]; then
|
|
160
|
-
if [[ $ignore_missing_dwarf == 1 ]]; then
|
|
161
|
-
log "[WARNING] Skipping file missing DWARF data: $dsym"
|
|
162
|
-
warning_count=$((warning_count+1))
|
|
163
|
-
else
|
|
164
|
-
log "[ERROR] Skipping file missing DWARF data: $dsym"
|
|
165
|
-
fail_count=$((fail_count+1))
|
|
166
|
-
fi
|
|
167
|
-
continue
|
|
168
|
-
fi
|
|
169
|
-
for file in $dwarf_data/*; do
|
|
170
|
-
uuid=$(dwarfdump -u $file 2>/dev/null)
|
|
171
|
-
if [[ $uuid == UUID* ]]; then
|
|
172
|
-
log Uploading $uuid
|
|
173
|
-
|
|
174
|
-
# Attach the api key and project root parameters if they have been provided
|
|
175
|
-
args=""
|
|
176
|
-
if [[ ! -z $project_root ]]; then
|
|
177
|
-
args="-F projectRoot=\"$project_root\" "
|
|
178
|
-
fi
|
|
179
|
-
|
|
180
|
-
if [[ ! -z $api_key ]]; then
|
|
181
|
-
args="$args-F apiKey=$api_key"
|
|
182
|
-
fi
|
|
183
|
-
|
|
184
|
-
# We need to shell out to perform the curl as there seems to be some indirect
|
|
185
|
-
# wrapping of this script which causes the command to fail if called directly.
|
|
186
|
-
curl_cmd="curl --fail --silent --show-error --http1.1 $upload_server -F 'dsym=@\"$file\"' $args"
|
|
187
|
-
output=$(sh -c "$curl_cmd")
|
|
188
|
-
|
|
189
|
-
if [ $? -eq 0 ] && [ "$output" != "invalid apiKey" ]; then
|
|
190
|
-
success_count=$((success_count+1))
|
|
191
|
-
else
|
|
192
|
-
fail_count=$((fail_count+1))
|
|
193
|
-
log "[ERROR] Failed to upload file: $file"
|
|
194
|
-
fi
|
|
195
|
-
echo $output | grep -v '^OK$'
|
|
196
|
-
log
|
|
197
|
-
else
|
|
198
|
-
log "[ERROR] Skipping file without UUID: $file"
|
|
199
|
-
fail_count=$((fail_count+1))
|
|
200
|
-
fi
|
|
201
|
-
done
|
|
202
|
-
done
|
|
203
|
-
|
|
204
|
-
exit_code=0
|
|
205
|
-
if [ $success_count -gt 0 ]; then
|
|
206
|
-
log "$success_count file(s) uploaded successfully"
|
|
207
|
-
fi
|
|
208
|
-
|
|
209
|
-
if [ $warning_count -gt 0 ]; then
|
|
210
|
-
log "$warning_count file(s) failed to upload with warnings"
|
|
211
|
-
fi
|
|
212
|
-
|
|
213
|
-
if [ $fail_count -gt 0 ]; then
|
|
214
|
-
exit_code=1
|
|
215
|
-
log "$fail_count file(s) failed to upload with errors"
|
|
216
|
-
fi
|
|
217
|
-
|
|
218
|
-
if [[ $fail_count -gt 0 || $warning_count -gt 0 ]] && [[ $verbose != 1 ]]; then
|
|
219
|
-
log "Re-run the bugsnag-dsym-upload tool with the --verbose option for more information"
|
|
220
|
-
fi
|
|
221
|
-
|
|
222
|
-
exit $exit_code
|