-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathBUILD.bazel
More file actions
56 lines (49 loc) · 1.46 KB
/
Copy pathBUILD.bazel
File metadata and controls
56 lines (49 loc) · 1.46 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
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load(":defs.bzl", "py_debuggable_binary")
# --------------------------------------------------------------------------- #
# Build mode flag.
#
# The default is "debug" (debugpy wraps the entrypoint).
# Pass --config=release or --//:mode=prod to get a clean binary.
# --------------------------------------------------------------------------- #
string_flag(
name = "mode",
build_setting_default = "debug",
values = [
"debug",
"prod",
],
)
config_setting(
name = "is_debug",
flag_values = {":mode": "debug"},
)
config_setting(
name = "is_prod",
flag_values = {":mode": "prod"},
)
# --------------------------------------------------------------------------- #
# Application target
#
# In debug mode, debug_main.py wraps app.py — it starts a debugpy DAP
# listener then imports and runs app.main(). In prod mode, app.py is
# the entrypoint directly and debugpy is not present.
# --------------------------------------------------------------------------- #
py_debuggable_binary(
name = "app",
srcs = ["app.py"],
debug_deps = [
"@pypi//debugpy",
],
main = "app.py",
deps = [
"@pypi//flask",
],
)
# Ensure the example binary builds on CI (it is a long-running Flask server,
# so it can't be run as a test).
build_test(
name = "app_build_test",
targets = [":app"],
)