Skip to content

Commit

Permalink
Cherry picking main into release/6.0 (#1688)
Browse files Browse the repository at this point in the history
* updated package versions to GA for package dependencies (#1673)

* updated package versions to GA for package dependencies

* updated sdk version in global.json

* reverted a couple versions

* Fix spacing

* Use MicrosoftGraph for appsettings

* Fix scopes

* revert scopes appsettings field

* Update code modifier configs

* [main] Update dependencies from dotnet/arcade (#1663)

* Update dependencies from https://github.com/dotnet/arcade build 20211007.3

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21507.3

* Update dependencies from https://github.com/dotnet/arcade build 20211008.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21508.1

* Update dependencies from https://github.com/dotnet/arcade build 20211011.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21511.1

* Update dependencies from https://github.com/dotnet/arcade build 20211012.3

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21512.3

* Update dependencies from https://github.com/dotnet/arcade build 20211013.5

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21513.5

* Update dependencies from https://github.com/dotnet/arcade build 20211014.3

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21514.3

* Update dependencies from https://github.com/dotnet/arcade build 20211015.2

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21515.2

* Update dependencies from https://github.com/dotnet/arcade build 20211018.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21518.1

* Update dependencies from https://github.com/dotnet/arcade build 20211018.6

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21518.6

* Update dependencies from https://github.com/dotnet/arcade build 20211019.8

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21519.8

* Update dependencies from https://github.com/dotnet/arcade build 20211020.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21520.1

* Update dependencies from https://github.com/dotnet/arcade build 20211021.5

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21521.5

* Update dependencies from https://github.com/dotnet/arcade build 20211022.2

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21522.2

* Update dependencies from https://github.com/dotnet/arcade build 20211024.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21524.1

* Update dependencies from https://github.com/dotnet/arcade build 20211026.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21526.1

* Update dependencies from https://github.com/dotnet/arcade build 20211027.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21527.1

* Update dependencies from https://github.com/dotnet/arcade build 20211027.5

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21527.5

* Update dependencies from https://github.com/dotnet/arcade build 20211028.3

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21528.3

* Update dependencies from https://github.com/dotnet/arcade build 20211029.1

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21529.1

* updated xunit version

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: deepchoudhery <decho@microsoft.com>

* Update dependencies from https://github.com/dotnet/arcade build 20211102.1 (#1681)

Microsoft.DotNet.Arcade.Sdk
 From Version 7.0.0-beta.21529.1 -> To Version 7.0.0-beta.21552.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* removing node type check, we shouldn't care what type of node. (#1684)

* Update Web API code modifier config

* code change fixes for dotnet-msidentity scenarios (#1683)

* code change fixes for dotnet-msidentity scenarios

* minor fixes

* fixed spacing in webapi msidentity config.

Co-authored-by: Zach Halzel <zahalzel@microsoft.com>
Co-authored-by: zahalzel <75647613+zahalzel@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
  • Loading branch information
5 people committed Mar 30, 2022
1 parent f35a6f5 commit 08adb74
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 47 deletions.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22179.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21552.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>1527dc867ccb652def4c0f57fbd2ebbed3a94019</Sha>
<Sha>c336f6cb59bd52dfe2a844c738ec044affc57634</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
28 changes: 3 additions & 25 deletions eng/common/native/init-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

if [[ "$#" -lt 3 ]]; then
echo "Usage..."
echo "init-compiler.sh <script directory> <Architecture> <compiler>"
echo "init-compiler.sh <script directory> <Architecture> <compiler> <compiler major version> <compiler minor version>"
echo "Specify the script directory."
echo "Specify the target architecture."
echo "Specify the name of compiler (clang or gcc)."
Expand All @@ -16,31 +16,9 @@ fi
nativescriptroot="$1"
build_arch="$2"
compiler="$3"

case "$compiler" in
clang*|-clang*|--clang*)
# clangx.y or clang-x.y
version="$(echo "$compiler" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
majorVersion="${parts[0]}"
minorVersion="${parts[1]}"
if [[ -z "$minorVersion" && "$majorVersion" -le 6 ]]; then
minorVersion=0;
fi
compiler=clang
;;

gcc*|-gcc*|--gcc*)
# gccx.y or gcc-x.y
version="$(echo "$compiler" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
majorVersion="${parts[0]}"
minorVersion="${parts[1]}"
compiler=gcc
;;
esac

cxxCompiler="$compiler++"
majorVersion="$4"
minorVersion="$5"

. "$nativescriptroot"/../pipeline-logging-functions.sh

Expand Down
9 changes: 1 addition & 8 deletions eng/common/templates/job/execute-sdl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ jobs:
- name: GuardianVersion
value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
name: VSEngSS-MicroBuild2022-1ES
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Server.Amd64.VS2019
vmImage: windows-2019
steps:
- checkout: self
clean: true
Expand Down
5 changes: 3 additions & 2 deletions eng/common/templates/job/onelocbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ parameters:
dependsOn: ''

# Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool
pool: ''

pool:
vmImage: 'windows-2019'

CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex
GithubPat: $(BotAccount-dotnet-bot-repo-PAT)

Expand Down
2 changes: 2 additions & 0 deletions eng/common/templates/job/source-index-stage1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ parameters:
sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci"
preSteps: []
binlogPath: artifacts/log/Debug/Build.binlog
pool:
vmImage: 'windows-2019'
condition: ''
dependsOn: ''

Expand Down
20 changes: 11 additions & 9 deletions eng/common/templates/jobs/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,17 @@ jobs:
- ${{ if eq(parameters.enableSourceBuild, true) }}:
- Source_Build_Complete
pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
name: VSEngSS-MicroBuild2022-1ES
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Server.Amd64.VS2019

vmImage: 'windows-2019'
runAsPublic: ${{ parameters.runAsPublic }}
publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }}
enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }}

- ${{ if eq(parameters.graphFileGeneration.enabled, true) }}:
- template: ../job/generate-graph-files.yml
parameters:
continueOnError: ${{ parameters.continueOnError }}
includeToolset: ${{ parameters.graphFileGeneration.includeToolset }}
dependsOn:
- Asset_Registry_Publish
pool:
vmImage: 'windows-2019'
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"dotnet": "6.0.200"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22179.1"
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21552.1"
},
"sdk": {
"version": "6.0.200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"Global": {
"CodeChanges": [
{
<<<<<<< HEAD
"Block": "builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)",
"InsertBefore": ["WebApplication.CreateBuilder.Services.AddControllers"],
"CodeFormatting": {
Expand All @@ -67,6 +68,20 @@
"Parent": "AddMicrosoftIdentityWebApi",
"CodeChangeType": "MemberAccess",
"Options": [ "MicrosoftGraph", "DownstreamApi" ],
=======
"Block": "\nWebApplication.CreateBuilder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)\n .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection(\"AzureAd\"));",
"InsertBefore": [ "builder.Services.AddControllers()", "builder.Build()" ]
},
{
"Parent": "AddMicrosoftIdentityWebApi",
"Options": [ "MemberAccess", "MicrosoftGraph", "DownstreamApi" ],
"Block": "EnableTokenAcquisitionToCallDownstreamApi()"
},
{
"Parent": "EnableTokenAcquisitionToCallDownstreamApi",
"Options": [ "MemberAccess", "MicrosoftGraph" ],
"Block": "AddMicrosoftGraph(builder.Configuration.GetSection(\"MicrosoftGraph\"))",
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
"CodeFormatting": {
"Newline": true,
"NumberOfSpaces": 8
Expand Down Expand Up @@ -184,7 +199,11 @@
"Options": [ "MicrosoftGraph" ]
},
{
<<<<<<< HEAD
"Prepend": true,
=======
"Append": true,
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
"Block" : "using var response = await _downstreamWebApi.CallWebApiForUserAsync(\"DownstreamApi\").ConfigureAwait(false);",
"CodeFormatting": {
"NumberOfSpaces": 12
Expand All @@ -193,16 +212,27 @@
},
{
"InsertAfter": "await _downstreamWebApi.CallWebApiForUserAsync",
<<<<<<< HEAD
"Block": "\r\n if (response.StatusCode == System.Net.HttpStatusCode.OK)\r\n {\r\n var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false);\r\n // Do something\r\n }\r\n else\r\n {\r\n var error = await response.Content.ReadAsStringAsync().ConfigureAwait(false);\r\n throw new HttpRequestException($\"Invalid status code in the HttpResponseMessage: {response.StatusCode}: {error}\");\r\n }",
"CodeFormatting": {
"NumberOfSpaces": 12,
"Newline": true
=======
"Block": "\n\n if (response.StatusCode == System.Net.HttpStatusCode.OK)\n {\n var apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false);\n // Do something\n }\n else\n {\n var error = await response.Content.ReadAsStringAsync().ConfigureAwait(false);\n throw new HttpRequestException($\"Invalid status code in the HttpResponseMessage: {response.StatusCode}: {error}\");\n }",
"CodeFormatting": {
"NumberOfSpaces": 12
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
},
"Options": [ "DownstreamApi" ]
},
{
<<<<<<< HEAD
"Prepend": true,
"Block": "HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi)",
=======
"Append": true,
"Block": "HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);",
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
"Options": [ "NonMinimalApp" ]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
}
},
{
<<<<<<< HEAD
"CodeChangeType": "Lambda",
"Parent": "WebApplication.CreateBuilder.Services.AddAuthorization",
"Block": "options.FallbackPolicy = options.DefaultPolicy",
Expand All @@ -140,6 +141,14 @@
{
"Newline":true,
"NumberOfSpaces": 4
=======
"CheckBlock": "WebApplication.CreateBuilder.Services.AddAuthorization",
"Block": "WebApplication.CreateBuilder.Services.AddAuthorization(options =>\n{\n options.FallbackPolicy = options.DefaultPolicy;\n});\n\r",
"InsertAfter": "WebApplication.CreateBuilder.Services.AddAuthentication",
"InsertBefore": [ "WebApplication.CreateBuilder.Services.AddRazorPages()", "WebApplication.CreateBuilder.Build()" ],
"CodeFormatting": {
"Newline": true
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public class CodeChangeOptionStrings
public const string DownstreamApi = nameof(DownstreamApi);
public const string Skip = nameof(Skip);
public const string NonMinimalApp = nameof(NonMinimalApp);
<<<<<<< HEAD
public const string MinimalApp = nameof(MinimalApp);
public const string OpenApi = nameof(OpenApi);
=======
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
}

public class CodeChangeOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,19 @@ internal static SyntaxNode AddExpressionToParent(SyntaxNode originalMethod, Code
var children = GetDescendantNodes(parent);
if (ProjectModifierHelper.StatementExists(children, change.Block))
{
<<<<<<< HEAD
return originalMethod;
}
=======
var insertAfterNode =
modifiedBlockSyntaxNode.DescendantNodes().Where(node => node != null && node.ToString().Contains(insertAfterBlock)).FirstOrDefault() ??
modifiedBlockSyntaxNode.DescendantNodes().Where(node => node != null && node.ToString().Contains(ProjectModifierHelper.TrimStatement(insertAfterBlock))).FirstOrDefault();
if (insertAfterNode != null)
{
var leadingTrivia = insertAfterNode.GetLeadingTrivia();
var trailingTrivia = new SyntaxTriviaList(SemiColonTrivia, SyntaxFactory.CarriageReturnLineFeed);
string formattedCodeBlock = ProjectModifierHelper.FormatCodeBlock(change.Block, parameterValues);
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))

// Find parent's expression statement
if (!(children.FirstOrDefault(n => n.IsKind(SyntaxKind.ExpressionStatement)) is ExpressionStatementSyntax exprNode))
Expand Down Expand Up @@ -634,7 +645,23 @@ internal static SyntaxList<AttributeListSyntax> CreateAttributeList(CodeBlock[]
{
if (attributes == null)
{
<<<<<<< HEAD
return attributeLists;
=======
foreach (var attribute in attributes)
{
var attributeList = new List<AttributeSyntax>();
//filter by apps
if (!string.IsNullOrEmpty(attribute.Block) && !ProjectModifierHelper.AttributeExists(attribute.Block, attributeLists))
{
attributeList.Add(SyntaxFactory.Attribute(SyntaxFactory.ParseName(attribute.Block)));
}
if (attributeList.Any())
{
syntaxList = syntaxList.Insert(0, SyntaxFactory.AttributeList(SyntaxFactory.SeparatedList(attributeList)).WithLeadingTrivia(leadingTrivia));
}
}
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
}

foreach (var attribute in attributes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,17 @@ internal static bool GlobalStatementExists(CompilationUnitSyntax root, GlobalSta
{
var formattedStatementString = TrimStatement(statement.ToString());
bool foundStatement = root.Members.Where(st => TrimStatement(st.ToString()).Contains(formattedStatementString)).Any();
<<<<<<< HEAD

if (foundStatement)
{
return true;
=======
//if statement is not found due to our own mofications, check for a CheckBlock snippet
if (!string.IsNullOrEmpty(checkBlock) && !foundStatement)
{
foundStatement = root.Members.Where(st => TrimStatement(st.ToString()).Contains(TrimStatement(checkBlock.ToString()))).Any();
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
}
}

Expand Down Expand Up @@ -356,11 +363,14 @@ internal static bool FilterOptions(string[] options, CodeChangeOptions codeChang
{
return false;
}
<<<<<<< HEAD
// for example, program.cs is only modified when codeChangeOptions.IsMinimalApp is true
if (options.Contains(CodeChangeOptionStrings.MinimalApp) && !codeChangeOptions.IsMinimalApp)
{
return false;
}
=======
>>>>>>> c9c71cf5 (Cherry picking main into release/6.0 (#1688))
//if its a minimal app and options have a "NonMinimalApp", don't add the CodeBlock
if (options.Contains(CodeChangeOptionStrings.NonMinimalApp) && codeChangeOptions.IsMinimalApp)
{
Expand Down

0 comments on commit 08adb74

Please sign in to comment.