Skip to content

Commit 6965e20

Browse files
Expose Generator Visitors as a Plugin (Azure#51016)
* feat: move generator visitors to plugin * debug artifacts * package-lock * undo temp artifacts * remove unneeded test * move IsGeneratorLibrary property * cleanup * refactor folder structure * pr feedback --------- Co-authored-by: jolov <[email protected]>
1 parent 5578f71 commit 6965e20

29 files changed

+964
-34
lines changed

eng/http-client-csharp-emitter-package-lock.json

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eng/http-client-csharp-emitter-package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"main": "dist/src/index.js",
33
"dependencies": {
4-
"@typespec/http-client-csharp": "1.0.0-alpha.20250703.1"
4+
"@typespec/http-client-csharp": "1.0.0-alpha.20250703.1",
5+
"client-plugin": "file:../../../../eng/packages/plugins/client"
56
},
67
"devDependencies": {
78
"@azure-tools/typespec-azure-core": "0.57.0",

eng/packages/http-client-csharp/generator/Azure.Generator/src/Azure.Generator.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
<LinkBase>Shared/Core</LinkBase>
5656
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5757
</Compile>
58-
</ItemGroup>
58+
</ItemGroup>
59+
60+
<!-- Include shared Visitors code -->
61+
<ItemGroup>
62+
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\visitors\Visitors\src\Shared\**\*.cs">
63+
<LinkBase>Shared/Visitors</LinkBase>
64+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
65+
</Compile>
66+
</ItemGroup>
5967

6068
</Project>

eng/packages/http-client-csharp/generator/Azure.Generator/src/AzureClientGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.ComponentModel.Composition;
1010
using System.IO;
11+
using Visitors;
1112

1213
namespace Azure.Generator;
1314

eng/packages/http-client-csharp/generator/Azure.Generator/src/Providers/ClientBuilderExtensionsDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
using System.Linq;
99
using Azure.Core;
1010
using Azure.Core.Extensions;
11-
using Azure.Generator.Utilities;
1211
using Microsoft.TypeSpec.Generator.ClientModel.Providers;
1312
using Microsoft.TypeSpec.Generator.Expressions;
1413
using Microsoft.TypeSpec.Generator.Primitives;
1514
using Microsoft.TypeSpec.Generator.Providers;
1615
using Microsoft.TypeSpec.Generator.Statements;
16+
using Visitors.Utilities;
1717
using static Microsoft.TypeSpec.Generator.Snippets.Snippet;
1818

1919
namespace Azure.Generator.Providers

eng/packages/http-client-csharp/generator/Azure.Generator/src/Snippets/RequestSnippets.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using System.ClientModel.Primitives;

eng/packages/http-client-csharp/generator/Azure.Generator/src/Visitors/SpecialHeadersVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using System.Collections.Generic;

eng/packages/http-client-csharp/generator/Azure.Generator/test/AzureClientGeneratorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

44
using Azure.Generator.Tests.TestHelpers;
5-
using Azure.Generator.Visitors;
65
using NUnit.Framework;
6+
using Visitors;
77

88
namespace Azure.Generator.Tests
99
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.13.35931.197
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client.Plugin", "src\Client.Plugin.csproj", "{45254A64-6143-2A86-8AE9-04942065190A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{45254A64-6143-2A86-8AE9-04942065190A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{45254A64-6143-2A86-8AE9-04942065190A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{45254A64-6143-2A86-8AE9-04942065190A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{45254A64-6143-2A86-8AE9-04942065190A}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {7DE7608F-D322-4ECA-819B-63791050504C}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Version>1.0.0-beta.1</Version>
5+
<!--Ensure all dependencies are copied to the output directory so that they can be packaged up for npm.-->
6+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\visitors\Visitors\src\Shared\**\*.cs">
15+
<LinkBase>Shared/Visitors</LinkBase>
16+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
17+
</Compile>
18+
</ItemGroup>
19+
20+
<!-- Copy output to package dist path -->
21+
<Target Name="CopyForNpmPackage" AfterTargets="Build">
22+
<Message Text="Copying output to dist path" Importance="high" />
23+
<ItemGroup>
24+
<SourceDir Include="$(OutputPath)**\*.*" />
25+
</ItemGroup>
26+
<Copy SourceFiles="@(SourceDir)" DestinationFolder="$(MSBuildThisFileDirectory)..\..\dist\%(RecursiveDir)" />
27+
</Target>
28+
</Project>

0 commit comments

Comments
 (0)