Skip to content

Commit 522c59b

Browse files
authored
Merge pull request #6979 from cormacpayne/static-analysis-netcore
Convert StaticAnalysis to .NET Core
2 parents 125812d + f4848ec commit 522c59b

File tree

414 files changed

+2741
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

414 files changed

+2741
-120
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ before_install:
2525
# https://github.com/travis-ci/travis-ci/issues/1066#issuecomment-383489298
2626
script:
2727
- sudo dotnet msbuild build.proj /t:BuildNetcore /p:Configuration=$CONFIG || travis_terminate 1
28+
- sudo dotnet tools/StaticAnalysis/bin/$CONFIG/netcoreapp2.1/StaticAnalysis.Netcore.dll -p src/Package/$CONFIG -r src/Package -u
2829
- sudo pwsh -NonInteractive -NoLogo -NoProfile -File tools/TestModuleLoading.ps1 || travis_terminate 1
2930
- sudo dotnet test src/Azure.PowerShell.Netcore.Test.sln --filter "AcceptanceType=CheckIn&RunType!=DesktopOnly" --configuration $CONFIG
30-
31+
3132
after_success:
3233
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
3334
docker build . -t $DOCKER_USER/$NAME:$TRAVIS_COMMIT --build-arg CONFIG=$CONFIG;
@@ -38,7 +39,7 @@ after_success:
3839
docker push $DOCKER_USER/$NAME:$TRAVIS_COMMIT;
3940
docker push $DOCKER_USER/$NAME:$TRAVIS_BRANCH;
4041

41-
if [ "$TRAVIS_BRANCH" == "master" ]; then
42+
if [ "$TRAVIS_BRANCH" == "master" ]; then
4243
docker tag $DOCKER_USER/$NAME:$TRAVIS_COMMIT $DOCKER_USER/$NAME:latest;
4344
docker push $DOCKER_USER/$NAME:latest;
4445
fi;

Azure.PowerShell.Netcore.sln

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.DeviceProvisioning
119119
EndProject
120120
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.PolicyInsights.Netcore", "src\ResourceManager\PolicyInsights\Commands.PolicyInsights\Commands.PolicyInsights.Netcore.csproj", "{A0574194-976A-486A-B589-07B2E50CA6EF}"
121121
EndProject
122+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tools.Common.Netcore", "tools\Tools.Common\Tools.Common.Netcore.csproj", "{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}"
123+
EndProject
124+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticAnalysis.Netcore", "tools\StaticAnalysis\StaticAnalysis.Netcore.csproj", "{493FA948-DA9C-47CD-8385-3C0261377D86}"
125+
EndProject
122126
Global
123127
GlobalSection(SolutionConfigurationPlatforms) = preSolution
124128
Debug|Any CPU = Debug|Any CPU
@@ -825,6 +829,30 @@ Global
825829
{A0574194-976A-486A-B589-07B2E50CA6EF}.Release|x64.Build.0 = Release|Any CPU
826830
{A0574194-976A-486A-B589-07B2E50CA6EF}.Release|x86.ActiveCfg = Release|Any CPU
827831
{A0574194-976A-486A-B589-07B2E50CA6EF}.Release|x86.Build.0 = Release|Any CPU
832+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
833+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
834+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Debug|x64.ActiveCfg = Debug|Any CPU
835+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Debug|x64.Build.0 = Debug|Any CPU
836+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Debug|x86.ActiveCfg = Debug|Any CPU
837+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Debug|x86.Build.0 = Debug|Any CPU
838+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
839+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Release|Any CPU.Build.0 = Release|Any CPU
840+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Release|x64.ActiveCfg = Release|Any CPU
841+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Release|x64.Build.0 = Release|Any CPU
842+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Release|x86.ActiveCfg = Release|Any CPU
843+
{EE2A4BB9-2ECB-4CAE-AD82-C4882B6ECDE0}.Release|x86.Build.0 = Release|Any CPU
844+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
845+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Debug|Any CPU.Build.0 = Debug|Any CPU
846+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Debug|x64.ActiveCfg = Debug|Any CPU
847+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Debug|x64.Build.0 = Debug|Any CPU
848+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Debug|x86.ActiveCfg = Debug|Any CPU
849+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Debug|x86.Build.0 = Debug|Any CPU
850+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Release|Any CPU.ActiveCfg = Release|Any CPU
851+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Release|Any CPU.Build.0 = Release|Any CPU
852+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Release|x64.ActiveCfg = Release|Any CPU
853+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Release|x64.Build.0 = Release|Any CPU
854+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Release|x86.ActiveCfg = Release|Any CPU
855+
{493FA948-DA9C-47CD-8385-3C0261377D86}.Release|x86.Build.0 = Release|Any CPU
828856
EndGlobalSection
829857
GlobalSection(SolutionProperties) = preSolution
830858
HideSolutionNode = FALSE

build.proj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,13 @@
617617

618618
<Message Importance="high" Text="Running dependency analysis..." />
619619

620-
<Exec Command="$(MSBuildProjectDirectory)\src\Package\StaticAnalysis.exe $(MSBuildProjectDirectory)\src\Package\$(Configuration) $(MSBuildProjectDirectory)\src\Package true $(SkipHelp) @(ModulesChanged)"
620+
<PropertyGroup>
621+
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
622+
</PropertyGroup>
623+
<Exec Command="$(MSBuildProjectDirectory)\src\Package\StaticAnalysis.exe -p $(MSBuildProjectDirectory)\src\Package\$(Configuration) -r $(MSBuildProjectDirectory)\src\Package $(SkipHelpValue) -m @(ModulesChanged)"
621624
Condition="'$(Scope)' != 'Stack'"/>
622625

623-
<Exec Command="$(PackageDirectory)\StaticAnalysis.exe $(StackPackageFolder)\$(Configuration) $(StackPackageFolder)"
626+
<Exec Command="$(PackageDirectory)\StaticAnalysis.exe -p $(StackPackageFolder)\$(Configuration) -r $(StackPackageFolder)"
624627
Condition="'$(Scope)' == 'Stack'"
625628
ContinueOnError="True"/>
626629

src/Common/Commands.Common.Storage.Management/Common.Storage.Management.Netcore.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
</PropertyGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
2625
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
2726
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
2827
</ItemGroup>

src/Common/Commands.Common.Storage/Common.Storage.Netcore.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
</PropertyGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
3029
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
3130
</ItemGroup>
3231

src/ResourceManager/AzureBatch/Commands.Batch/Commands.Batch.Netcore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ItemGroup>
3131
<PackageReference Include="Azure.Batch" Version="8.1.1" />
3232
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="4.2.0" />
33-
<PackageReference Include="Microsoft.Extensions.Primitives" Version="2.1.1" />
33+
<PackageReference Include="Microsoft.Extensions.Primitives" Version="1.1.0" />
3434
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
3535
</ItemGroup>
3636

src/ResourceManager/Profile/Commands.Profile/Az.Profile.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ RequiredAssemblies = '.\Microsoft.Azure.PowerShell.Authentication.Abstractions.d
7676
'.\Microsoft.Rest.ClientRuntime.Azure.dll',
7777
'.\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll',
7878
'.\Microsoft.WindowsAzure.Storage.dll',
79-
'.\Microsoft.Azure.Management.Storage.dll', '.\Newtonsoft.Json.dll',
79+
'.\Newtonsoft.Json.dll',
8080
'.\Microsoft.Azure.PowerShell.Aks.dll',
8181
'.\Microsoft.Azure.PowerShell.Strategies.dll'
8282

src/ResourceManager/Sql/Commands.Sql/Commands.Sql.Netcore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<ItemGroup>
3131
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.18.0-preview" />
32+
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" />
3233
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
3334
</ItemGroup>
3435

src/ResourceManager/Storage/Commands.Management.Storage/Az.Storage.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ PowerShellVersion = '5.1'
5454
RequiredModules = @(@{ModuleName = 'Az.Profile'; ModuleVersion = '0.1.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = '.\Microsoft.Azure.Management.Storage.dll'
57+
RequiredAssemblies = '.\Microsoft.Azure.Management.Storage.dll',
58+
'.\Microsoft.WindowsAzure.Storage.dll'
5859

5960
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6061
# ScriptsToProcess = @()
@@ -67,8 +68,7 @@ FormatsToProcess = '.\Microsoft.Azure.Commands.Management.Storage.format.ps1xml'
6768
'.\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml', '.\Microsoft.WindowsAzure.Commands.Storage.generated.format.ps1xml'
6869

6970
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
70-
NestedModules = @('.\Microsoft.Azure.Commands.Management.Storage.dll',
71-
'.\Microsoft.WindowsAzure.Storage.dll', '.\Microsoft.WindowsAzure.Commands.Storage.dll')
71+
NestedModules = @('.\Microsoft.Azure.Commands.Management.Storage.dll', '.\Microsoft.WindowsAzure.Commands.Storage.dll')
7272

7373
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
7474
FunctionsToExport = @()

tools/StaticAnalysis/BreakingChangeAnalyzer/BreakingChangeAnalyzer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ public void Analyze(
158158
{
159159
issueLogger.Decorator.AddDecorator(a => a.AssemblyFileName = assemblyFileName, "AssemblyFileName");
160160
processedHelpFiles.Add(assemblyFileName);
161-
var proxy = EnvironmentHelpers.CreateProxy<CmdletLoader>(directory, out _appDomain);
161+
var proxy =
162+
#if !NETSTANDARD
163+
EnvironmentHelpers.CreateProxy<CmdletLoader>(directory, out _appDomain);
164+
#else
165+
new CmdletLoader();
166+
#endif
162167
var newModuleMetadata = proxy.GetModuleMetadata(assemblyFile, requiredModules);
163168

164169
string fileName = assemblyFileName + ".json";

0 commit comments

Comments
 (0)