-
Notifications
You must be signed in to change notification settings - Fork 200
[MSBUILD SDK] Generate extensions.json on build #3284
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
base: feature/msbuild-sdk
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 implements automatic generation of extensions.json during build as part of the MSBuild SDK. The new functionality scans extension assemblies for WebJobs startup attributes and generates the appropriate metadata file without trimming unused extensions (unlike the current SDK).
Key changes:
- New
WriteExtensionMetadatatask that scans assemblies and generatesextensions.jsonwith incremental build support via hashing - New
WebJobsReferenceclass to represent extension references with assembly inspection logic - Integration of extension metadata generation into MSBuild targets to run during compilation
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Azure.Functions.Sdk/Tasks/Extensions/WriteExtensionMetadata.cs | New MSBuild task to generate extensions.json with hash-based incremental build support |
| src/Azure.Functions.Sdk/WebJobsReference.cs | New class representing a WebJobs extension reference |
| src/Azure.Functions.Sdk/WebJobsReference.FromModule.cs | Logic to extract WebJobs references from assemblies using Mono.Cecil |
| src/Azure.Functions.Sdk/FunctionsAssemblyScanner.cs | Enhanced scanner with methods to extract WebJobs references from assemblies |
| src/Azure.Functions.Sdk/FunctionsAssemblyResolver.cs | New custom assembly resolver that skips trusted platform assemblies |
| src/Azure.Functions.Sdk/MonoExtensions.cs | New extension methods for Mono.Cecil type inheritance checking |
| src/Azure.Functions.Sdk/TaskItemExtensions.cs | Added NuGetPackageVersion property and accessor method |
| src/Azure.Functions.Sdk/Tasks/GenerateWorkerConfig.cs | Renamed JSON serialization context class from JsonContext to WorkerConfigContext |
| src/Azure.Functions.Sdk/Targets/Extensions/Azure.Functions.Sdk.Extensions.targets | Added targets for generating and copying extensions.json, removed unused cache property |
| src/Azure.Functions.Sdk/Targets/Extensions/Azure.Functions.Sdk.Extensions.props | Added property definition for extensions.json filename |
| src/Azure.Functions.Sdk/Strings.resx | Added resource strings for extension metadata logging |
| test/Azure.Functions.Sdk.Tests/Tasks/Extensions/WriteExtensionMetadataTests.cs | New unit tests for WriteExtensionMetadata task |
| test/Azure.Functions.Sdk.Tests/NugetPackage.cs | Refactored to introduce WebJobsPackage record with ExtensionName property |
| test/Azure.Functions.Sdk.Tests/ExpectedFilesHelper.cs | Renamed from WorkerConfigHelper and added GetExtensionsJson method |
| test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Build.cs | Added validation for extensions.json in build tests including incremental build scenarios |
| test/Azure.Functions.Sdk.Tests/Tasks/GenerateWorkerConfigTests.cs | Updated to use renamed ExpectedFilesHelper |
| test/Azure.Functions.Sdk.Tests/Integration/SdkEndToEndTests.Targets.WorkerConfig.cs | Updated to use renamed ExpectedFilesHelper |
Comments suppressed due to low confidence (1)
src/Azure.Functions.Sdk/Targets/Extensions/Azure.Functions.Sdk.Extensions.targets:34
- The PublishFunctionsExtensionPayload target only depends on GetFunctionsExtensionFiles, but it should also depend on GenerateExtensionMetadata and AssignFunctionsTargetPaths to ensure extensions.json is included in publish output. Without this dependency, the extensions.json file may not be published correctly.
<Target Name="PublishFunctionsExtensionPayload" Condition="'$(DesignTimeBuild)' != 'true'"
DependsOnTargets="GetFunctionsExtensionFiles"
BeforeTargets="GetCopyToPublishDirectoryItems" />
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/Azure.Functions.Sdk.Tests/Tasks/Extensions/WriteExtensionMetadataTests.cs
Outdated
Show resolved
Hide resolved
9c9fcef to
8e27cdd
Compare
8e27cdd to
7cd8600
Compare
Issue describing the changes in this PR
resolves #3135
Pull request checklist
release_notes.mdAdditional information
Generates
extensions.jsonon build. This new SDK does not perform the same trimming of unused extensions that the current SDK does.