Skip to content

Commit c7e5ebe

Browse files
committed
feat(wit): implement Bazel-native external WIT dependency resolution
Add comprehensive support for managing external WebAssembly Interface Type (WIT) dependencies using Bazel's http_archive and module extension system, eliminating the need for shell scripts or external package managers like wit-deps. **Key Features:** - WASI WIT interfaces available via @wasi_io//:streams and new module extension - Bazel-native http_archive rules for external WIT packages with SHA256 verification - Cross-platform, hermetic dependency management following project's Bazel-first principles - Comprehensive documentation with examples and migration guidance **Technical Changes:** - Added wit/wasi_deps.bzl with WASI interface definitions (wasi:[email protected]) - Created wasi_wit module extension in wasm/extensions.bzl for dependency loading - Updated MODULE.bazel to enable WASI WIT dependencies via extension - Fixed Go component examples to use correct WIT worlds and dependencies - Re-enabled //examples/go_component/... targets in CI (removed exclusions) **Documentation:** - Created comprehensive External WIT Dependencies guide (/guides/external-wit-dependencies.mdx) - Added external dependency examples to wit_library rule reference - Updated toolchain configuration guide with WIT dependencies quick reference - Provided practical examples for custom, organization-wide, and WASI dependencies **Fixes:** - Resolves GitHub issue #17: Go component WIT dependency resolution issues - Fixes "package 'wasi:[email protected]' not found" errors in wit-bindgen markdown generation - Enables successful documentation generation for Go components using WASI interfaces **Testing:** - Go component examples now build and generate documentation successfully - All dependencies use proper version matching (0.2.6) between imports and packages - CI builds include Go component targets without exclusions
1 parent c69df96 commit c7e5ebe

File tree

18 files changed

+949
-47
lines changed

18 files changed

+949
-47
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
echo "Publishing test components to localhost:5001 registry..."
8989
bazel run //examples/simple_oci_test:publish_greeting
9090
bazel run //examples/simple_oci_test:publish_calculator
91-
91+
9292
# Verify components are available
9393
echo "Verifying registry contents..."
9494
curl -s http://localhost:5001/v2/_catalog || echo "Registry catalog request failed"
@@ -102,8 +102,6 @@ jobs:
102102
-//examples/multi_profile/... \
103103
-//examples/cpp_component/... \
104104
-//examples/js_component/... \
105-
-//examples/go_component/... \
106-
-//examples/go_component:calculator_docs \
107105
-//examples/wac_remote_compose/... \
108106
-//examples/wac_oci_composition/... \
109107
-//examples/wkg_integration/... \
@@ -213,14 +211,12 @@ jobs:
213211
else
214212
EXTRA_EXCLUDES=""
215213
fi
216-
214+
217215
bazel build -- //... \
218216
-//examples/world_export/... \
219217
-//examples/multi_profile/... \
220218
-//examples/cpp_component/... \
221219
-//examples/js_component/... \
222-
-//examples/go_component/... \
223-
-//examples/go_component:calculator_docs \
224220
-//examples/wac_remote_compose/... \
225221
-//examples/wac_oci_composition/... \
226222
-//examples/wkg_integration/... \

MODULE.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ use_repo(go_sdk, "go_toolchains")
5656

5757
register_toolchains("@go_toolchains//:all")
5858

59+
# WASI WIT interface definitions
60+
wasi_wit_ext = use_extension("//wasm:extensions.bzl", "wasi_wit")
61+
wasi_wit_ext.init()
62+
use_repo(wasi_wit_ext, "wasi_io") # Add your external repos here: , "my_external_wit"
63+
5964
# WebAssembly toolchains
6065
wasm_toolchain = use_extension("//wasm:extensions.bzl", "wasm_toolchain")
6166
wasm_toolchain.register(

MODULE.bazel.lock

Lines changed: 104 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)