-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBUILD.bazel
More file actions
135 lines (129 loc) · 5.15 KB
/
Copy pathBUILD.bazel
File metadata and controls
135 lines (129 loc) · 5.15 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
load("@gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@rules_gala//gala:defs.bzl", "gala_imports_helper")
exports_files(
["go.mod"],
visibility = ["//visibility:public"],
)
# A single composite gazelle binary (one `@gala_gazelle//gala` language that
# embeds Gazelle's Go language), so `bazel run //:gazelle` generates and
# maintains go_*, gala_*, and mixed GALA+Go BUILD files across the repo. The
# import helper is driven from the registered GALA toolchain (reproducible).
#
# We wire this by hand rather than via @gala_gazelle's gala_gazelle() macro: the
# macro requires `load("@gala_gazelle//...")`, but @gala_gazelle is a
# dev_dependency, and this root BUILD is loaded by *consumers* of the gala module
# (their toolchain references //:all_gala_sources). A load of a dev-only repo
# would fail there. Referencing @gala_gazelle as a string label in
# gazelle_binary (resolved only when the gazelle binary is built) avoids that.
# gazelle:prefix martianoff/gala
# gazelle:gala_prefix martianoff/gala
# bazel_test_fixtures/ holds bespoke, hand-wired cross-module regression
# fixtures (custom gala_transpile + go_test wiring); gazelle must not manage them.
# gazelle:exclude bazel_test_fixtures
# examples/ is a hand-curated tree of gala_exec_test targets (singular src=,
# expected=, deliberate importpaths) that gazelle cannot model.
# gazelle:exclude examples
# IntelliJ parser golden files (.gala/.txt pairs), not a compilable program.
# gazelle:exclude ide/intellij/src/test/testData
# First-party GALA stdlib packages are bootstrap-built: each .gala is
# transpiled per-file via gala_bootstrap_transpile and bundled (with any
# hand-written .go) into a single go_library. That hand-wired shape is not the
# standard gala_library pattern the extension generates, and the .gen.go srcs
# don't exist at gazelle time — so neither the GALA nor the Go language can
# manage them without breaking the build. Keep them hand-maintained.
# gazelle:exclude collection_immutable
# gazelle:exclude collection_mutable
# gazelle:exclude concurrent
# gazelle:exclude crypto
# gazelle:exclude fs
# gazelle:exclude io
# gazelle:exclude json
# gazelle:exclude lazy
# gazelle:exclude path
# gazelle:exclude regex
# gazelle:exclude std
# gazelle:exclude stream
# gazelle:exclude strings
# gazelle:exclude subprocess
# gazelle:exclude test
# gazelle:exclude time_utils
# gazelle:exclude validation
# gazelle:exclude yaml
# gazelle:exclude tools/toolchain
# The internal Go tooling imports the excluded stdlib go_libraries; since those
# packages aren't gazelle-indexed, map each import path to its label so deps
# still resolve.
# gazelle:resolve go martianoff/gala/collection_immutable //collection_immutable
# gazelle:resolve go martianoff/gala/collection_mutable //collection_mutable
# gazelle:resolve go martianoff/gala/concurrent //concurrent
# gazelle:resolve go martianoff/gala/validation //validation
# gazelle:resolve go martianoff/gala/crypto //crypto
# gazelle:resolve go martianoff/gala/fs //fs
# gazelle:resolve go martianoff/gala/io //io
# gazelle:resolve go martianoff/gala/json //json
# gazelle:resolve go martianoff/gala/lazy //lazy
# gazelle:resolve go martianoff/gala/path //path
# gazelle:resolve go martianoff/gala/regex //regex
# gazelle:resolve go martianoff/gala/std //std
# gazelle:resolve go martianoff/gala/stream //stream
# gazelle:resolve go martianoff/gala/strings //strings
# gazelle:resolve go martianoff/gala/subprocess //subprocess
# gazelle:resolve go martianoff/gala/test //test
# gazelle:resolve go martianoff/gala/time_utils //time_utils
# gazelle:resolve go martianoff/gala/yaml //yaml
gazelle_binary(
name = "gazelle_bin",
languages = ["@gala_gazelle//gala"],
)
# Re-export the registered GALA toolchain's gala as the import helper, so the
# gala that extracts imports is the same one the toolchain transpiles with.
gala_imports_helper(name = "gala_imports")
gazelle(
name = "gazelle",
data = [":gala_imports"],
extra_args = ["-gala_helper=$(execpath :gala_imports)"],
gazelle = ":gazelle_bin",
)
# gazelle:prefix martianoff/gala
gazelle(
name = "gazelle-update-repos",
args = [
"-from_file=go.mod",
"-to_macro=deps.bzl%go_dependencies",
"-prune",
],
command = "update-repos",
)
filegroup(
name = "all_gala_sources",
srcs = [
"//collection_immutable:gala_sources",
"//collection_mutable:gala_sources",
"//concurrent:gala_sources",
"//crypto:gala_sources",
"//examples:gala_sources",
"//fs:gala_sources",
"//io:gala_sources",
"//json:gala_sources",
"//lazy:lazy.gala",
"//path:gala_sources",
"//regex:gala_sources",
"//std:constptr.gala",
"//std:either.gala",
"//std:errors.gala",
"//std:hashable.gala",
"//std:immutable.gala",
"//std:iterable.gala",
"//std:meta.gala",
"//std:option.gala",
"//std:ordered.gala",
"//std:seq.gala",
"//std:try.gala",
"//std:tuple.gala",
"//stream:stream.gala",
"//strings:gala_sources",
"//time_utils:gala_sources",
"//validation:gala_sources",
],
visibility = ["//visibility:public"],
)