override suspend fun modifyAppHost()

in rider/src/main/kotlin/com/jetbrains/aspire/rider/orchestration/AzureFunctionOrchestrationHandler.kt [24:56]


    override suspend fun modifyAppHost(
        appHostEntity: ProjectModelEntity,
        projectEntities: List<ProjectModelEntity>,
        project: Project
    ): List<String> {
        installAzureFunctionsHostingPackage(appHostEntity, project)

        val appHostProjectPath = appHostEntity.url?.toPath()
        if (appHostProjectPath == null) {
            LOG.warn("Unable to find AppHost project path. Skipping Azure Functions nuget installation")
            return emptyList()
        }
        val projectPaths = projectEntities.mapNotNull { it.url?.toPath() }

        return buildList {
            for (projectPath in projectPaths.sorted()) {
                val projectName = projectPath.nameWithoutExtension
                val projectType = projectName.replace('.', '_')
                val projectResourceName = projectName.replace('.', '-').lowercase()

                val lines = buildString {
                    append("builder.AddAzureFunctionsProject<Projects.")
                    append(projectType)
                    append(">(\"")
                    append(projectResourceName)
                    append("\")")
                    appendLine()
                    append("    .WithExternalHttpEndpoints();")
                }
                add(lines)
            }
        }
    }