Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master to master-vs-deps #51352

Merged
18 commits merged into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.21116.3">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.21118.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>1c06c541c2dc6edb3d652cb092785eb341ef8331</Sha>
<Sha>4957a6f3dd5f6fd1ca9ff06f9c50402f2e3b17e8</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.10.0-1.21113.12">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>69f354dd21df8dac374c35169bdabb9000cfdea3</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="2.0.0-beta.21116.3">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="2.0.0-beta.21118.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>1c06c541c2dc6edb3d652cb092785eb341ef8331</Sha>
<Sha>4957a6f3dd5f6fd1ca9ff06f9c50402f2e3b17e8</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
43 changes: 37 additions & 6 deletions eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,28 @@ function InstallDotNet {
}
}

function with_retries {
local maxRetries=5
local retries=1
echo "Trying to run '$@' for maximum of $maxRetries attempts."
while [[ $((retries++)) -le $maxRetries ]]; do
"$@"

if [[ $? == 0 ]]; then
echo "Ran '$@' successfully."
return 0
fi

timeout=$((3**$retries-1))
echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2
sleep $timeout
done

echo "Failed to execute '$@' for $maxRetries times." 1>&2

return 1
}

function GetDotNetInstallScript {
local root=$1
local install_script="$root/dotnet-install.sh"
Expand All @@ -246,13 +268,22 @@ function GetDotNetInstallScript {

# Use curl if available, otherwise use wget
if command -v curl > /dev/null; then
# first, try directly, if this fails we will retry with verbose logging
curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
if command -v openssl &> /dev/null
then
echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation"
echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443
fi
echo "Will now retry the same URL with verbose logging."
with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
}
}
else
wget -q -O "$install_script" "$install_script_url" || {
else
with_retries wget -v -O "$install_script" "$install_script_url" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
Expand All @@ -267,7 +298,7 @@ function InitializeBuildTool {
if [[ -n "${_InitializeBuildTool:-}" ]]; then
return
fi

InitializeDotNetCli $restore

# return values
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"xcopy-msbuild": "16.8.0-preview2.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.21116.3",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.21116.3"
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.21118.7",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.21118.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
//
// {
// $anonymous$ local = value as $anonymous$;
// return local != null
// return (object)local == this || (local != null
// && System.Collections.Generic.EqualityComparer<T_1>.Default.Equals(this.backingFld_1, local.backingFld_1)
// ...
// && System.Collections.Generic.EqualityComparer<T_N>.Default.Equals(this.backingFld_N, local.backingFld_N);
// && System.Collections.Generic.EqualityComparer<T_N>.Default.Equals(this.backingFld_N, local.backingFld_N));
// }

// Type and type expression
Expand Down Expand Up @@ -137,6 +137,9 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
fields.Free();
}

// Compare references
retExpression = F.LogicalOr(F.ObjectEqual(F.This(), boundLocal), retExpression);

// Final return statement
BoundStatement retStatement = F.Return(retExpression);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
// delegate to:
//
// virtual bool Equals(Derived other) =>
// base.Equals((Base)other) &&
// field1 == other.field1 && ... && fieldN == other.fieldN;
// (object)other == this || (base.Equals((Base)other) &&
// field1 == other.field1 && ... && fieldN == other.fieldN);
retExpr = F.Call(
F.Base(baseEquals.ContainingType),
baseEquals,
Expand Down Expand Up @@ -155,7 +155,7 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
}

fields.Free();

retExpr = F.LogicalOr(F.ObjectEqual(F.This(), other), retExpr);
F.CloseMethod(F.Block(F.Return(retExpr)));
}
catch (SyntheticBoundNodeFactory.MissingPredefinedMember ex)
Expand Down
30 changes: 30 additions & 0 deletions src/Compilers/CSharp/Portable/Syntax/SyntaxNormalizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ internal class SyntaxNormalizer : CSharpSyntaxRewriter

private bool _afterLineBreak;
private bool _afterIndentation;
private bool _inSingleLineInterpolation;

// CONSIDER: if we become concerned about space, we shouldn't actually need any
// of the values between indentations[0] and indentations[initialDepth] (exclusive).
Expand Down Expand Up @@ -177,6 +178,11 @@ private static bool NeedsIndentAfterLineBreak(SyntaxToken token)

private int LineBreaksAfter(SyntaxToken currentToken, SyntaxToken nextToken)
{
if (_inSingleLineInterpolation)
{
return 0;
}

if (currentToken.IsKind(SyntaxKind.EndOfDirectiveToken))
{
return 1;
Expand Down Expand Up @@ -915,5 +921,29 @@ node is QueryExpressionSyntax ||

return 0;
}

public override SyntaxNode? VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node)
{
if (node.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
{
//Just for non verbatim strings we want to make sure that the formatting of interpolations does not emit line breaks.
//See: https://github.com/dotnet/roslyn/issues/50742
//
//The flag _inSingleLineInterpolation is set to true while visiting InterpolatedStringExpressionSyntax and checked in LineBreaksAfter
//to suppress adding newlines.
var old = _inSingleLineInterpolation;
_inSingleLineInterpolation = true;
try
{
return base.VisitInterpolatedStringExpression(node);
}
finally
{
_inSingleLineInterpolation = old;
}
}

return base.VisitInterpolatedStringExpression(node);
}
}
}
Loading