override fun beforeAgentConfigurationLoaded()

in plugin-bazel-agent/src/main/kotlin/jetbrains/buildServer/bazel/BazelToolProvider.kt [29:42]


    override fun beforeAgentConfigurationLoaded(agent: BuildAgent) {
        LOG.info("Locating ${BazelConstants.BAZEL_CONFIG_NAME} tool")
        lastVersion = findVersions().sortedByDescending { it.second.buildMetadata().orElse("") }.firstOrNull()
        if (lastVersion != null) {
            val version = lastVersion!!
            LOG.info("Found ${BazelConstants.BAZEL_CONFIG_NAME} at ${version.first}")
            agent.configuration.apply {
                addConfigurationParameter(BazelConstants.BAZEL_CONFIG_PATH, version.first.canonicalPath)
                addConfigurationParameter(BazelConstants.BAZEL_CONFIG_NAME, version.second.toString())
            }
        } else {
            LOG.warn(NO_TOOL_ERROR_MESSAGE)
        }
    }