-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from roleroz/master
Clean up WORKSPACE files for users Currently, if you have a repository using this one, the WORKSPACE for that repository is full of sections that are dependent on the internal implementation of platformio_rules. This PR creates Starlark libraries to define those WORKSPACE files easily and cleanly bazel build ... && bazel test ... passes
- Loading branch information
Showing
7 changed files
with
80 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
# Load the main dependencies from platformio_rules | ||
# | ||
# This cannot load all the dependencies, as some load()s are needed from these, | ||
# which cannot be done in a function, but this is the first step of the process | ||
def platformio_rules_dependencies(): | ||
# Import Stardoc, to write the documentation to our Starlark rules | ||
git_repository( | ||
name = "io_bazel_stardoc", | ||
remote = "https://github.com/bazelbuild/stardoc.git", | ||
tag = "0.5.3", | ||
) | ||
# Import python, this is the first step to get pip_parse() dependencies to | ||
# be corrently imported | ||
http_archive( | ||
name = "rules_python", | ||
sha256 = "81cbfc16dd1c022c4761267fa8b2feb881aaea9c3e1143f2e64630a1ad18c347", | ||
strip_prefix = "rules_python-0.16.1", | ||
url = "https://github.com/bazelbuild/rules_python/archive/0.16.1.zip", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
load("@py_deps//:requirements.bzl", "install_deps") | ||
|
||
# Finally, now that pip_parse() has been executed, install the pip dependencies | ||
def platformio_rules_pip_install_dependencies(): | ||
# Install all pip dependencies | ||
install_deps() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
load("@python3_10_8//:defs.bzl", "interpreter") | ||
load("@rules_python//python:pip.bzl", "pip_parse") | ||
|
||
# Now that Python has been registered, load the pip packages that are required | ||
# for template rendering | ||
def platformio_rules_pip_parse_dependencies(): | ||
# Load the pip packages needed | ||
pip_parse( | ||
name = "py_deps", | ||
python_interpreter_target = interpreter, | ||
requirements_lock = "@platformio_rules//:requirements_lock.txt", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") | ||
load("@rules_python//python:repositories.bzl", "python_register_toolchains") | ||
|
||
# Load the first level of dependencies that are based on the ones imported in | ||
# platformio_rules_dependencies(), as these imports depend on load() commands | ||
# that come from those imports | ||
def platformio_rules_transitive_dependencies(): | ||
# Import all the dependencies for Stardoc, so we can write documentation for | ||
# our Starlark rules | ||
stardoc_repositories() | ||
|
||
# Select the Python toolchain that will be used for template rendering. This | ||
# is required for pip_parse() to be executed | ||
python_register_toolchains( | ||
name = "python3_10_8", | ||
# Available versions are listed in @rules_python//python:versions.bzl. | ||
# We recommend using the same version your team is already standardized on. | ||
python_version = "3.10.8", | ||
) |