Skip to content

Commit 926ef51

Browse files
Add CI Yaml file for CSharp Parser (#8510)
* Add CI yaml file for csharp parser * Install csharp parser tool during deployment
1 parent e8dcfef commit 926ef51

7 files changed

Lines changed: 44 additions & 5 deletions

File tree

src/dotnet/APIView/apiview.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
parameters:
2+
- name: AzureSdkForNetDevOpsFeed
3+
type: string
4+
default: 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json'
5+
- name: CSharpAPIParserVersion
6+
type: string
7+
default: '1.0.0-dev.20240626.4'
8+
19
trigger:
210
branches:
311
include:
@@ -311,6 +319,10 @@ extends:
311319
echo Installing npm packages
312320
call npm install --prefix D:\home\site\wwwroot --force
313321
call npm run-script build --prefix D:\home\site\wwwroot --force
322+
echo Installing .NET tool
323+
call mkdir D:\home\site\wwwroot\csharp-parser
324+
call dotnet tool install --add-source ${{ parameters.AzureSdkForNetDevOpsFeed }} --version ${{ parameters.CSharpAPIParserVersion }} --tool-path D:\home\site\wwwroot\csharp-parser CSharpAPIParser
325+
echo Installing Python tools
314326
call D:\home\site\wwwroot\Python\python -m pip uninstall api-stub-generator
315327
call D:\home\site\wwwroot\Python\python -m pip install pylint==2.13.9 pylint-guidelines-checker==0.0.6 api-stub-generator==0.3.2 --index-url "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
316328
enableCustomDeployment: true

tools/apiview/parsers/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Previously APIview tokens were created as a flat list assigned to the `CodeFileT
6565

6666
## Serialization
6767

68-
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.
68+
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.
6969
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.
7070

7171
## Examples

tools/apiview/parsers/csharp-api-parser/CSharpAPIParser.csproj renamed to tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<ProjectReference Include="..\..\..\..\src\dotnet\APIView\APIView\APIView.csproj" />
19-
<ProjectReference Include="..\..\..\..\src\dotnet\Azure.ClientSdk.Analyzers\Azure.ClientSdk.Analyzers\Azure.ClientSdk.Analyzers.csproj" />
18+
<ProjectReference Include="..\..\..\..\..\src\dotnet\APIView\APIView\APIView.csproj" />
19+
<ProjectReference Include="..\..\..\..\..\src\dotnet\Azure.ClientSdk.Analyzers\Azure.ClientSdk.Analyzers\Azure.ClientSdk.Analyzers.csproj" />
2020
</ItemGroup>
2121

2222
</Project>

tools/apiview/parsers/csharp-api-parser/Program.cs renamed to tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs

File renamed without changes.

tools/apiview/parsers/csharp-api-parser/TreeToken/CodeFileBuilder.cs renamed to tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/TreeToken/CodeFileBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ private bool IsAccessible(ISymbol s)
747747
case Accessibility.Public:
748748
return true;
749749
case Accessibility.Internal:
750-
return s.GetAttributes().Any(a => a.AttributeClass.Name == "FriendAttribute");
750+
return s.GetAttributes().Any(a => a.AttributeClass?.Name == "FriendAttribute");
751751
default:
752752
return IsAccessibleExplicitInterfaceImplementation(s);
753753
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
2+
trigger:
3+
branches:
4+
include:
5+
- main
6+
- feature/*
7+
- release/*
8+
- hotfix/*
9+
paths:
10+
include:
11+
- tools/apiview/parsers/csharp-api-parser
12+
13+
pr:
14+
branches:
15+
include:
16+
- main
17+
- feature/*
18+
- release/*
19+
- hotfix/*
20+
paths:
21+
include:
22+
- tools/apiview/parsers/csharp-api-parser
23+
24+
extends:
25+
template: /eng/pipelines/templates/stages/archetype-sdk-tool-dotnet.yml
26+
parameters:
27+
PackageDirectory: $(Build.SourcesDirectory)/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser

tools/apiview/parsers/csharp-api-parser/csharp-api-parser.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIView", "..\..\..\..\src\
77
EndProject
88
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}"
99
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpAPIParser", "CSharpAPIParser.csproj", "{EB159E3D-9732-4EB3-A3C2-817475B9D749}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpAPIParser", "CSharpAPIParser\CSharpAPIParser.csproj", "{EB159E3D-9732-4EB3-A3C2-817475B9D749}"
1111
EndProject
1212
Global
1313
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)