text: # Copyright 2017 The Bazel Authors. All rights reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #    http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  """Rules to load all dependencies of rules_docker."""
  
  load(
      "@bazel_tools//tools/build_defs/repo:http.bzl",
      "http_archive",
      "http_file",
  )
  load(
      "@io_bazel_rules_docker//toolchains/docker:toolchain.bzl",
      _docker_toolchain_configure = "toolchain_configure",
  )
  
  # The release of the github.com/google/containerregistry to consume.
  CONTAINERREGISTRY_RELEASE = "v0.0.36"
  RULES_DOCKER_GO_BINARY_RELEASE = "66e5e1a894eda961a35c024db6ce91d31008c1e9"
  
  def repositories():
      """Download dependencies of container rules."""
      excludes = native.existing_rules().keys()
  
      # Go binaries.
      if "go_puller_linux" not in excludes:
          http_file(
              name = "go_puller_linux",
              executable = True,
              sha256 = "1af92327e21eff7630bc38e33bf82ec01c5db9a64b61ad8ebe0f90c774076d74",
              urls = [("https://storage.googleapis.com/rules_docker/" + RULES_DOCKER_GO_BINARY_RELEASE + "/puller-linux-amd64")],
          )
  
      if "go_puller_darwin" not in excludes:
          http_file(
              name = "go_puller_darwin",
              executable = True,
              sha256 = "34aa3e299c806ce59a012bd1b3a245e25807988e5475189d2edc075163b47dad",
              urls = [("https://storage.googleapis.com/rules_docker/" + RULES_DOCKER_GO_BINARY_RELEASE + "/puller-darwin-amd64")],
          )
  
      if "loader_linux" not in excludes:
          http_file(
              name = "loader_linux",
              executable = True,
              sha256 = "8566ab69573d4196f57e2d7303e341e813920d966b445ac6c86f091a2c91c368",
              urls = [("https://storage.googleapis.com/rules_docker/" + RULES_DOCKER_GO_BINARY_RELEASE + "/loader-linux-amd64")],
          )
  
      if "loader_darwin" not in excludes:
          http_file(
              name = "loader_darwin",
              executable = True,
              sha256 = "bc27e7b202fb2e1b8cb960f4752713a53f239069320c77b1f428bb7a658c6a7b",
              urls = [("https://storage.googleapis.com/rules_docker/" + RULES_DOCKER_GO_BINARY_RELEASE + "/loader-darwin-amd64")],
          )
  
      if "containerregistry" not in excludes:
          http_archive(
              name = "containerregistry",
              sha256 = "a8cdf2452323e0fefa4edb01c08b2ec438c9fa3192bc9f408b89287598c12abc",
              strip_prefix = "containerregistry-" + CONTAINERREGISTRY_RELEASE[1:],
              urls = [("https://github.com/google/containerregistry/archive/" +
                       CONTAINERREGISTRY_RELEASE + ".tar.gz")],
          )
  
      # TODO(mattmoor): Remove all of this (copied from google/containerregistry)
      # once transitive workspace instantiation lands.
  
      if "io_bazel_rules_go" not in excludes:
          http_archive(
              name = "io_bazel_rules_go",
              sha256 = "f99a9d76e972e0c8f935b2fe6d0d9d778f67c760c6d2400e23fc2e469016e2bd",
              urls = [
                  "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.21.2/rules_go-v0.21.2.tar.gz",
                  "https://github.com/bazelbuild/rules_go/releases/download/v0.21.2/rules_go-v0.21.2.tar.gz",
              ],
          )
      if "rules_python" not in excludes:
          http_archive(
              name = "rules_python",
              sha256 = "c911dc70f62f507f3a361cbc21d6e0d502b91254382255309bc60b7a0f48de28",
              strip_prefix = "rules_python-38f86fb55b698c51e8510c807489c9f4e047480e",
              urls = ["https://github.com/bazelbuild/rules_python/archive/38f86fb55b698c51e8510c807489c9f4e047480e.tar.gz"],
          )
  
      # For packaging python tools.
      if "subpar" not in excludes:
          http_archive(
              name = "subpar",
              sha256 = "481233d60c547e0902d381cd4fb85b63168130379600f330821475ad234d9336",
              # Commit from 2019-03-07.
              strip_prefix = "subpar-9fae6b63cfeace2e0fb93c9c1ebdc28d3991b16f",
              urls = ["https://github.com/google/subpar/archive/9fae6b63cfeace2e0fb93c9c1ebdc28d3991b16f.tar.gz"],
          )
  
      if "structure_test_linux" not in excludes:
          http_file(
              name = "structure_test_linux",
              executable = True,
              sha256 = "cfdfedd77c04becff0ea16a4b8ebc3b57bf404c56e5408b30d4fbb35853db67c",
              urls = ["https://storage.googleapis.com/container-structure-test/v1.8.0/container-structure-test-linux-amd64"],
          )
  
      if "structure_test_darwin" not in excludes:
          http_file(
              name = "structure_test_darwin",
              executable = True,
              sha256 = "14e94f75112a8e1b08a2d10f2467d27db0b94232a276ddd1e1512593a7b7cf5a",
              urls = ["https://storage.googleapis.com/container-structure-test/v1.8.0/container-structure-test-darwin-amd64"],
          )
  
      if "container_diff" not in excludes:
          http_file(
              name = "container_diff",
              executable = True,
              sha256 = "65b10a92ca1eb575037c012c6ab24ae6fe4a913ed86b38048781b17d7cf8021b",
              urls = ["https://storage.googleapis.com/container-diff/v0.15.0/container-diff-linux-amd64"],
          )
  
      # For bzl_library.
      if "bazel_skylib" not in excludes:
          http_archive(
              name = "bazel_skylib",
              sha256 = "e5d90f0ec952883d56747b7604e2a15ee36e288bb556c3d0ed33e818a4d971f2",
              strip_prefix = "bazel-skylib-1.0.2",
              urls = ["https://github.com/bazelbuild/bazel-skylib/archive/1.0.2.tar.gz"],
          )
  
      if "bazel_gazelle" not in excludes:
          http_archive(
              name = "bazel_gazelle",
              sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10",
              urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz"],
          )
  
      native.register_toolchains(
          # Register the default docker toolchain that expects the 'docker'
          # executable to be in the PATH
          "@io_bazel_rules_docker//toolchains/docker:default_linux_toolchain",
          "@io_bazel_rules_docker//toolchains/docker:default_windows_toolchain",
          "@io_bazel_rules_docker//toolchains/docker:default_osx_toolchain",
      )
  
      if "docker_config" not in excludes:
          # Automatically configure the docker toolchain rule to use the default
          # docker binary from the system path
          _docker_toolchain_configure(name = "docker_config")
  