Skip to content

Add generateCode target #50167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged

Conversation

JoshLove-msft
Copy link
Member

Fixes #49545

@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 22:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new MSBuild GenerateCode target for TypeSpec-based client generation and adjusts the Event Grid Namespaces library to opt out of AutoRest and consume shared core sources manually.

  • Expose a GenerateCode target when IncludeAutorestDependency is disabled and a tsp-location.yaml file is present
  • Toggle AutoRest package inclusion via IncludeAutorestDependency and wire up shared Azure Core source files in the Namespaces project
  • Remove a codegen suppression attribute that may no longer be necessary

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces/src/properties/AssemblyInfo.cs Removed CodeGenSuppressType entry
sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces/src/Azure.Messaging.EventGrid.Namespaces.csproj Added IncludeAutorestDependency toggle and shared core includes
eng/Directory.Build.Common.targets Switched AutoRest package condition and added GenerateCode target
eng/Directory.Build.Common.props Defaulted IncludeAutorestDependency for client libraries
Comments suppressed due to low confidence (3)

sdk/eventgrid/Azure.Messaging.EventGrid.Namespaces/src/properties/AssemblyInfo.cs:10

  • Removing this CodeGenSuppressType attribute may re-enable generation for a type that was intentionally suppressed. Confirm whether this suppression is obsolete or if it needs to be relocated/updated in the code-gen configuration.
-[assembly: CodeGenSuppressType("MessagingEventGridNamespacesClientBuilderExtensions")]

eng/Directory.Build.Common.targets:454

  • [nitpick] The error message is a bit verbose and references internal property names. Consider simplifying to something like: "Temporary TypeSpec inputs missing; run dotnet build /t:GenerateCode /p:SaveInputs=true once without SkipSync."
<Error Text="You used skipped sync but didn't have the TempTypeSpecFiles in your project directory.  Please run 'dotnet build /t:GenerateCode /p:SaveInputs=true' without SkipSync first at least once" Condition="'$(SkipSync)' == 'true' AND !Exists('$(MSBuildProjectDirectory)/../TempTypeSpecFiles')" />

eng/Directory.Build.Common.targets:453

  • [nitpick] The new GenerateCode MSBuild target adds important code-gen behavior. Consider adding automated CI tests or integration steps to validate this target under various flags (SkipSync, SaveInputs, presence of TypeSpecInput).
<Target Name="GenerateCode" Condition="'$(IncludeAutorestDependency)' != 'true' AND '$(TypeSpecInput)' != ''">

@JoshLove-msft JoshLove-msft merged commit af7c6e1 into Azure:main May 21, 2025
49 checks passed
ArthurMa1978 added a commit that referenced this pull request May 21, 2025
ArthurMa1978 added a commit that referenced this pull request May 21, 2025
ajaykumarmehra pushed a commit to azure-sdk/azure-sdk-for-net that referenced this pull request May 23, 2025
ajaykumarmehra pushed a commit to azure-sdk/azure-sdk-for-net that referenced this pull request May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move GenerateCodeForTypeSpec target to azure-sdk-for-net repo
3 participants