chore: run buildifier
This commit is contained in:
parent
7b382c9ff1
commit
47dd4ce9fd
10
MODULE.bazel
10
MODULE.bazel
|
@ -2,19 +2,19 @@
|
|||
|
||||
module(
|
||||
name = "aspect_bazel_lib",
|
||||
compatibility_level = 1,
|
||||
version = "0.0.0",
|
||||
compatibility_level = 1,
|
||||
)
|
||||
|
||||
# Lower-bound versions of our dependencies
|
||||
bazel_dep(name = "bazel_skylib", version = "1.4.1")
|
||||
bazel_dep(name = "platforms", version = "0.0.4")
|
||||
|
||||
# 0.5.4 is the first version with bzlmod support
|
||||
bazel_dep(name = "stardoc", repo_name = "io_bazel_stardoc", version = "0.5.4")
|
||||
bazel_dep(name = "stardoc", version = "0.5.4", repo_name = "io_bazel_stardoc")
|
||||
|
||||
ext = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "ext")
|
||||
|
||||
use_repo(ext, "copy_directory_toolchains", "copy_to_directory_toolchains", "jq_toolchains", "yq_toolchains", "coreutils_toolchains", "expand_template_toolchains")
|
||||
use_repo(ext, "copy_directory_toolchains", "copy_to_directory_toolchains", "coreutils_toolchains", "expand_template_toolchains", "jq_toolchains", "yq_toolchains")
|
||||
|
||||
register_toolchains(
|
||||
"@copy_directory_toolchains//:all",
|
||||
|
@ -22,7 +22,7 @@ register_toolchains(
|
|||
"@jq_toolchains//:all",
|
||||
"@yq_toolchains//:all",
|
||||
"@coreutils_toolchains//:all",
|
||||
"@expand_template_toolchains//:all"
|
||||
"@expand_template_toolchains//:all",
|
||||
)
|
||||
|
||||
# Development-only dependencies
|
||||
|
|
|
@ -38,16 +38,12 @@ hex(<a href="#hex-number">number</a>)
|
|||
|
||||
Format integer to hexdecimal representation
|
||||
|
||||
Args:
|
||||
number: number to format
|
||||
|
||||
|
||||
**PARAMETERS**
|
||||
|
||||
|
||||
| Name | Description | Default Value |
|
||||
| :------------- | :------------- | :------------- |
|
||||
| <a id="hex-number"></a>number | <p align="center"> - </p> | none |
|
||||
| <a id="hex-number"></a>number | number to format | none |
|
||||
|
||||
**RETURNS**
|
||||
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
module(
|
||||
name = "bzlmod_write_source_files_external",
|
||||
compatibility_level = 1,
|
||||
version = "0.0.0",
|
||||
compatibility_level = 1,
|
||||
)
|
||||
|
||||
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
|
||||
|
||||
local_path_override(
|
||||
module_name = "aspect_bazel_lib",
|
||||
path = "../..",
|
||||
)
|
||||
|
||||
test_ext = use_extension("//:test_extension.bzl", "test_ext")
|
||||
|
||||
use_repo(test_ext, "test")
|
||||
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
module(
|
||||
name = "copy_to_directory",
|
||||
compatibility_level = 1,
|
||||
version = "0.0.0",
|
||||
compatibility_level = 1,
|
||||
)
|
||||
|
||||
bazel_dep(name = "bazel_skylib", version = "1.1.1")
|
||||
|
||||
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
|
||||
|
||||
local_path_override(
|
||||
module_name = "aspect_bazel_lib",
|
||||
path = "../..",
|
||||
)
|
||||
|
||||
ext = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "ext")
|
||||
|
||||
ext.host()
|
||||
|
||||
use_repo(ext, "aspect_bazel_lib_host")
|
||||
|
|
|
@ -10,22 +10,21 @@ genrule(
|
|||
|
||||
hashes(
|
||||
name = "hash",
|
||||
src = "test.bin"
|
||||
src = "test.bin",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "md5",
|
||||
srcs = [":hash"],
|
||||
output_group = "md5",
|
||||
srcs = [":hash"]
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "sha1",
|
||||
srcs = [":hash"],
|
||||
output_group = "sha1",
|
||||
srcs = [":hash"]
|
||||
)
|
||||
|
||||
|
||||
# This tests that the "in" file to write_source_files can be a
|
||||
# label to an external repository target when bzlmod is enabled.
|
||||
write_source_files(
|
||||
|
@ -34,7 +33,6 @@ write_source_files(
|
|||
"ls.txt.expected": ":ls.txt",
|
||||
"sha256.txt": ":hash",
|
||||
"sha1.txt": ":sha1",
|
||||
"md5.txt": ":md5"
|
||||
"md5.txt": ":md5",
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
module(
|
||||
name = "coreutils",
|
||||
compatibility_level = 1,
|
||||
version = "0.0.0",
|
||||
compatibility_level = 1,
|
||||
)
|
||||
|
||||
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
|
||||
|
||||
local_path_override(
|
||||
module_name = "aspect_bazel_lib",
|
||||
path = "../..",
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
module(
|
||||
name = "smoke",
|
||||
compatibility_level = 1,
|
||||
version = "0.0.0",
|
||||
compatibility_level = 1,
|
||||
)
|
||||
|
||||
bazel_dep(name = "bazel_skylib", version = "1.1.1")
|
||||
|
||||
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
|
||||
|
||||
local_path_override(
|
||||
module_name = "aspect_bazel_lib",
|
||||
path = "../..",
|
||||
|
|
|
@ -65,20 +65,19 @@ bzl_library(
|
|||
name = "expand_make_vars",
|
||||
srcs = ["expand_make_vars.bzl"],
|
||||
deps = [
|
||||
":expand_template",
|
||||
"//lib/private/docs:expand_locations",
|
||||
"//lib/private/docs:expand_variables",
|
||||
":expand_template",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
bzl_library(
|
||||
name = "expand_template",
|
||||
srcs = ["expand_template.bzl"],
|
||||
deps = [
|
||||
"//lib/private/docs:expand_locations",
|
||||
"//lib/private/docs:expand_variables",
|
||||
"//lib/private/docs:expand_template",
|
||||
"//lib/private/docs:expand_variables",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -6,5 +6,6 @@ load(":expand_template.bzl", _expand_template = "expand_template")
|
|||
|
||||
expand_locations = _expand_locations
|
||||
expand_variables = _expand_variables
|
||||
|
||||
# TODO: 2.0 remove re-export from this file.
|
||||
expand_template = _expand_template
|
||||
|
|
|
@ -4,10 +4,10 @@ load(
|
|||
"@aspect_bazel_lib//lib:repositories.bzl",
|
||||
"register_copy_directory_toolchains",
|
||||
"register_copy_to_directory_toolchains",
|
||||
"register_jq_toolchains",
|
||||
"register_yq_toolchains",
|
||||
"register_coreutils_toolchains",
|
||||
"register_expand_template_toolchains",
|
||||
"register_jq_toolchains",
|
||||
"register_yq_toolchains",
|
||||
)
|
||||
load("//lib/private:host_repo.bzl", "host_repo")
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Implementation based on https://gist.github.com/trondhumbor/ce57c0c2816bb45a8fbb
|
|||
the subset of python available in Starlark.
|
||||
"""
|
||||
|
||||
load(":strings.bzl", "ord", "chr")
|
||||
load(":strings.bzl", "chr", "ord")
|
||||
|
||||
def decode(data):
|
||||
"""Decode a Base64 encoded string.
|
||||
|
|
|
@ -101,8 +101,8 @@ bzl_library(
|
|||
srcs = ["//lib/private:expand_template.bzl"],
|
||||
deps = [
|
||||
":expand_locations",
|
||||
"//lib:stamping",
|
||||
"@bazel_skylib//lib:dicts",
|
||||
"//lib:stamping"
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -229,8 +229,8 @@ bzl_library(
|
|||
name = "base64",
|
||||
srcs = ["//lib/private:base64.bzl"],
|
||||
deps = [
|
||||
":strings"
|
||||
]
|
||||
":strings",
|
||||
],
|
||||
)
|
||||
|
||||
bzl_library(
|
||||
|
@ -251,7 +251,7 @@ bzl_library(
|
|||
bzl_library(
|
||||
name = "expand_template_toolchain",
|
||||
srcs = ["//lib/private:expand_template_toolchain.bzl"],
|
||||
deps = ["//lib:stamping"]
|
||||
deps = ["//lib:stamping"],
|
||||
)
|
||||
|
||||
bzl_library(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"expand_template rule"
|
||||
|
||||
load("@bazel_skylib//lib:dicts.bzl", "dicts")
|
||||
load(":expand_locations.bzl", _expand_locations = "expand_locations")
|
||||
load(":expand_variables.bzl", _expand_variables = "expand_variables")
|
||||
load("//lib:stamping.bzl", "STAMP_ATTRS", "maybe_stamp")
|
||||
|
||||
|
||||
def _expand_substitutions(ctx, substitutions):
|
||||
result = {}
|
||||
for k, v in substitutions.items():
|
||||
|
@ -23,7 +23,7 @@ def _expand_template_impl(ctx):
|
|||
substitutions_out = ctx.actions.declare_file("{}_substitutions.json".format(ctx.label.name))
|
||||
ctx.actions.write(
|
||||
output = substitutions_out,
|
||||
content = json.encode(substitutions)
|
||||
content = json.encode(substitutions),
|
||||
)
|
||||
|
||||
inputs = [
|
||||
|
@ -109,7 +109,7 @@ such as `$(BINDIR)`, `$(TARGET_CPU)`, and `$(COMPILATION_MODE)` as documented in
|
|||
mandatory = True,
|
||||
allow_single_file = True,
|
||||
),
|
||||
}, **STAMP_ATTRS),
|
||||
}, **STAMP_ATTRS),
|
||||
)
|
||||
|
||||
expand_template = rule(
|
||||
|
|
|
@ -583,4 +583,3 @@ def hex(number):
|
|||
hex_string = "0"
|
||||
|
||||
return "{}0x{}".format("-" if is_signed else "", hex_string)
|
||||
|
||||
|
|
|
@ -166,7 +166,6 @@ def register_copy_to_directory_toolchains(name = "copy_to_directory", register =
|
|||
user_repository_name = name,
|
||||
)
|
||||
|
||||
|
||||
def register_expand_template_toolchains(name = "expand_template", register = True):
|
||||
"""Registers expand_template toolchain and repositories
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
|
||||
"Utilities for strings"
|
||||
|
||||
load("//lib/private:strings.bzl", _chr = "chr", _ord = "ord", _hex = "hex")
|
||||
load("//lib/private:strings.bzl", _chr = "chr", _hex = "hex", _ord = "ord")
|
||||
|
||||
chr = _chr
|
||||
ord = _ord
|
||||
|
|
|
@ -196,8 +196,8 @@ copy_to_directory(
|
|||
":d",
|
||||
":e/e1",
|
||||
":e/e2",
|
||||
"//lib/tests/copy_to_directory/f/f2",
|
||||
"//lib/tests/copy_to_directory/f/f2:f1",
|
||||
"//lib/tests/copy_to_directory/f/f2:f2",
|
||||
"@external_test_repo//:test_c",
|
||||
"@external_test_repo//:test_d",
|
||||
] + make_directory_paths(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""unit tests for string"""
|
||||
|
||||
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
|
||||
load("//lib/private:strings.bzl", "ord", "chr", "hex")
|
||||
load("//lib/private:strings.bzl", "chr", "hex", "ord")
|
||||
|
||||
def _ord_test_impl(ctx):
|
||||
env = unittest.begin(ctx)
|
||||
|
@ -20,7 +20,6 @@ def _ord_test_impl(ctx):
|
|||
|
||||
ord_test = unittest.make(_ord_test_impl)
|
||||
|
||||
|
||||
def _chr_test_impl(ctx):
|
||||
env = unittest.begin(ctx)
|
||||
|
||||
|
@ -38,7 +37,6 @@ def _chr_test_impl(ctx):
|
|||
|
||||
chr_test = unittest.make(_chr_test_impl)
|
||||
|
||||
|
||||
def _hex_test_impl(ctx):
|
||||
env = unittest.begin(ctx)
|
||||
|
||||
|
@ -46,6 +44,7 @@ def _hex_test_impl(ctx):
|
|||
asserts.equals(env, hex(97), "0x61")
|
||||
asserts.equals(env, hex(1000000000000), "0xe8d4a51000")
|
||||
asserts.equals(env, hex(1), "0x1")
|
||||
|
||||
# https://en.wikipedia.org/wiki/Signed_zero
|
||||
asserts.equals(env, hex(0), "0x0")
|
||||
asserts.equals(env, hex(-0), "0x0")
|
||||
|
@ -61,5 +60,5 @@ def strings_test_suite():
|
|||
"strings_tests",
|
||||
ord_test,
|
||||
chr_test,
|
||||
hex_test
|
||||
hex_test,
|
||||
)
|
||||
|
|
|
@ -28,6 +28,6 @@ release(
|
|||
targets = [
|
||||
":copy_directory",
|
||||
":copy_to_directory",
|
||||
":expand_template"
|
||||
":expand_template",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -6,7 +6,6 @@ via output groups.
|
|||
Based on https://github.com/bazelbuild/examples/blob/main/rules/implicit_output/hash.bzl
|
||||
"""
|
||||
|
||||
|
||||
def _hash(ctx, algo, file):
|
||||
coreutils = ctx.toolchains["@aspect_bazel_lib//lib:coreutils_toolchain_type"]
|
||||
out = ctx.actions.declare_file("{}.{}".format(file.path, algo))
|
||||
|
@ -20,7 +19,7 @@ def _hash(ctx, algo, file):
|
|||
algo = algo,
|
||||
src = file.path,
|
||||
basename = file.basename,
|
||||
out = out.path
|
||||
out = out.path,
|
||||
),
|
||||
)
|
||||
return out
|
||||
|
@ -55,7 +54,7 @@ _hashes = rule(
|
|||
"src": attr.label(
|
||||
allow_single_file = True,
|
||||
mandatory = True,
|
||||
)
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue