From a170329111ca22c18cf2388975182fe6e6d14209 Mon Sep 17 00:00:00 2001 From: HaseenaSainul Date: Thu, 7 Mar 2024 01:18:19 -0500 Subject: [PATCH] CPPSDK: update install script to handle version parsing for file based and prebuild install cases --- languages/cpp/templates/sdk/scripts/install.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/languages/cpp/templates/sdk/scripts/install.sh b/languages/cpp/templates/sdk/scripts/install.sh index b1aa8892..b31556a2 100755 --- a/languages/cpp/templates/sdk/scripts/install.sh +++ b/languages/cpp/templates/sdk/scripts/install.sh @@ -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]} }