# Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. """Bazel rule definition for publishing maven artifacts.""" def _publishing_repo_impl(repository_ctx): """Implementation of the publishing_repo rule.""" classifier_filter = repository_ctx.os.environ.get("WPI_PUBLISH_CLASSIFIER_FILTER", "") content = """# Generated by publishing_repo rule. DO NOT EDIT. CLASSIFIER_FILTER = "{classifier_filter}" """.format( classifier_filter = classifier_filter, ) repository_ctx.file("publishing_config.bzl", content) repository_ctx.file("BUILD.bazel", content = "# Generated file") publishing_repo = repository_rule( implementation = _publishing_repo_impl, environ = ["WPI_PUBLISH_CLASSIFIER_FILTER"], doc = "Repository rule to determine host OS and classifier filter for publishing. " + "This rule must be instantiated in the WORKSPACE file with the name " + "'com_wpilib_allwpilib_publishing_config'.", )