Skip to content

Commit

Permalink
CPPSDK: update install script to handle version parsing for file base…
Browse files Browse the repository at this point in the history
…d and prebuild install cases (#173)
  • Loading branch information
HaseenaSainul authored Mar 7, 2024
1 parent 5e8edf3 commit 67088b1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions languages/cpp/templates/sdk/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ done
GetVersion()
{
PackagePath=${SdkPath}/../../../../../../package-lock.json
InputKey="name\": \"@firebolt-js/openrpc"
LineNo="$(grep -n "${InputKey}" ${PackagePath} | head -n 1 | cut -d: -f1)"
VersionLine=$((LineNo++))
InputKey="\"@firebolt-js/openrpc\":"
Line=$(grep -n "${InputKey}" ${PackagePath})
if [[ "${Line}" == *"file:"* ]]; then
InputKey="name\": \"@firebolt-js/openrpc"
Line=$(grep -n "${InputKey}" ${PackagePath})
LineNo="$(echo ${Line} | head -n 1 | cut -d: -f1)"
VersionLine=$((LineNo++))
else
LineNo="$(echo ${Line} | head -n 1 | cut -d: -f1)"
fi
eval "array=(`sed -n "${LineNo}p" < ${PackagePath} | sed 's/\"/\n/g'`)"
Version=${array[2]}
}
Expand Down

0 comments on commit 67088b1

Please sign in to comment.