-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBUILD.bazel
More file actions
91 lines (78 loc) · 2.67 KB
/
BUILD.bazel
File metadata and controls
91 lines (78 loc) · 2.67 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@poetry_lock_file//:requirements.bzl", "all_requirements")
load("@rules_pycross//pycross:defs.bzl", "pycross_lock_file", "pycross_poetry_lock_model")
load("@rules_python_gazelle_plugin//manifest:defs.bzl", "gazelle_python_manifest")
load("@rules_python_gazelle_plugin//modules_mapping:def.bzl", "modules_mapping")
package(default_visibility = ["//visibility:public"])
# gazelle:python_root
# gazelle:python_label_convention deps:$distribution_name$
# gazelle:python_label_normalization pep503
# gazelle:cc_group unit
# gazelle:resolve cc gtest/gtest.h @googletest//:gtest_main
# --- Gazelle -----------------------------------------------------------------
gazelle_binary(
name = "gazelle_multilang",
languages = DEFAULT_LANGUAGES + [
"@rules_python_gazelle_plugin//python",
"@gazelle_cc//language/cc",
],
tags = ["manual"],
)
gazelle(
name = "gazelle",
gazelle = ":gazelle_multilang",
tags = ["manual"],
)
gazelle(
name = "gazelle.check",
args = ["-mode=diff"],
gazelle = ":gazelle_multilang",
tags = ["manual"],
)
# Generate Python modules mapping for Gazelle from the vendored Poetry lock repo.
# modules_mapping(
# name = "gazelle.metadata",
# tags = ["manual"],
# wheels = all_requirements,
# )
# If you want a manifest file for debugging, uncomment the target below.
# gazelle_python_manifest(
# name = "gazelle.mapping",
# modules_mapping = ":gazelle.metadata",
# pip_repository_name = "poetry_lock_file",
# tags = ["manual"],
# )
# --- Buildifier --------------------------------------------------------------
buildifier(
name = "buildifier.check",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
)
buildifier(
name = "buildifier.fix",
exclude_patterns = ["./.git/*"],
mode = "fix",
)
# --- rules_pycross: Poetry lock -> vendored lock file ------------------------
pycross_poetry_lock_model(
name = "poetry_lock_model",
lock_file = "//:poetry.lock",
project_file = "//:pyproject.toml",
tags = ["manual"],
)
pycross_lock_file(
name = "poetry_lock_file",
out = "updated_poetry_lock_file.bzl",
default_alias_single_version = True,
lock_model_file = ":poetry_lock_model",
tags = ["manual"],
target_environments = ["@rules_pycross_e2e_environments//:environments"],
)
write_source_files(
name = "update_poetry_lock_file",
files = {"poetry_lock_file.bzl": ":updated_poetry_lock_file.bzl"},
tags = ["manual"],
)