Skip to content

Commit

Permalink
Fix build on macOS (Bash 3.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
directhex authored and brentschmaltz committed Sep 25, 2023
1 parent d8a5f6e commit ba30608
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions updateAssemblyInfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ dateTimeStamp=$(echo $((10#${date:0:2}-19)))${date:2}

commitSha=$(git rev-parse HEAD)

assemblyVersion=$(sed -n 's/.*<assemblyVersion>\([^<]*\)<.*/\1/p' $PWD/buildConfiguration.xml)
assemblyFileVersion="$assemblyVersion.${dateTimeStamp::-6}" # Trim minutes/seconds
assemblyVersion=$(sed -n 's/.*<assemblyVersion>\([^<]*\)<.*/\1/p' ${scriptroot}/buildConfiguration.xml)
assemblyFileVersion="$assemblyVersion.${dateTimeStamp::$((${#dateTimeStamp} - 6))}" # Trim minutes/seconds
assemblyInformationalVersion="$assemblyVersion.$dateTimeStamp.$commitSha"

echo "assemblyVersion: $assemblyVersion"
echo "assemblyFileVersion: $assemblyFileVersion"
echo "assemblyInformationalVersion: $assemblyInformationalVersion"

nugetSuffix=$(sed -n 's/.*<nugetSuffix>\([^<]*\)<.*/\1/p' $PWD/buildConfiguration.xml)
nugetSuffix=$(sed -n 's/.*<nugetSuffix>\([^<]*\)<.*/\1/p' ${scriptroot}/buildConfiguration.xml)
if [ "$packageType" = "release" ]
then
versionSuffix=""
Expand All @@ -29,17 +29,17 @@ fi

echo "nugetSuffix: $nugetSuffix"

versionPath="$PWD/build/version.props"
versionPath="${scriptroot}/build/version.props"
version=$(cat $versionPath)
version=$(echo "$version" | sed "s|<VersionPrefix>.*</VersionPrefix>|<VersionPrefix>$assemblyVersion</VersionPrefix>|")
version=$(echo "$version" | sed "s|<VersionSuffix>.*</VersionSuffix>|<VersionSuffix>$versionSuffix</VersionSuffix>|")
echo "$version" > $versionPath

projects=$(sed -n '/<src>/,/<\/src>/p' $PWD/buildConfiguration.xml | sed -n 's/.*name="\([^"]*\)".*/\1/p')
projects=$(sed -n '/<src>/,/<\/src>/p' ${scriptroot}/buildConfiguration.xml | sed -n 's/.*name="\([^"]*\)".*/\1/p')

for project in $projects; do
name="$project"
assemblyInfoPath="$PWD/src/$name/Properties/AssemblyInfo.cs"
assemblyInfoPath="${scriptroot}/src/$name/Properties/AssemblyInfo.cs"
echo "assemblyInfoPath: $assemblyInfoPath"

assemblyInfo=$(cat $assemblyInfoPath)
Expand Down

0 comments on commit ba30608

Please sign in to comment.