Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
</ItemGroup>

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

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<!-- Include shared code from Azure.Core -->
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\AzureKeyCredentialPolicy.cs" LinkBase="Shared/Core" />
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\RawRequestUriBuilder.cs" LinkBase="Shared/Core" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.ClientModel;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;

namespace Azure.Generator;

Expand Down Expand Up @@ -46,6 +47,19 @@ public override void Configure()
{
base.Configure();
AddMetadataReference(MetadataReference.CreateFromFile(typeof(Response).Assembly.Location));
AddSharedSourceDirectory(Path.Combine(GetRepositoryRootPath(), "sdk/core/Azure.Core/src/Shared"));
}

private string GetRepositoryRootPath()
{
// This assumes we're always running in place, in the repo
string? path = Environment.CurrentDirectory;
while (path is not null && !Directory.Exists(Path.Combine(path, ".git")))
{
// Walk up a level
path = Path.GetDirectoryName(path);
}
return path ?? throw new InvalidOperationException("Can't find the repository root directory.");
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;
using Azure.Generator.Primitives;
using Azure.Generator.Providers;
using Azure.Generator.Providers.Abstraction;
Expand All @@ -18,9 +17,6 @@ public class AzureTypeFactory : ScmTypeFactory
/// <inheritdoc/>
public override CSharpType KeyCredentialType => typeof(AzureKeyCredential);

/// <inheritdoc/>
public override CSharpType ClientUriBuilderBaseType => typeof(RequestUriBuilder);

/// <inheritdoc/>
public override IClientResponseApi ClientResponseApi => AzureClientResponseProvider.Instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public HttpRequestProvider(ValueExpression original) : base(typeof(Request), ori
{
}

public override Type UriBuilderType => typeof(RawRequestUriBuilder);

public override ValueExpression Content()
=> Original.Property(nameof(Request.Content));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<!-- Include shared code from Azure.Core -->
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\AzureKeyCredentialPolicy.cs" LinkBase="Shared/Core" />
<Compile Include="$(MSBuildThisFileDirectory)..\..\..\..\..\..\..\..\sdk\core\Azure.Core\src\Shared\RawRequestUriBuilder.cs" LinkBase="Shared/Core" />
</ItemGroup>
</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading