11#! /usr/bin/env bash
2- CC_WRAPPER_VERSION=" 0.0.30 "
2+ CC_WRAPPER_VERSION=" 0.0.31 "
33set +u
44say () {
55 echo -e " $1 "
5252 if [ -f " $CC_BINARY " ];
5353 then
5454 cc_filename=$CC_BINARY
55+ cc_command=$CC_BINARY
5556 else
5657 exit_if_error " Could not find binary file $CC_BINARY "
5758 fi
5859else
5960 if [ -n " $CC_OS " ];
6061 then
6162 say " $g ==>$x Overridden OS: $b ${CC_OS} $x "
62- export cc_os=${CC_OS}
6363 else
64- CC_OS=" linux "
64+ CC_OS=" windows "
6565 family=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
66- cc_os=" windows"
67- [[ $family == " darwin" ]] && cc_os=" macos"
68- [[ $family == " linux" ]] && cc_os=" linux"
69- [[ $cc_os == " linux" ]] && \
66+ [[ $family == " darwin" ]] && CC_OS=" macos"
67+ [[ $family == " linux" ]] && CC_OS=" linux"
68+ [[ $CC_OS == " linux" ]] && \
7069 osID=$( grep -e " ^ID=" /etc/os-release | cut -c4-)
71- [[ $osID == " alpine" ]] && cc_os=" alpine"
72- [[ $( arch) == " aarch64" && $family == " linux" ]] && cc_os+=" -arm64"
73- say " $g ==>$x Detected $b ${cc_os} $x "
74- export cc_os=${cc_os}
70+ [[ $osID == " alpine" ]] && CC_OS=" alpine"
71+ [[ $( arch) == " aarch64" && $family == " linux" ]] && CC_OS+=" -arm64"
72+ say " $g ==>$x Detected $b ${CC_OS} $x "
7573 fi
76- export cc_version=${CC_VERSION}
7774 cc_filename=" codecov"
78- [[ $cc_os == " windows" ]] && cc_filename+=" .exe"
79- export cc_filename= ${ cc_filename}
80- [[ $cc_os == " macos" ]] && \
75+ [[ $CC_OS == " windows" ]] && cc_filename+=" .exe"
76+ cc_command= " ./ $ cc_filename"
77+ [[ $CC_OS == " macos" ]] && \
8178 ! command -v gpg 2>&1 > /dev/null && \
8279 HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
8380 cc_url=" https://cli.codecov.io"
8481 cc_url=" $cc_url /${CC_VERSION} "
85- cc_url=" $cc_url /${cc_os } /${cc_filename} "
82+ cc_url=" $cc_url /${CC_OS } /${cc_filename} "
8683 say " $g ->$x Downloading $b ${cc_url} $x "
8784 curl -Os " $cc_url "
88- say " $g ==>$x Finishing downloading $b ${cc_os } :${CC_VERSION} $x "
89- version_url=" https://cli.codecov.io/api/${cc_os } /${CC_VERSION} "
85+ say " $g ==>$x Finishing downloading $b ${CC_OS } :${CC_VERSION} $x "
86+ version_url=" https://cli.codecov.io/api/${CC_OS } /${CC_VERSION} "
9087 version=$( curl -s " $version_url " -H " Accept:application/json" | jq -r ' .version' )
9188 say " Version: $b$version$x "
9289 say " "
@@ -101,7 +98,7 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
10198 # One-time step
10299 say " $g ==>$x Verifying GPG signature integrity"
103100 sha_url=" https://cli.codecov.io"
104- sha_url=" ${sha_url} /${cc_version } /${cc_os } "
101+ sha_url=" ${sha_url} /${CC_VERSION } /${CC_OS } "
105102 sha_url=" ${sha_url} /${cc_filename} .SHA256SUM"
106103 say " $g ->$x Downloading $b ${sha_url} $x "
107104 say " $g ->$x Downloading $b ${sha_url} .sig$x "
@@ -192,7 +189,7 @@ cc_uc_args+=( $(k_arg SWIFT_PROJECT) $(v_arg SWIFT_PROJECT))
192189IFS=$OLDIFS
193190unset NODE_OPTIONS
194191# See https://github.com/codecov/uploader/issues/475
195- chmod +x $cc_filename
192+ chmod +x $cc_command
196193if [ -n " $CC_TOKEN_VAR " ];
197194then
198195 token=" $( eval echo \$ $CC_TOKEN_VAR ) "
208205 token_arg+=( " -t " " $token " )
209206fi
210207say " $g ==>$x Running upload-coverage"
211- say " $b ./ $cc_filename $( echo " ${cc_cli_args[@]} " ) upload-coverage$token_str $( echo " ${cc_uc_args[@]} " ) $x "
212- if ! ./ $cc_filename \
208+ say " $b$cc_command $( echo " ${cc_cli_args[@]} " ) upload-coverage$token_str $( echo " ${cc_uc_args[@]} " ) $x "
209+ if ! $cc_command \
213210 ${cc_cli_args[*]} \
214211 upload-coverage \
215212 ${token_arg[*]} \
0 commit comments