public void Execute()

in sdk/Sdk.Generators/FunctionMetadataProviderGenerator/FunctionMetadataProviderGenerator.cs [26:71]


        public void Execute(GeneratorExecutionContext context)
        {
            if (!context.IsRunningInAzureFunctionProject())
            {
                return;
            }

            if (!ShouldExecuteGeneration(context))
            {
                return;
            }

            if (context.SyntaxReceiver is not FunctionMethodSyntaxReceiver receiver)
            {
                return;
            }

            var entryAssemblyFunctionSymbols = GetEntryAssemblyFunctions(receiver.CandidateMethods, context).ToList();
            var dependentAssemblyFunctionSymbols = GetDependentAssemblyFunctions(context);

            if (entryAssemblyFunctionSymbols.Count == 0 && dependentAssemblyFunctionSymbols.Count == 0)
            {
                return;
            }

            var parser = new Parser(context);
            var entryAssemblyParsingContext = new FunctionsMetadataParsingContext
            {
                ScriptFileExtension = GetScriptFileExtensionForEntryPointAssemblyFunctions(context)
            };

            var entryAssemblyFunctions = parser.GetFunctionMetadataInfo(entryAssemblyFunctionSymbols, entryAssemblyParsingContext);
            var dependentAssemblyFunctions = parser.GetFunctionMetadataInfo(dependentAssemblyFunctionSymbols);

            IReadOnlyList<GeneratorFunctionMetadata> functionMetadataInfo = entryAssemblyFunctions.Concat(dependentAssemblyFunctions).ToList();

            // Proceed to generate the file if function metadata info was successfully returned
            if (functionMetadataInfo.Count > 0)
            {
                var shouldIncludeAutoGeneratedAttributes = ShouldIncludeAutoGeneratedAttributes(context);

                string result = Emitter.Emit(context, functionMetadataInfo, shouldIncludeAutoGeneratedAttributes);

                context.AddSource(Constants.FileNames.GeneratedFunctionMetadata, SourceText.From(result, Encoding.UTF8));
            }
        }