fun from()

in agent/src/main/kotlin/com/jetbrains/teamcity/plugins/unrealengine/agent/buildgraph/DistributedBuildSettingsCreator.kt [36:69]


    fun from(runnerParameters: Map<String, String>): DistributedBuildSettings {
        val runnerInternalSettings =
            runCatching {
                BuildGraphRunnerInternalSettings.fromRunnerParameters(runnerParameters)
            }.getOrElse {
                logger.error("Runner internal settings are corrupted", it)
                raise(SettingsCreationError("Unable to retrieve runner internal settings. See the agent logs for details"))
            }

        val sharedDirAgentParameter = "unreal-engine.build-graph.agent.shared-dir"
        val sharedStorageDir = agentConfiguration.configurationParameters[sharedDirAgentParameter]
        ensureNotNull(sharedStorageDir) {
            val message =
                "BuildGraph shared storage directory parameter ($sharedDirAgentParameter) is not specified on the agent"
            logger.error(message)
            SettingsCreationError(message)
        }

        return when (runnerInternalSettings) {
            is BuildGraphRunnerInternalSettings.SetupBuildSettings -> {
                DistributedBuildSettings.SetupBuildSettings(
                    runnerInternalSettings.exportedGraphPath,
                    sharedStorageDir,
                    runnerInternalSettings.compositeBuildId,
                )
            }
            is BuildGraphRunnerInternalSettings.RegularBuildSettings -> {
                DistributedBuildSettings.RegularBuildSettings(
                    sharedStorageDir,
                    runnerInternalSettings.compositeBuildId,
                )
            }
        }
    }