From 3aeaae635ce13842bf42c6758965b8e3e8e687f1 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Wed, 26 Jun 2024 16:37:34 -0700 Subject: [PATCH] Add CI yaml file for csharp parser --- tools/apiview/parsers/CONTRIBUTING.md | 2 +- .../CSharpAPIParser.csproj | 4 +-- .../{ => CSharpAPIParser}/Program.cs | 0 .../TreeToken/CodeFileBuilder.cs | 2 +- .../apiview/parsers/csharp-api-parser/ci.yml | 27 +++++++++++++++++++ .../csharp-api-parser/csharp-api-parser.sln | 2 +- 6 files changed, 32 insertions(+), 5 deletions(-) rename tools/apiview/parsers/csharp-api-parser/{ => CSharpAPIParser}/CSharpAPIParser.csproj (69%) rename tools/apiview/parsers/csharp-api-parser/{ => CSharpAPIParser}/Program.cs (100%) rename tools/apiview/parsers/csharp-api-parser/{ => CSharpAPIParser}/TreeToken/CodeFileBuilder.cs (99%) create mode 100644 tools/apiview/parsers/csharp-api-parser/ci.yml diff --git a/tools/apiview/parsers/CONTRIBUTING.md b/tools/apiview/parsers/CONTRIBUTING.md index b5b3c31b52f..1441cbd6a15 100644 --- a/tools/apiview/parsers/CONTRIBUTING.md +++ b/tools/apiview/parsers/CONTRIBUTING.md @@ -65,7 +65,7 @@ Previously APIview tokens were created as a flat list assigned to the `CodeFileT ## Serialization -Serialize the generated code file to JSON and then compress the file using Gzip compression. Try to make the json as small as possible by ignoring null values and empty collections. +Serialize the generated code file to JSON with Gzip compression. The output file should have `.json.tgz` extension. Try to make the json as small as possible by ignoring null values and empty collections. Don't worry about indentation that will be handled by the tree structure. In the case you want to have indentation between the tokens then use `TabSpace` token kind. ## Examples diff --git a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser.csproj b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj similarity index 69% rename from tools/apiview/parsers/csharp-api-parser/CSharpAPIParser.csproj rename to tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj index 914dbe16205..46e67f8e934 100644 --- a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser.csproj +++ b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj @@ -15,8 +15,8 @@ - - + + diff --git a/tools/apiview/parsers/csharp-api-parser/Program.cs b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs similarity index 100% rename from tools/apiview/parsers/csharp-api-parser/Program.cs rename to tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs diff --git a/tools/apiview/parsers/csharp-api-parser/TreeToken/CodeFileBuilder.cs b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/TreeToken/CodeFileBuilder.cs similarity index 99% rename from tools/apiview/parsers/csharp-api-parser/TreeToken/CodeFileBuilder.cs rename to tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/TreeToken/CodeFileBuilder.cs index 0660e7aad4c..d6d158680f5 100644 --- a/tools/apiview/parsers/csharp-api-parser/TreeToken/CodeFileBuilder.cs +++ b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/TreeToken/CodeFileBuilder.cs @@ -747,7 +747,7 @@ private bool IsAccessible(ISymbol s) case Accessibility.Public: return true; case Accessibility.Internal: - return s.GetAttributes().Any(a => a.AttributeClass.Name == "FriendAttribute"); + return s.GetAttributes().Any(a => a.AttributeClass?.Name == "FriendAttribute"); default: return IsAccessibleExplicitInterfaceImplementation(s); } diff --git a/tools/apiview/parsers/csharp-api-parser/ci.yml b/tools/apiview/parsers/csharp-api-parser/ci.yml new file mode 100644 index 00000000000..14244b5077f --- /dev/null +++ b/tools/apiview/parsers/csharp-api-parser/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + paths: + include: + - tools/apiview/parsers/csharp-api-parser + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + paths: + include: + - tools/apiview/parsers/csharp-api-parser + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml + parameters: + PackageDirectory: $(Build.SourcesDirectory)/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser diff --git a/tools/apiview/parsers/csharp-api-parser/csharp-api-parser.sln b/tools/apiview/parsers/csharp-api-parser/csharp-api-parser.sln index ad79aafb026..38937cc7dac 100644 --- a/tools/apiview/parsers/csharp-api-parser/csharp-api-parser.sln +++ b/tools/apiview/parsers/csharp-api-parser/csharp-api-parser.sln @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIView", "..\..\..\..\src\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ClientSdk.Analyzers", "..\..\..\..\src\dotnet\Azure.ClientSdk.Analyzers\Azure.ClientSdk.Analyzers\Azure.ClientSdk.Analyzers.csproj", "{4ECD9A58-ABEB-4285-A5D7-7CDA8A558AE0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpAPIParser", "CSharpAPIParser.csproj", "{EB159E3D-9732-4EB3-A3C2-817475B9D749}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpAPIParser", "CSharpAPIParser\CSharpAPIParser.csproj", "{EB159E3D-9732-4EB3-A3C2-817475B9D749}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution