Skip to content

Commit a95865c

Browse files
authored
Update Roslyn analyzer task (#2281)
* chore: Use msBuildInfo * chore: Run dotnet build command line * chore: Run analysis after build & sign
1 parent fa020c4 commit a95865c

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

.azure-pipelines/common-templates/guardian-analyzer.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55
# https://marketplace.visualstudio.com/items?itemName=securedevelopmentteam.vss-secure-development-tools
66

77
steps:
8-
- task: RoslynAnalyzers@3
9-
inputs:
10-
userProvideBuildInfo: 'autoMsBuildInfo'
11-
setupCommandlinePicker: 'vs2022'
12-
policyName: 'M365'
13-
env:
14-
SYSTEM_ACCESSTOKEN: $(system.accesstoken)
8+
- task: RoslynAnalyzers@3
9+
displayName: 'Run Roslyn Analyzers'
10+
inputs:
11+
continueOnError: true
12+
msBuildVersion: 17.0
13+
msBuildArchitecture: amd64
14+
msBuildCommandline: |
15+
dotnet.exe build $(Build.SourcesDirectory)\src\Authentication /p:Platform="Any CPU" /p:Configuration="Release"
16+
setupCommandlinePicker: 'vs2022'
17+
policyName: 'M365'
18+
env:
19+
SYSTEM_ACCESSTOKEN: $(system.accesstoken)

.azure-pipelines/generation-templates/authentication-module.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ steps:
2121
script: |
2222
. $(System.DefaultWorkingDirectory)/tools/GenerateAuthenticationModule.ps1 -EnableSigning:$${{ parameters.Sign }} -Build
2323
24-
- template: ../common-templates/guardian-analyzer.yml
25-
2624
- ${{ if eq(parameters.Test, true) }}:
2725
- task: PowerShell@2
2826
displayName: Test Authentication Module
@@ -62,3 +60,6 @@ steps:
6260
pwsh: true
6361
script: |
6462
. $(System.DefaultWorkingDirectory)/tools/GenerateAuthenticationModule.ps1 -Pack -ArtifactsLocation $(Build.ArtifactStagingDirectory)
63+
64+
# Run analyzer after build & sign.
65+
- template: ../common-templates/guardian-analyzer.yml

src/Authentication/Authentication.Core/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
#if DEBUG
44
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test")]
5+
#else
6+
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
57
#endif

src/Authentication/Authentication/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
#if DEBUG
44
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test")]
5+
#else
6+
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
57
#endif

tools/GenerateAuthenticationModule.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ if ($null -eq $ModuleMetadata.versions.authentication.version) {
4444
# Build and pack generated module.
4545
if ($Build -or $Run) {
4646
$AuthCoreCSProj = Join-Path $AuthSrcPath "$ModuleName.Core" "$ModuleFullName.Core.csproj"
47+
$AuthTestCSProj = Join-Path $AuthSrcPath "$ModuleName.Test" "$ModuleFullName.Test.csproj"
4748
if ($EnableSigning) {
4849
Set-CSProjValues -ModuleCsProj $AuthCoreCSProj -AssemblyOriginatorKeyFile $ModuleMetadata.assemblyOriginatorKeyFile -ModuleVersion $ModuleMetadata.versions.authentication.version -PreRelease $ModuleMetadata.versions.authentication.prerelease
50+
Set-CSProjValues -ModuleCsProj $AuthTestCSProj -AssemblyOriginatorKeyFile $ModuleMetadata.assemblyOriginatorKeyFile -ModuleVersion $ModuleMetadata.versions.authentication.version -PreRelease $ModuleMetadata.versions.authentication.prerelease
4951
}
5052
else {
5153
Set-CSProjValues -ModuleCsProj $AuthCoreCSProj -ModuleVersion $ModuleMetadata.versions.authentication.version -PreRelease $ModuleMetadata.versions.authentication.prerelease
54+
Set-CSProjValues -ModuleCsProj $AuthTestCSProj -ModuleVersion $ModuleMetadata.versions.authentication.version -PreRelease $ModuleMetadata.versions.authentication.prerelease
5255
}
5356
& $BuildModulePS1 -ModuleFullName $ModuleFullName -ModuleSrc $AuthModulePath -EnableSigning:$EnableSigning -Version $ModuleMetadata.versions.authentication.version -Prerelease $ModuleMetadata.versions.authentication.prerelease -ModuleMetadata $ModuleMetadata.Clone()
5457
}

0 commit comments

Comments
 (0)