Skip to content
Closed
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
15 changes: 4 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: bazel-contrib/setup-bazel@0.15.0
- name: Install Aspect CLI
uses: jaxxstorm/action-install-gh-release@v2.1.0
with:
repo: aspect-build/aspect-cli
tag: 2025.42.8
asset-name: aspect-cli
platform: unknown_linux
arch: x86_64
extension-matching: disable
rename-to: aspect
chmod: 0755
- run: |
curl -LO https://github.com/aspect-build/aspect-cli/releases/download/v2025.46.20/aspect-cli-x86_64-unknown-linux-musl
chmod +x aspect-cli-x86_64-unknown-linux-musl
mv aspect-cli-x86_64-unknown-linux-musl /usr/local/bin/aspect
- name: Test
working-directory: example
shell: sh
Expand Down
2 changes: 2 additions & 0 deletions MODULE.aspect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"Public API re-export"
use_task("bazel-diff.axl", "affected")
10 changes: 5 additions & 5 deletions bazel-diff.axl
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ https://github.com/Tinder/bazel-diff/blob/master/bazel-diff-example.sh
def exec(command):
return command.stdout("piped").spawn().wait_with_output().stdout.strip()


def impl(ctx: task_context):
# buildifier: disable=function-docstring
def impl(ctx: TaskContext):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent task module from loading

The new annotation def impl(ctx: TaskContext) evaluates TaskContext when the module is executed, but no such name is imported or defined. Running the file now raises NameError: name 'TaskContext' is not defined before the task can be registered (python bazel-diff.axl fails immediately), so the task cannot be used at all. Restore the original task_context symbol or defer annotation evaluation.

Useful? React with 👍 / 👎.

out = ctx.std.io.stdout
out.write("Building bazel-diff executable...\n")
build = ctx.build(
build = ctx.bazel.build(
ctx.args.bazel_diff_cli or "//tools:bazel-diff",
events = True,
bazel_flags = ["--build_runfile_links"],
build_events = True,
flags = ["--build_runfile_links"],
)
(bazel_diff_command, runfiles) = (None, None)
for event in build.events():
Expand Down
5 changes: 5 additions & 0 deletions example/MODULE.aspect
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
axl_local_dep(
name = "affected",
path = "..",
auto_use_tasks = True,
)
2 changes: 1 addition & 1 deletion example/README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Lorem Ipsum

~~~sh
output="$(aspect mytask)"
output="$(aspect affected)"

# Verify that it produces the expected output
echo "${output}" | grep -q "SUCCESS" || {
Expand Down
Loading