Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix .NET install when an RSP file is encountered
MSBuild picks up response files automatically,
which messes up reading from standard output.

This fixes the way it's read from std output,
so that it always gets the intended value.

Also, this is just a simplified hack and in no-way
it can get the right value from any MSBuild target
output stream.
  • Loading branch information
Nirmal4G committed Mar 28, 2021
commit f1ebd75a453548cd6a7649edf700853d65a219e4
32 changes: 23 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
# Run install.sh for cli
chmod +x cli/dotnet-install.sh

# v1 needed for some test and bootstrapping testing version
# Get recommended version for bootstrapping testing version
cli/dotnet-install.sh -i cli -c 1.0

if (( $? )); then
Expand All @@ -33,11 +33,25 @@ fi

DOTNET="$(pwd)/cli/dotnet"

echo "$DOTNET msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting"
# Let the dotnet cli expand and decompress first if it's a first-run
$DOTNET --info

# Get CLI Branches for testing
echo "dotnet msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting"

IFS=$'\n'
CMD_OUT_LINES=(`dotnet msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting`)
# Take only last the line which has the version information and strip all the spaces
CMD_LAST_LINE=${CMD_OUT_LINES[-1]//[[:space:]]}
unset IFS

IFS=$';'
DOTNET_BRANCHES=(${CMD_LAST_LINE})
unset IFS

# run it twice so dotnet cli can expand and decompress without affecting the result of the target
$DOTNET msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting
DOTNET_BRANCH="$($DOTNET msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting)"
IFS=$':'
DOTNET_BRANCH=(${DOTNET_BRANCHES[0]})
unset IFS

echo $DOTNET_BRANCH
cli/dotnet-install.sh -i cli -c $DOTNET_BRANCH
Expand Down Expand Up @@ -67,17 +81,17 @@ then
fi

# restore packages
echo "$DOTNET msbuild build/build.proj /t:Restore /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta"
$DOTNET msbuild build/build.proj /t:Restore /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta
echo "dotnet msbuild build/build.proj /t:Restore /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta"
dotnet msbuild build/build.proj /t:Restore /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta

if [ $? -ne 0 ]; then
echo "Restore failed!!"
exit 1
fi

# run tests
echo "$DOTNET msbuild build/build.proj /t:CoreUnitTests /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta"
$DOTNET msbuild build/build.proj /t:CoreUnitTests /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta
echo "dotnet msbuild build/build.proj /t:CoreUnitTests /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta"
dotnet msbuild build/build.proj /t:CoreUnitTests /p:VisualStudioVersion=16.0 /p:Configuration=Release /p:BuildNumber=1 /p:ReleaseLabel=beta

if [ $? -ne 0 ]; then
echo "Tests failed!!"
Expand Down
8 changes: 5 additions & 3 deletions build/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ Function Install-DotnetCLI {
)
$vsMajorVersion = Get-VSMajorVersion
$MSBuildExe = Get-MSBuildExe $vsMajorVersion
$CliBranchListForTesting = & $msbuildExe $NuGetClientRoot\build\config.props /v:m /nologo /t:GetCliBranchForTesting
$CliBranchList = $CliBranchListForTesting.Trim().Split(';');

$CmdOutLines = ((& $msbuildExe $NuGetClientRoot\build\config.props /v:m /nologo /t:GetCliBranchForTesting) | Out-String).Trim()
$CliBranchListForTesting = ($CmdOutLines -split [Environment]::NewLine)[-1]
$CliBranchList = $CliBranchListForTesting -split ';'

$DotNetInstall = Join-Path $CLIRoot 'dotnet-install.ps1'

Expand All @@ -171,7 +173,7 @@ Function Install-DotnetCLI {

ForEach ($CliBranch in $CliBranchList) {
$CliBranch = $CliBranch.trim()
$CliChannelAndVersion = $CliBranch -split "\s+"
$CliChannelAndVersion = $CliBranch -split ":"

$Channel = $CliChannelAndVersion[0].trim()
if ($CliChannelAndVersion.count -eq 1) {
Expand Down
2 changes: 1 addition & 1 deletion build/config.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<!-- Specifies the SDK version to download to use for testing. The first value represents the channel, the second value represents the exact SDK version to be download. If a version is not specified, the latest version from the channel will be downloaded.
Note that multiple SDKs can be downloaded by using `;` as a separator.
-->
<CliBranchForTesting Condition="'$(CliBranchForTesting)' == ''">release/5.0.2xx 5.0.200-servicing.21120.4</CliBranchForTesting>
<CliBranchForTesting Condition="'$(CliBranchForTesting)' == ''">release/5.0.2xx:5.0.200-servicing.21120.4</CliBranchForTesting>
</PropertyGroup>

<!-- Config -->
Expand Down
20 changes: 16 additions & 4 deletions scripts/funcTests/runFuncTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,24 @@ fi

DOTNET="$(pwd)/cli/dotnet"

# Let the dotnet cli expand and decompress first if it's a first-run
$DOTNET --info

# Get CLI Branches for testing
echo "dotnet msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting"
# run it twice so dotnet cli can expand and decompress without affecting the result of the target
dotnet msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting
DOTNET_BRANCHES="$(dotnet msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting)"
echo $DOTNET_BRANCHES | tr ";" "\n" | while read -r DOTNET_BRANCH

IFS=$'\n'
CMD_OUT_LINES=(`dotnet msbuild build/config.props /v:m /nologo /t:GetCliBranchForTesting`)
# Take only last the line which has the version information and strip all the spaces
DOTNET_BRANCHES=${CMD_OUT_LINES[-1]//[[:space:]]}
unset IFS

IFS=$';'
for DOTNET_BRANCH in ${DOTNET_BRANCHES[@]}
do
echo $DOTNET_BRANCH

IFS=$':'
ChannelAndVersion=($DOTNET_BRANCH)
Channel=${ChannelAndVersion[0]}
if [ ${#ChannelAndVersion[@]} -eq 1 ]
Expand All @@ -63,6 +73,8 @@ do
else
Version=${ChannelAndVersion[1]}
fi
unset IFS

echo "Channel is: $Channel"
echo "Version is: $Version"
scripts/funcTests/dotnet-install.sh -i cli -c $Channel -v $Version -nopath
Expand Down