Skip to content

Commit 56a314b

Browse files
authored
refactor: single AXL module (#654)
users shouldn't have to dep on rules_lint twice
1 parent a64e10f commit 56a314b

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ jobs:
6565
run: aspect lint
6666
- name: Format
6767
working-directory: example
68-
run: aspect format
68+
# Only format one language to keep CI time reasonable
69+
run: aspect format --format_target=//tools/format:format_Shell_with_shfmt --all_files=true
6970
test:
7071
strategy:
7172
matrix:

MODULE.aspect

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
use_task("lint/lint.axl", "lint")
2+
use_task("format/format.axl", "format")

example/MODULE.aspect

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
axl_local_dep(
2-
name = "lint",
3-
path = "../lint",
4-
auto_use_tasks = True,
5-
)
6-
7-
axl_local_dep(
8-
name = "format",
9-
path = "../format",
2+
name = "rules_lint",
3+
path = "..",
104
auto_use_tasks = True,
115
)

format/MODULE.aspect

Lines changed: 0 additions & 1 deletion
This file was deleted.

format/format.axl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,16 @@ def impl(ctx: TaskContext) -> int:
8484

8585
formatter = build_formatter(ctx)
8686

87-
changed_files = find_changed_files(out, ctx.std.process)
88-
out.write("Formatting changed files:\n%s" % changed_files)
87+
format_args = []
88+
if not ctx.args.all_files:
89+
changed_files = find_changed_files(out, ctx.std.process)
90+
out.write("Formatting changed files:\n%s" % changed_files)
91+
format_args = changed_files.split("\n")
8992

9093
exit = bazel_run(
9194
ctx,
9295
entrypoint = formatter,
93-
args = changed_files.split("\n"),
96+
args = format_args,
9497
).wait()
9598

9699
if not exit.success:
@@ -101,6 +104,7 @@ def impl(ctx: TaskContext) -> int:
101104
format = task(
102105
implementation = impl,
103106
args = {
107+
"all_files": args.boolean(default = False),
104108
"format_target": args.string(default = "//tools/format"),
105109
},
106110
)

lint/MODULE.aspect

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)