| workspace(name = "build_file_generation_example") | |
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | |
| ###################################################################### | |
| # We need rules_go and bazel_gazelle, to build the gazelle plugin from source. | |
| # Setup instructions for this section are at | |
| # https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel | |
| # Note, you could omit the rules_go dependency, if you have some way to statically | |
| # compile the gazelle binary for your workspace and distribute it to users on all | |
| # needed platforms. | |
| http_archive( | |
| name = "io_bazel_rules_go", | |
| sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b", | |
| urls = [ | |
| "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz", | |
| "https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz", | |
| ], | |
| ) | |
| # NB: bazel-gazelle version must be after 18 August 2021 | |
| # to include https://github.com/bazelbuild/bazel-gazelle/commit/2834ea4 | |
| http_archive( | |
| name = "bazel_gazelle", | |
| sha256 = "0bb8056ab9ed4cbcab5b74348d8530c0e0b939987b0cfe36c1ab53d35a99e4de", | |
| strip_prefix = "bazel-gazelle-2834ea44b3ec6371c924baaf28704730ec9d4559", | |
| urls = [ | |
| # No release since March, and we need subsequent fixes | |
| "https://github.com/bazelbuild/bazel-gazelle/archive/2834ea44b3ec6371c924baaf28704730ec9d4559.zip", | |
| ], | |
| ) | |
| load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | |
| load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") | |
| go_rules_dependencies() | |
| go_register_toolchains(version = "1.16.5") | |
| gazelle_dependencies() | |
| ###################################################################### | |
| # Remaining setup is for rules_python | |
| local_repository( | |
| name = "rules_python", | |
| path = "../..", | |
| ) | |
| load("@rules_python//python:pip.bzl", "pip_install") | |
| pip_install( | |
| # Uses the default repository name "pip" | |
| requirements = "//:requirements_lock.txt", | |
| ) | |
| # The rules_python gazelle extension has some third-party go dependencies | |
| # which we need to fetch in order to compile it. | |
| load("@rules_python//gazelle:deps.bzl", _py_gazelle_deps = "gazelle_deps") | |
| _py_gazelle_deps() |