From 663e4603288ef24b822372b01c87017f8f60f6ce Mon Sep 17 00:00:00 2001 From: Daniel Gorin Date: Wed, 2 Jan 2019 12:07:52 +0000 Subject: [PATCH] Prevent duplicate installs of bazel_skylib If we try to use `haskell_repositories()` after `bazel_skylib` was already installed with the same name (e.g. rules_docker also installs it as a dependency), we will get a name clash. We can use instead an if-statement to install only those that have not yet been installed. --- haskell/repositories.bzl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/haskell/repositories.bzl b/haskell/repositories.bzl index d36d9a323..ca4325231 100644 --- a/haskell/repositories.bzl +++ b/haskell/repositories.bzl @@ -6,9 +6,12 @@ def haskell_repositories(): """Provide all repositories that are necessary for `rules_haskell` to function. """ - http_archive( - name = "bazel_skylib", - sha256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867", - strip_prefix = "bazel-skylib-0.6.0", - urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz"], - ) + excludes = native.existing_rules().keys() + + if "bazel_skylib" not in excludes: + http_archive( + name = "bazel_skylib", + sha256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867", + strip_prefix = "bazel-skylib-0.6.0", + urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz"], + )