-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
68 lines (61 loc) · 2.37 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
load("@gazelle//:def.bzl", "gazelle_binary")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@py_deps//:requirements.bzl", "all_whl_requirements")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@rules_python_gazelle_plugin//manifest:defs.bzl", "gazelle_python_manifest")
load("@rules_python_gazelle_plugin//modules_mapping:def.bzl", "modules_mapping")
compile_pip_requirements(
name = "requirements",
extra_args = ["--allow-unsafe"],
requirements_in = "requirements.txt",
requirements_txt = "requirements.lock.txt",
)
# A stamp file for pushing container images.
# Use the value of --embed_label under --stamp, otherwise use a deterministic constant
# value to ensure cache hits for actions that depend on this.
expand_template(
name = "stamped",
out = "_stamped.tags.txt",
stamp_substitutions = {"0.0.0": "{{BUILD_EMBED_LABEL}}"},
template = [
"0.0.0",
"latest",
],
visibility = ["//visibility:public"],
)
# To update pnpm-lock.yaml, run:
# bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only
npm_link_all_packages(name = "node_modules")
# This rule fetches the metadata for python packages we depend on. That data is
# required for the gazelle_python_manifest rule to update our manifest file.
modules_mapping(
name = "modules_map",
wheels = all_whl_requirements,
)
# Gazelle python extension needs a manifest file mapping from
# an import to the installed package that provides it.
# This macro produces two targets:
# - //:gazelle_python_manifest.update can be used with `bazel run`
# to recalculate the manifest
# - //:gazelle_python_manifest.test is a test target ensuring that
# the manifest doesn't need to be updated
gazelle_python_manifest(
name = "gazelle_python_manifest",
modules_mapping = ":modules_map",
# This is what we called our `pip_parse` rule, where third-party
# python libraries are loaded in BUILD files.
pip_repository_name = "py_deps",
)
# gazelle:prefix github.com/shaldengeki/monorepo
# gazelle:proto file
# gazelle:python_generation_mode file
# gazelle:resolve py python.runfiles @rules_python//python/runfiles
gazelle_binary(
name = "gazelle",
languages = [
"@rules_python_gazelle_plugin//python",
"@gazelle//language/go",
"@gazelle//language/proto",
],
)