-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to Bazelmod from WORKSPACE (#11)
- Loading branch information
1 parent
866eee0
commit 130fade
Showing
4 changed files
with
44 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Don't use the MODULE.bazel stuff yet. | ||
common --noenable_bzlmod | ||
# Use the MODULE.bazel stuff instead of the old WORKSPACE. | ||
common --enable_bzlmod | ||
|
||
# Show output if tests fail. | ||
test --test_output=errors |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Name the workspace/module | ||
module( | ||
name = "bitwarden-to-keepass", | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
# Install rules_python, which allows us to define how bazel should work with python files. | ||
# See https://github.com/bazelbuild/rules_python/blob/c6941a8dad4c7a221125fbad7c8bfaac377e00ba/examples/bzlmod/MODULE.bazel | ||
bazel_dep(name = "rules_python", version = "0.31.0") | ||
|
||
# Init the python toolchain using the extension. | ||
# This is similar to the "python_register_toolchains" function in WORKSPACE. | ||
# It creates a hermetic python rather than relying on a system-installed interpreter. | ||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
python.toolchain( | ||
configure_coverage_tool = True, | ||
# Available versions are listed in @rules_python//python:versions.bzl. | ||
# For some reason we can't set 3.8.18 here - it causes pip.parse() to fail. | ||
python_version = "3.8" | ||
) | ||
|
||
# Enable pip | ||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
|
||
# Configure how we fetch python dependencies via pip | ||
pip.parse( | ||
# This name is what gets used in other BUILD files with `load()`. | ||
hub_name = "pypi", | ||
python_version = "3.8.18", | ||
# TODO: what to put here? Using this might resolve the "can't set 3.8.18" | ||
# issue mentioned above. | ||
# python_interpreter_target = python, | ||
requirements_lock = "//:requirements_lock.txt", | ||
) | ||
|
||
# Same as WORKSPACE install_deps() - actually install the python deps. | ||
use_repo(pip, "pypi") |