Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Bazelmod from WORKSPACE #11

Merged
merged 5 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bazelrc
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,7 @@ secrets.sh
/.clwb/

# End of https://www.toptal.com/developers/gitignore/api/bazel

# Ignore Bazel's lockfile until usability gets resolved. See
# https://github.com/bazelbuild/bazel/issues/20369
MODULE.bazel.lock
38 changes: 38 additions & 0 deletions MODULE.bazel
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")
60 changes: 0 additions & 60 deletions WORKSPACE

This file was deleted.

Loading