Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import %workspace%/.aspect/bazelrc/javascript.bazelrc
import %workspace%/.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
common --enable_platform_specific_config

# For testing our --stamp behavior.
# Normally users would use a --workspace_status_command with a script that calls `git describe`.
Expand All @@ -29,6 +30,17 @@ common --check_direct_dependencies=off
# Make sure we don't regress this.
common --incompatible_auto_exec_groups

# Symlinks are pretty much required on windows so enable by default
startup --windows_enable_symlinks

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# This option fixes 20 tests on Windows but I am reluctant to enable it as it would be
# better for this library to be tested with runfiles off (it is a performance drain on windows).
# common:windows --enable_runfiles

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.1.1
8.3.1
12 changes: 10 additions & 2 deletions .bcr/patches/go_dev_dep.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/MODULE.bazel b/MODULE.bazel
index e63fa5b..9d78a88 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -50,19 +50,19 @@ use_repo(host, "aspect_bazel_lib_host")
@@ -52,26 +52,26 @@ use_repo(host, "aspect_bazel_lib_host")
bazel_dep(
name = "gazelle",
version = "0.40.0",
Expand All @@ -11,12 +11,20 @@ index e63fa5b..9d78a88 100644
)
bazel_dep(
name = "rules_go",
version = "0.51.0",
version = "0.55.0",
repo_name = "io_bazel_rules_go",
- # In released versions: dev_dependency = True
+ dev_dependency = True,
)

go_sdk = use_extension(
"@io_bazel_rules_go//go:extensions.bzl",
"go_sdk",
- # In released versions: dev_dependency = True
+ dev_dependency = True,
)
go_sdk.from_file(go_mod = "//:go.mod")

go_deps = use_extension(
"@gazelle//:extensions.bzl",
"go_deps",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ common --repository_cache=~/.cache/bazel-repository-cache

# Debug where options came from
common --announce_rc

# Keep bazel stdout readable in logs
common --noshow_progress
14 changes: 2 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,8 @@ jobs:
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
- id: os
name: Prepare 'os' matrix axis
# Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
run: |
a=( ubuntu )
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "$HEAD_REF" == *"macos"* ]]; then
a+=( macos )
fi
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "$HEAD_REF" == *"windows"* ]]; then
a+=( windows )
fi
a=( ubuntu, macos, windows )
printf -v j '"%s",' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
outputs:
Expand Down Expand Up @@ -89,11 +81,9 @@ jobs:
- bazel-version:
major: 6
bzlmod: 1
# TODO: green up root Workspace on MacOS & Windows
# TODO: green up root Workspace on MacOS
- folder: .
os: macos
- folder: .
os: windows
include:
- folder: docs
bzlmod: 1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ on:
type: string
jobs:
publish:
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.2.3
with:
tag_name: ${{ inputs.tag_name }}
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
registry_fork: bazel-contrib/bazel-central-registry
draft: false
permissions:
attestations: write
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
retention-days: 1
release:
needs: build
uses: bazel-contrib/.github/.github/workflows/[email protected].2
uses: bazel-contrib/.github/.github/workflows/[email protected].3
with:
release_files: |
go-binaries/*
Expand Down
3 changes: 2 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ assert_contains(
name = "bazel_version_test",
actual = ".bazelversion",
expected = str(host.bazel_version),
target_compatible_with = [] if host.bazel_version.startswith("7") else ["@platforms//:incompatible"],
# TODO: Enable this for windows
target_compatible_with = [] if host.bazel_version.startswith("7") and not host.is_windows else ["@platforms//:incompatible"],
)

bzl_library(
Expand Down
18 changes: 12 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

module(
name = "aspect_bazel_lib",
version = "0.0.0",
bazel_compatibility = [">=6.0.0"],
bazel_compatibility = [">=6.5.0"],
compatibility_level = 1,
)

# Lower-bounds (minimum) versions for direct runtime dependencies
bazel_dep(name = "bazel_features", version = "1.9.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "stardoc", version = "0.6.2")
bazel_dep(name = "stardoc", version = "0.7.1")
bazel_dep(name = "rules_shell", version = "0.4.1")

# TODO(3.0): remove this back-compat
bazel_dep(name = "jq.bzl", version = "0.1.0")
bazel_dep(name = "yq.bzl", version = "0.1.1")
bazel_dep(name = "tar.bzl", version = "0.2.1")
bazel_dep(name = "tar.bzl", version = "0.5.1")

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib_toolchains.copy_directory()
Expand Down Expand Up @@ -56,11 +55,18 @@ bazel_dep(
)
bazel_dep(
name = "rules_go",
version = "0.51.0",
version = "0.55.0",
repo_name = "io_bazel_rules_go",
# In released versions: dev_dependency = True
)

go_sdk = use_extension(
"@io_bazel_rules_go//go:extensions.bzl",
"go_sdk",
# In released versions: dev_dependency = True
)
go_sdk.from_file(go_mod = "//:go.mod")

go_deps = use_extension(
"@gazelle//:extensions.bzl",
"go_deps",
Expand Down
10 changes: 9 additions & 1 deletion bzl_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ def bzl_library(name, srcs = [], deps = [], **kwargs):
# native Bazel rule.
# See bazelbuild/bazel-skylib#568
if hasattr(native, "starlark_doc_extract") and "/private" not in native.package_name():
extract_targets = []
for i, src in enumerate(srcs):
extract_target = "{}.doc_extract{}".format(name, i if i > 0 else "")
native.starlark_doc_extract(
name = "{}.doc_extract{}".format(name, i if i > 0 else ""),
name = extract_target,
src = src,
deps = deps,
testonly = True,
visibility = ["//visibility:private"],
)
extract_targets.append(extract_target)
native.filegroup(
name = "{}.docs-as-proto".format(name),
srcs = extract_targets,
testonly = True,
)
2 changes: 1 addition & 1 deletion docs/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.1.1
8.3.1
4 changes: 2 additions & 2 deletions docs/repositories.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/api_entries/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.8.1", dev_dependency = True)
4 changes: 4 additions & 0 deletions e2e/copy_action/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
2 changes: 1 addition & 1 deletion e2e/copy_action/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.8.1", dev_dependency = True)
4 changes: 4 additions & 0 deletions e2e/copy_to_directory/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
2 changes: 1 addition & 1 deletion e2e/copy_to_directory/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.8.1", dev_dependency = True)
4 changes: 4 additions & 0 deletions e2e/coreutils/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
4 changes: 4 additions & 0 deletions e2e/external_copy_to_directory/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
2 changes: 1 addition & 1 deletion e2e/external_copy_to_directory/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.8.1", dev_dependency = True)
4 changes: 4 additions & 0 deletions e2e/smoke/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import %workspace%/../../.aspect/bazelrc/performance.bazelrc
# For testing expand_template
common --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3"

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
4 changes: 2 additions & 2 deletions e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "rules_go", version = "0.53.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
bazel_dep(name = "bazel_skylib", version = "1.8.1", dev_dependency = True)
bazel_dep(name = "rules_go", version = "0.55.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
4 changes: 4 additions & 0 deletions e2e/write_source_files/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import %workspace%/../../.aspect/bazelrc/performance.bazelrc

### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###

# Point tools such as coursier (used in rules_jvm_external) to Bazel's downloaded JDK
# suggested in https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk

# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module github.com/bazel-contrib/bazel-lib

go 1.22

toolchain go1.24.0
go 1.24.6

require (
github.com/bazelbuild/rules_go v0.53.0
github.com/bazelbuild/rules_go v0.55.0
github.com/bmatcuk/doublestar/v4 v4.7.1
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948
golang.org/x/sys v0.30.0
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
github.com/bazelbuild/rules_go v0.52.0 h1:+ozpngVAW67pCAwfhepaXSSrG3yHcj8K9hNAxSYBno4=
github.com/bazelbuild/rules_go v0.52.0/go.mod h1:M+YrupNArA7OiTlv++rFUgQ6Sm+ZXbQ5HPUj0cGa0us=
github.com/bazelbuild/rules_go v0.53.0 h1:u160DT+RRb+Xb2aSO4piN8xhs4aZvWz2UDXCq48F4ao=
github.com/bazelbuild/rules_go v0.53.0/go.mod h1:xB1jfsYHWlnZyPPxzlOSst4q2ZAwS251Mp9Iw6TPuBc=
github.com/bazelbuild/rules_go v0.55.0 h1:S8X/b/Oygw/Dtv7NuyW7ht0QwdynMEdXQqYigX5A1KY=
github.com/bazelbuild/rules_go v0.55.0/go.mod h1:T90Gpyq4HDFlsrvtQa2CBdHNJ2P4rAu/uUTmQbanzf0=
github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0CXv75Q=
github.com/bmatcuk/doublestar/v4 v4.7.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
8 changes: 7 additions & 1 deletion lib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ toolchain_type(
name = "expand_template_toolchain_type",
)

toolchain_type(
# TODO(3.0): remove
alias(
name = "tar_toolchain_type",
actual = "@tar.bzl//tar/toolchain:type",
)

toolchain_type(
name = "target_tar_toolchain_type",
)

toolchain_type(
Expand Down
2 changes: 2 additions & 0 deletions lib/private/copy_directory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def copy_directory_bin_action(
outputs = [dst],
executable = copy_directory_bin,
arguments = args,
# TODO: Drop this after https://github.com/bazel-contrib/bazel-lib/issues/1146
env = {"GODEBUG": "winsymlink=0"},
mnemonic = "CopyDirectory",
progress_message = "Copying directory %{input}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
Expand Down
2 changes: 2 additions & 0 deletions lib/private/copy_to_directory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ def copy_to_directory_bin_action(
outputs = [dst],
executable = copy_to_directory_bin,
arguments = [config_file.path, ctx.label.workspace_name],
# TODO: Drop this after https://github.com/bazel-contrib/bazel-lib/issues/1146
env = {"GODEBUG": "winsymlink=0"},
mnemonic = "CopyToDirectory",
progress_message = "Copying files to directory %{output}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
Expand Down
Loading
Loading