Skip to content

Commit 5b01461

Browse files
authored
Remove ClientUriBuilder in generated Azure client (Azure#47259)
1 parent 3b3f942 commit 5b01461

File tree

9 files changed

+95
-118
lines changed

9 files changed

+95
-118
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
</ItemGroup>
255255

256256
<ItemGroup Condition="'$(IsGeneratorLibrary)' == 'true'">
257-
<PackageReference Update="Microsoft.Generator.CSharp.ClientModel" Version="1.0.0-alpha.20241113.8" />
257+
<PackageReference Update="Microsoft.Generator.CSharp.ClientModel" Version="1.0.0-alpha.20241121.2" />
258258
</ItemGroup>
259259

260260
<!--

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@
2424

2525
<!-- Include shared code from Azure.Core -->
2626
<ItemGroup>
27-
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\AzureKeyCredentialPolicy.cs" LinkBase="Shared/Core" />
27+
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\AzureKeyCredentialPolicy.cs" LinkBase="Shared/Core">
28+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
29+
</Compile>
30+
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\RawRequestUriBuilder.cs" LinkBase="Shared/Core">
31+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
32+
</Compile>
2833
</ItemGroup>
2934

3035
</Project>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
using Microsoft.Generator.CSharp;
66
using Microsoft.Generator.CSharp.ClientModel;
77
using System;
8-
using System.ClientModel;
9-
using System.Collections.Generic;
108
using System.ComponentModel.Composition;
9+
using System.IO;
1110

1211
namespace Azure.Generator;
1312

@@ -46,6 +45,8 @@ public override void Configure()
4645
{
4746
base.Configure();
4847
AddMetadataReference(MetadataReference.CreateFromFile(typeof(Response).Assembly.Location));
48+
var sharedSourceDirectory = Path.Combine(Path.GetDirectoryName(typeof(AzureClientPlugin).Assembly.Location)!, "Shared", "Core");
49+
AddSharedSourceDirectory(sharedSourceDirectory);
4950
}
5051

5152
/// <summary>

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

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

4-
using Azure.Core;
54
using Azure.Generator.Primitives;
65
using Azure.Generator.Providers;
76
using Azure.Generator.Providers.Abstraction;
@@ -18,9 +17,6 @@ public class AzureTypeFactory : ScmTypeFactory
1817
/// <inheritdoc/>
1918
public override CSharpType KeyCredentialType => typeof(AzureKeyCredential);
2019

21-
/// <inheritdoc/>
22-
public override CSharpType ClientUriBuilderBaseType => typeof(RequestUriBuilder);
23-
2420
/// <inheritdoc/>
2521
public override IClientResponseApi ClientResponseApi => AzureClientResponseProvider.Instance;
2622

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public HttpRequestProvider(ValueExpression original) : base(typeof(Request), ori
2121
{
2222
}
2323

24+
public override Type UriBuilderType => typeof(RawRequestUriBuilder);
25+
2426
public override ValueExpression Content()
2527
=> Original.Property(nameof(Request.Content));
2628

eng/packages/http-client-csharp/generator/TestProjects/Local/Basic-TypeSpec/src/BasicTypeSpec.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
<!-- Include shared code from Azure.Core -->
1919
<ItemGroup>
2020
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\AzureKeyCredentialPolicy.cs" LinkBase="Shared/Core" />
21+
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\RawRequestUriBuilder.cs" LinkBase="Shared/Core" />
2122
</ItemGroup>
2223
</Project>

eng/packages/http-client-csharp/generator/TestProjects/Local/Basic-TypeSpec/src/Generated/BasicTypeSpecClient.RestClient.cs

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

0 commit comments

Comments
 (0)