| 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 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa", |
| urls = [ |
| "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", |
| "https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip", |
| ], |
| ) |
| |
| http_archive( |
| name = "bazel_gazelle", |
| sha256 = "efbbba6ac1a4fd342d5122cbdfdb82aeb2cf2862e35022c752eaddffada7c3f3", |
| urls = [ |
| "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.27.0/bazel-gazelle-v0.27.0.tar.gz", |
| "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.27.0/bazel-gazelle-v0.27.0.tar.gz", |
| ], |
| ) |
| |
| 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.18.3") |
| |
| gazelle_dependencies() |
| |
| ###################################################################### |
| # Remaining setup is for rules_python |
| |
| local_repository( |
| name = "rules_python", |
| path = "../..", |
| ) |
| |
| load("@rules_python//python:repositories.bzl", "python_register_toolchains") |
| |
| python_register_toolchains( |
| name = "python39", |
| python_version = "3.9", |
| ) |
| |
| load("@python39//:defs.bzl", "interpreter") |
| load("@rules_python//python:pip.bzl", "pip_parse") |
| |
| pip_parse( |
| name = "pip", |
| python_interpreter_target = interpreter, |
| requirements_lock = "//:requirements_lock.txt", |
| ) |
| |
| load("@pip//:requirements.bzl", "install_deps") |
| |
| install_deps() |
| |
| # 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() |