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

Fix issues found by pre-commit hooks #44

Merged
merged 5 commits into from
Feb 28, 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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Bazel Features
==============
# Bazel Features

Use this to determine the availability of a Bazel feature in your ruleset. It works under the hood by comparing the Bazel version against a known range in which the feature is available. Example usage:

Expand Down
2 changes: 2 additions & 0 deletions deps.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Contains the macro bazel_features_deps to install WORKSPACE dependencies."""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//private:repos.bzl", "bazel_features_repos")
Expand Down
2 changes: 2 additions & 0 deletions private/extensions.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Internal module extensions."""

load("//private:repos.bzl", "bazel_features_repos")

def _version_extension_impl(_):
Expand Down
2 changes: 2 additions & 0 deletions private/globals.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Internal constants."""

# Access any of these globals via bazel_features.globals.<name>
# If the current version of Bazel doesn't have this global, it will be None.
GLOBALS = {
Expand Down
2 changes: 2 additions & 0 deletions private/globals_repo.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Contains the internal repository rule globals_repo."""

load("//private:parse.bzl", "parse_version")

def _globals_repo_impl(rctx):
Expand Down
11 changes: 10 additions & 1 deletion private/parse.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Internal functions to parse versions."""

def _safe_int(s, v):
if not s.isdigit():
fail("invalid Bazel version '{}': non-numeric segment '{}'".format(v, s))
Expand All @@ -13,7 +15,14 @@ def _partition(s):
return s, ""

def parse_version(v):
"""Parses the given Bazel version string into a comparable value."""
"""Parses the given Bazel version string into a comparable value.

Args:
v (str): version string

Returns:
a triple ([major, minor, patch], is_released, prerelease)
"""
if not v:
# An empty string is treated as a "dev version", which is greater than anything.
v = "999999.999999.999999"
Expand Down
2 changes: 2 additions & 0 deletions private/repos.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Contains the macro bazel_features_repos to install internal repositories."""

load(":globals.bzl", "GLOBALS")
load(":globals_repo.bzl", "globals_repo")
load(":version_repo.bzl", "version_repo")
Expand Down
2 changes: 2 additions & 0 deletions private/util.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Internal-only utility functions."""

load("@bazel_features_version//:version.bzl", "version")
load(":parse.bzl", "parse_version")

Expand Down
2 changes: 2 additions & 0 deletions private/version_repo.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Contains the internal repository rule version_repo."""

def _version_repo_impl(rctx):
rctx.file(
"BUILD.bazel",
Expand Down
4 changes: 1 addition & 3 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
"extends": ["config:base"]
}
4 changes: 2 additions & 2 deletions test/bcr_test/test.bzl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Tests for `bazel_features` module."""

load("@bazel_features//:features.bzl", "bazel_features")
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")

"""Tests for `bazel_features` module."""

def _is_bzlmod_enabled_test(ctx):
env = unittest.begin(ctx)

Expand Down
Loading