suspend fun generateManifest()

in rider/src/main/kotlin/com/jetbrains/aspire/rider/manifest/ManifestService.kt [47:93]


    suspend fun generateManifest(hostProjectPath: Path) {
        LOG.info("Generating Aspire manifest")

        withBackgroundProgress(project, AspireCoreBundle.message("progress.generating.aspire.manifest")) {
            val runtime = RiderDotNetActiveRuntimeHost.getInstance(project).dotNetCoreRuntime.value
            if (runtime == null) {
                LOG.warn("Unable to find .NET runtime")
                return@withBackgroundProgress
            }

            val commandLine = runtime.createCommandLine(
                listOf(
                    "run",
                    "--publisher",
                    "manifest",
                    "--output-path",
                    MANIFEST_FILE_NAME
                )
            )
            val directoryPath = hostProjectPath.parent
            commandLine.workDirectory = directoryPath.toFile()
            LOG.debug { commandLine.commandLineString }

            val output = ExecUtil.execAndGetOutput(commandLine)
            if (output.checkSuccess(LOG)) {
                LOG.info("Aspire manifest is generated")

                val manifestPath = directoryPath.resolve(MANIFEST_FILE_NAME)
                val file = LocalFileSystem.getInstance().refreshAndFindFileByPath(manifestPath.absolutePathString())
                if (file != null && file.isValid) {
                    withContext(Dispatchers.EDT) {
                        PsiNavigationSupport.getInstance().createNavigatable(project, file, -1).navigate(true)
                    }
                }
            } else {
                withContext(Dispatchers.EDT) {
                    Notification(
                        "Aspire",
                        AspireCoreBundle.message("notification.manifest.unable.to.generate"),
                        output.stderr,
                        NotificationType.WARNING
                    )
                        .notify(project)
                }
            }
        }
    }