Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 4 additions & 9 deletions sdk/Sdk.Generators/FunctionsUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,12 @@ internal static string GetFullyQualifiedMethodName(IMethodSymbol method)
/// </summary>
internal static string GetNamespaceForGeneratedCode(GeneratorExecutionContext context)
{
// If csproj has the msbuild property specified, use it's value.
if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue(Constants.BuildProperties.GeneratedCodeNamespace, out var namespaceValue)
&& !string.IsNullOrWhiteSpace(namespaceValue))
{
return namespaceValue;
}
// If user has not provided a custom namespace explicitly,
// our msbuild target will set the RootNamespace msbuild property value as the value of this property.
context.AnalyzerConfigOptions.GlobalOptions.TryGetValue(Constants.BuildProperties.GeneratedCodeNamespace, out var namespaceValue);

// Get the "RootNamespace" msbuild property value.(This gets populated in Microsoft.NET.Sdk.props and can be overridden by user in their function app)
context.AnalyzerConfigOptions.GlobalOptions.TryGetValue(Constants.BuildProperties.MSBuildRootNamespace, out var rootNamespaceValue);
return namespaceValue!;

return rootNamespaceValue!;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<FunctionsEnableExecutorSourceGen Condition="$(FunctionsEnableExecutorSourceGen) == ''">false</FunctionsEnableExecutorSourceGen>
<FunctionsAutoRegisterGeneratedFunctionsExecutor Condition="$(FunctionsAutoRegisterGeneratedFunctionsExecutor) == ''">true</FunctionsAutoRegisterGeneratedFunctionsExecutor>
<FunctionsAutoRegisterGeneratedFunctionsExecutor Condition="$(FunctionsAutoRegisterGeneratedFunctionsExecutor)">true</FunctionsAutoRegisterGeneratedFunctionsExecutor>
<FunctionsGeneratedCodeNamespace Condition="$(FunctionsGeneratedCodeNamespace) == ''">$(RootNamespace.Replace("-", "_"))</FunctionsGeneratedCodeNamespace>
</PropertyGroup>

<UsingTask TaskName="GenerateFunctionMetadata"
Expand Down
9 changes: 7 additions & 2 deletions sdk/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
- My change description (#PR/#issue)
-->

### Microsoft.Azure.Functions.Worker.Sdk 1.16.3 (meta package)
### Microsoft.Azure.Functions.Worker.Sdk 1.16.4 (meta package)


- Update Microsoft.Azure.Functions.Worker.Sdk.Generators dependency to 1.1.5

### Microsoft.Azure.Functions.Worker.Sdk.Generators 1.1.5
- Update worker.config generation to accurate worker executable name (#1053)
- Bug fix for scenarios with `$return` output binding and `HttpTrigger` breaking output-binding rules (#2098)
- Generate valid namespace when root namespace contains `-` (#2097)
- Bug fix for scenarios with `$return` output binding and `HttpTrigger` breaking output-binding rules (#2098)
5 changes: 3 additions & 2 deletions test/Sdk.Generator.Tests/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public static Task RunTestAsync<TSourceGenerator>(
string? expectedFileName,
string? expectedOutputSource,
List<DiagnosticResult>? expectedDiagnosticResults = null,
IDictionary<string, string>? buildPropertiesDictionary = null) where TSourceGenerator : ISourceGenerator, new()
IDictionary<string, string>? buildPropertiesDictionary = null,
string? generatedCodeNamespace = null) where TSourceGenerator : ISourceGenerator, new()
{
CSharpSourceGeneratorVerifier<TSourceGenerator>.Test test = new()
{
Expand All @@ -49,7 +50,7 @@ public static Task RunTestAsync<TSourceGenerator>(
var config = $@"is_global = true
build_property.FunctionsEnableExecutorSourceGen = {true}
build_property.FunctionsEnableMetadataSourceGen = {true}
build_property.RootNamespace = TestProject";
build_property.FunctionsGeneratedCodeNamespace = {generatedCodeNamespace ?? "TestProject"}";

// Add test specific MSBuild properties.
if (buildPropertiesDictionary is not null)
Expand Down