Skip to content
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
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
6.0.0
6.2.0
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default_language_version:
repos:
# Check formatting and lint for starlark code
- repo: https://github.com/keith/pre-commit-buildifier
rev: 4.0.1.1
rev: 6.1.0.1
hooks:
- id: buildifier
- id: buildifier-lint
Expand Down
5 changes: 5 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

exports_files(
["WORKSPACE"],
visibility = ["//util:__pkg__"],
)

bzl_library(
name = "internal_deps",
srcs = ["internal_deps.bzl"],
Expand Down
9 changes: 9 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

# For buildifier linting
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

buildifier_prebuilt_deps()

load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")

buildifier_prebuilt_register_toolchains()

# For running integration tests
load("@contrib_rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies")

Expand Down
19 changes: 14 additions & 5 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def rules_zig_internal_deps():

http_archive(
name = "bazel_gazelle",
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz"],
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz"],
)

http_file(
Expand Down Expand Up @@ -62,6 +62,15 @@ def rules_zig_internal_deps():
url = "https://github.com/keith/rules_multirun/archive/73017d503a524a9de59a5339c1db9cc4860cec2a.tar.gz",
)

http_archive(
name = "buildifier_prebuilt",
sha256 = "e46c16180bc49487bfd0f1ffa7345364718c57334fa0b5b67cb5f27eba10f309",
strip_prefix = "buildifier-prebuilt-6.1.0",
urls = [
"http://github.com/keith/buildifier-prebuilt/archive/6.1.0.tar.gz",
],
)

# Override bazel_skylib distribution to fetch sources instead
# so that the gazelle extension is included
# see https://github.com/bazelbuild/bazel-skylib/issues/250
Expand All @@ -80,9 +89,9 @@ def rules_zig_internal_deps():

http_archive(
name = "aspect_bazel_lib",
sha256 = "ae56efc54ce3025ea908900e0d061423310b15e4676ae1359105583a2944665c",
strip_prefix = "bazel-lib-1.19.1",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.19.1.tar.gz",
sha256 = "0aed9a6e7612b2968b5aa1ac0f801f5ec956ec2c04810da2c1445cac34938596",
strip_prefix = "bazel-lib-1.29.0",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.29.0.tar.gz",
)

http_archive(
Expand Down
20 changes: 20 additions & 0 deletions util/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@rules_multirun//:defs.bzl", "multirun")

buildifier(
name = "buildifier.fix",
diff_command = "diff",
exclude_patterns = ["./.git/*"],
lint_mode = "fix",
mode = "fix",
)

buildifier_test(
name = "buildifier.check",
diff_command = "diff",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
no_sandbox = True,
workspace = "//:WORKSPACE",
)

multirun(
name = "update",
commands = [
":gazelle",
":update_filegroups",
"//docs:update-alias",
"@contrib_rules_bazel_integration_test//tools:update_deleted_packages",
":buildifier.fix",
],
)

Expand Down
6 changes: 2 additions & 4 deletions zig/private/zig_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ _zig_transition = transition(
],
)

def _make_attrs(*, executable, test):
def _make_attrs(*, executable):
return {
"actual": attr.label(
doc = "The target to transition.",
Expand Down Expand Up @@ -154,11 +154,9 @@ _FORWARD_PROVIDERS = [

def _make_zig_configure_rule(*, executable, test):
_executable = executable
_test = test

def _zig_configure_impl(ctx):
executable = _executable
test = _test

if type(ctx.attr.actual) == "list":
if len(ctx.attr.actual) == 1:
Expand Down Expand Up @@ -213,7 +211,7 @@ def _make_zig_configure_rule(*, executable, test):

return rule(
_zig_configure_impl,
attrs = _make_attrs(executable = executable, test = test),
attrs = _make_attrs(executable = executable),
doc = DOC + example,
executable = executable,
test = test,
Expand Down
1 change: 0 additions & 1 deletion zig/private/zig_package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def _zig_package_impl(ctx):
default = DefaultInfo(
)

description = (ctx.label.name, ctx.file.main)
srcs = [ctx.file.main] + ctx.files.srcs
flags = ["--pkg-begin", ctx.label.name, ctx.file.main.path]
all_srcs = []
Expand Down
2 changes: 1 addition & 1 deletion zig/tests/package_info_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ load(
def _mock_args():
self_args = []

def add_all(args, *, map_each = None):
def add_all(args):
for arg in args:
if type(arg) == "File":
self_args.append(arg.path)
Expand Down