Skip to content

Commit 442f2e3

Browse files
committed
fix: resolve buildifier formatting issues and CI compatibility
- Comment out local_path_override in MODULE.bazel for CI compatibility - Fix all buildifier formatting violations across BUILD files - Add name parameter to file_ops_integration_tests macro - Remove deprecated sh_test usage - Download buildifier tool for code quality checks
1 parent 201f3cf commit 442f2e3

File tree

8 files changed

+54
-68
lines changed

8 files changed

+54
-68
lines changed

BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ string_flag(
1414
build_setting_default = "auto",
1515
values = [
1616
"auto",
17-
"tinygo",
17+
"tinygo",
1818
"rust",
1919
],
2020
)
@@ -27,7 +27,7 @@ config_setting(
2727
)
2828

2929
config_setting(
30-
name = "use_rust",
30+
name = "use_rust",
3131
flag_values = {
3232
":implementation": "rust",
3333
},
@@ -61,7 +61,7 @@ config_setting(
6161
config_setting(
6262
name = "strict_security",
6363
flag_values = {
64-
":security_level": "strict",
64+
":security_level": "strict",
6565
},
6666
)
6767

@@ -101,4 +101,4 @@ filegroup(
101101
exports_files([
102102
"LICENSE",
103103
"README.md",
104-
])
104+
])

MODULE.bazel

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1")
2222
bazel_dep(name = "rules_rust", version = "0.53.0")
2323
bazel_dep(name = "rules_go", version = "0.50.1")
2424

25-
# Documentation site dependencies
25+
# Documentation site dependencies
2626
bazel_dep(name = "aspect_rules_js", version = "2.1.0")
2727
bazel_dep(name = "aspect_rules_ts", version = "3.2.1")
2828

29-
# TinyGo toolchain for WebAssembly components
29+
# TinyGo toolchain for WebAssembly components
3030
bazel_dep(name = "rules_wasm_component", version = "0.1.0")
3131

32-
# Local development override - use local rules_wasm_component
33-
local_path_override(
34-
module_name = "rules_wasm_component",
35-
path = "/Users/r/git/rules_wasm_component",
36-
)
32+
# Local development override - use local rules_wasm_component (disabled for CI)
33+
# local_path_override(
34+
# module_name = "rules_wasm_component",
35+
# path = "/Users/r/git/rules_wasm_component",
36+
# )
3737

3838
# Rust toolchain setup
3939
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
@@ -44,34 +44,28 @@ register_toolchains("@rust_toolchains//:all")
4444

4545
# Rust dependencies
4646
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
47-
4847
crate.spec(
4948
package = "anyhow",
5049
version = "1.0",
5150
)
52-
5351
crate.spec(
52+
features = ["derive"],
5453
package = "serde",
5554
version = "1.0",
56-
features = ["derive"],
5755
)
58-
5956
crate.spec(
6057
package = "serde_json",
6158
version = "1.0",
6259
)
63-
6460
crate.spec(
61+
features = ["component-model"],
6562
package = "wasmtime",
6663
version = "25.0",
67-
features = ["component-model"],
6864
)
69-
7065
crate.spec(
7166
package = "wit-bindgen",
7267
version = "0.30",
7368
)
74-
7569
crate.from_specs()
7670
use_repo(crate, "crates")
7771

@@ -97,4 +91,4 @@ node.npm_translate_lock(
9791
pnpm_lock = "//:pnpm-lock.yaml",
9892
verify_node_modules_ignored = "//:.bazelignore",
9993
)
100-
use_repo(node, "npm")
94+
use_repo(node, "npm")

WORKSPACE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ via WebAssembly components with enhanced security and cross-platform support.
77
workspace(name = "bazel_file_ops_component")
88

99
# This file is maintained for compatibility but all dependencies
10-
# are managed through MODULE.bazel for bzlmod support
10+
# are managed through MODULE.bazel for bzlmod support

buildifier

7.42 MB
Binary file not shown.

testdata/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ filegroup(
2020
filegroup(
2121
name = "integration_configs",
2222
srcs = glob(["integration/*"]),
23-
)
23+
)

testdata/integration_tests.bzl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Integration tests for file operations components"""
22

3-
load("@rules_go//go:def.bzl", "go_test")
43
load("@bazel_skylib//rules:build_test.bzl", "build_test")
4+
load("@rules_go//go:def.bzl", "go_test")
55

6-
def file_ops_integration_tests():
6+
def file_ops_integration_tests(name = "integration_tests"):
77
"""Define integration tests for file operations components"""
8-
8+
99
# Test that TinyGo implementation builds successfully
1010
build_test(
1111
name = "tinygo_component_build_test",
@@ -15,25 +15,25 @@ def file_ops_integration_tests():
1515
],
1616
tags = ["integration", "build"],
1717
)
18-
18+
1919
# Test Rust component build (if it exists)
2020
native.config_setting(
2121
name = "rust_component_exists",
2222
values = {"define": "rust_enabled=true"},
2323
)
24-
24+
2525
build_test(
2626
name = "rust_component_build_test",
2727
targets = select({
2828
":rust_component_exists": [
2929
"//rust:file_ops_rust",
30-
"//rust:file_ops_component_wasm",
30+
"//rust:file_ops_component_wasm",
3131
],
3232
"//conditions:default": ["//tinygo:file_ops_tinygo"], # Fallback
3333
}),
3434
tags = ["integration", "build"],
3535
)
36-
36+
3737
# Go-based integration tests
3838
go_test(
3939
name = "integration_tests",
@@ -50,7 +50,7 @@ def file_ops_integration_tests():
5050
},
5151
tags = ["integration", "manual"], # Manual due to external tool dependencies
5252
)
53-
53+
5454
# Lightweight component functionality test
5555
go_test(
5656
name = "component_functionality_test",
@@ -64,7 +64,7 @@ def file_ops_integration_tests():
6464
},
6565
tags = ["integration"],
6666
)
67-
67+
6868
# JSON batch compatibility test
6969
go_test(
7070
name = "json_batch_compatibility_test",
@@ -78,7 +78,7 @@ def file_ops_integration_tests():
7878
},
7979
tags = ["integration"],
8080
)
81-
81+
8282
# WIT interface consistency test (requires external tools)
8383
go_test(
8484
name = "wit_interface_consistency_test",
@@ -94,7 +94,7 @@ def file_ops_integration_tests():
9494
},
9595
tags = ["integration", "wit", "manual"], # Manual due to wasm-tools dependency
9696
)
97-
97+
9898
# Basic performance test
9999
go_test(
100100
name = "performance_basic_test",
@@ -109,7 +109,7 @@ def file_ops_integration_tests():
109109
tags = ["integration", "performance"],
110110
timeout = "moderate", # Allow more time for performance tests
111111
)
112-
112+
113113
# Test suite combining all integration tests
114114
native.test_suite(
115115
name = "integration_test_suite",
@@ -121,18 +121,18 @@ def file_ops_integration_tests():
121121
],
122122
tags = ["integration"],
123123
)
124-
124+
125125
# Extended test suite including manual tests (for CI)
126126
native.test_suite(
127127
name = "integration_test_suite_full",
128128
tests = [
129129
":tinygo_component_build_test",
130130
":rust_component_build_test",
131131
":integration_tests",
132-
":component_functionality_test",
132+
":component_functionality_test",
133133
":json_batch_compatibility_test",
134134
":wit_interface_consistency_test",
135135
":performance_basic_test",
136136
],
137137
tags = ["integration", "full"],
138-
)
138+
)

tinygo/BUILD.bazel

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ go_library(
1616
name = "file_ops_lib",
1717
srcs = [
1818
"json_bridge.go",
19-
"operations.go",
19+
"operations.go",
2020
"security.go",
2121
"workspace.go",
2222
],
@@ -30,67 +30,59 @@ go_library(
3030
go_binary(
3131
name = "file_ops_cli",
3232
srcs = ["main.go"],
33-
deps = [":file_ops_lib"],
33+
goarch = "amd64",
3434
# Build for host platform for testing
3535
goos = "linux",
36-
goarch = "amd64",
36+
deps = [":file_ops_lib"],
3737
)
3838

3939
# TinyGo WebAssembly Component
4040
go_wasm_component(
4141
name = "file_ops_component",
4242
srcs = [
43+
"json_bridge.go",
4344
"main.go",
44-
"json_bridge.go",
4545
"operations.go",
4646
"security.go",
47-
"workspace.go",
4847
"wit_bindings.go",
48+
"workspace.go",
4949
],
5050
go_mod = "go.mod",
51-
wit = "//wit:file-operations",
52-
world = "file-operations-world",
5351
optimization = "release",
5452
tags = ["manual"], # Build explicitly for WASM
53+
wit = "//wit:file-operations",
54+
world = "file-operations-world",
5555
)
5656

5757
# Test suite
5858
go_test(
5959
name = "file_ops_test",
6060
srcs = [
61-
"operations_test.go",
6261
"json_bridge_test.go",
62+
"operations_test.go",
6363
"security_test.go",
6464
"workspace_test.go",
6565
],
66-
deps = [
67-
":file_ops_lib",
68-
"@org_golang_x_testing//fstest",
69-
],
7066
data = [
7167
"//testdata:test_configs",
7268
"//testdata:test_files",
7369
],
70+
deps = [
71+
":file_ops_lib",
72+
"@org_golang_x_testing//fstest",
73+
],
7474
)
7575

7676
# Integration tests with WASM component
77-
sh_test(
78-
name = "integration_test",
79-
srcs = ["integration_test.sh"],
80-
data = [
81-
":file_ops_component",
82-
"//testdata:integration_configs",
83-
],
84-
tags = ["integration"],
85-
)
77+
# Note: sh_test is deprecated, replaced with Go-based integration tests in //testdata:integration_tests
8678

8779
# Performance benchmarks
8880
go_test(
8981
name = "benchmark_test",
90-
srcs = ["benchmark_test.go"],
91-
deps = [":file_ops_lib"],
82+
srcs = ["benchmark_test.go"],
9283
args = ["-bench=."],
9384
tags = ["benchmark"],
85+
deps = [":file_ops_lib"],
9486
)
9587

9688
# Generate signing keys for component security
@@ -104,28 +96,28 @@ wasm_keygen(
10496
wasm_sign(
10597
name = "file_ops_component_signed",
10698
component = ":file_ops_component",
107-
keys = ":component_signing_keys",
10899
detached = False, # Embed signature in component
100+
keys = ":component_signing_keys",
109101
tags = ["manual"],
110102
)
111103

112104
# Verify component signature
113105
wasm_verify(
114106
name = "verify_file_ops_signature",
115-
signed_component = ":file_ops_component_signed",
116107
keys = ":component_signing_keys",
108+
signed_component = ":file_ops_component_signed",
117109
tags = ["manual"],
118110
)
119111

120112
# Create signed OCI image for registry publishing
121113
wasm_component_signed_oci_image(
122114
name = "file_ops_oci_signed",
115+
package_name = "bazel-file-ops-component-tinygo",
123116
component = ":file_ops_component",
124-
sign_component = True,
125117
component_signing_keys = ":component_signing_keys",
126-
registry = "ghcr.io",
127118
namespace = "pulseengine",
128-
package_name = "bazel-file-ops-component-tinygo",
119+
registry = "ghcr.io",
120+
sign_component = True,
129121
tags = ["manual"],
130122
)
131123

@@ -137,7 +129,7 @@ alias(
137129
)
138130

139131
alias(
140-
name = "file_ops_tinygo",
132+
name = "file_ops_tinygo",
141133
actual = ":file_ops_component",
142134
visibility = ["//visibility:public"],
143135
)
@@ -153,4 +145,4 @@ alias(
153145
name = "file_ops_signed",
154146
actual = ":file_ops_component_signed",
155147
visibility = ["//visibility:public"],
156-
)
148+
)

wit/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ genrule(
3232
echo '```' >> $@
3333
""",
3434
visibility = ["//docs-site:__pkg__"],
35-
)
35+
)

0 commit comments

Comments
 (0)