Skip to content

Commit 2be1b2f

Browse files
committed
Add documentation on WORKSPACE methods for repo users
1 parent e3fccfd commit 2be1b2f

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

bazel/deps.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
22
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
33

4+
# Load the main dependencies from platformio_rules
5+
#
6+
# This cannot load all the dependencies, as some load()s are needed from these,
7+
# which cannot be done in a function, but this is the first step of the process
48
def platformio_rules_dependencies():
9+
# Import Stardoc, to write the documentation to our Starlark rules
510
git_repository(
611
name = "io_bazel_stardoc",
712
remote = "https://github.com/bazelbuild/stardoc.git",
813
tag = "0.5.3",
914
)
15+
# Import python, this is the first step to get pip_parse() dependencies to
16+
# be corrently imported
1017
http_archive(
1118
name = "rules_python",
1219
sha256 = "81cbfc16dd1c022c4761267fa8b2feb881aaea9c3e1143f2e64630a1ad18c347",

bazel/pip_install.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
load("@py_deps//:requirements.bzl", "install_deps")
22

3+
# Finally, now that pip_parse() has been executed, install the pip dependencies
34
def platformio_rules_pip_install_dependencies():
5+
# Install all pip dependencies
46
install_deps()

bazel/pip_parse.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
load("@python3_10_8//:defs.bzl", "interpreter")
22
load("@rules_python//python:pip.bzl", "pip_parse")
33

4+
# Now that Python has been registered, load the pip packages that are required
5+
# for template rendering
46
def platformio_rules_pip_parse_dependencies():
7+
# Load the pip packages needed
58
pip_parse(
69
name = "py_deps",
710
python_interpreter_target = interpreter,

bazel/transitive.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
22
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
33

4+
# Load the first level of dependencies that are based on the ones imported in
5+
# platformio_rules_dependencies(), as these imports depend on load() commands
6+
# that come from those imports
47
def platformio_rules_transitive_dependencies():
8+
# Import all the dependencies for Stardoc, so we can write documentation for
9+
# our Starlark rules
510
stardoc_repositories()
11+
12+
# Select the Python toolchain that will be used for template rendering. This
13+
# is required for pip_parse() to be executed
614
python_register_toolchains(
715
name = "python3_10_8",
816
# Available versions are listed in @rules_python//python:versions.bzl.

0 commit comments

Comments
 (0)