|
| 1 | +load("@bazel_skylib//rules:build_test.bzl", "build_test") |
| 2 | +load(":transitions.bzl", "wasm_file", "wasi_file") |
| 3 | + |
| 4 | +# config_setting( |
| 5 | +# name = "no_shared_objects", |
| 6 | +# values = { |
| 7 | +# "features": "-supports_dynamic_linker", |
| 8 | +# } |
| 9 | +# ) |
| 10 | + |
| 11 | +# cc_library( |
| 12 | +# name = "stdlib-wasm", |
| 13 | +# srcs = ["stdlib.cc"], |
| 14 | +# hdrs = ["stdlib.h"], |
| 15 | +# features = [ |
| 16 | +# "-supports_dynamic_linker", |
| 17 | +# ], |
| 18 | +# target_compatible_with = [ |
| 19 | +# "@platforms//cpu:wasm32", |
| 20 | +# "@platforms//os:wasi", |
| 21 | +# ], |
| 22 | +# ) |
| 23 | + |
| 24 | +# TODO: add a rule that transitions --platforms to `//test:wasm` to ensure that |
| 25 | +# toolchain resolution picks `@llvm_toolchain//:cc-clang-*_wasm32-unknown-unknown`. |
| 26 | +# |
| 27 | +# also have it set `--features=-supports_dynamic_linker`; ideally this would be in |
| 28 | +# the toolchain definition but the downside of switching to using |
| 29 | +# `unix_cc_toolchain_config.bzl` is that we lose this knob |
| 30 | +# |
| 31 | +# it's not clear yet if supporting different targets runs counter to using |
| 32 | +# `unix_cc_toolchain_config.bzl` altogether – so far things are manageable but |
| 33 | +# it's already apparent that we'll be sacrificing some power/configurability |
| 34 | + |
| 35 | +############################################################################### |
| 36 | + |
| 37 | +platform( |
| 38 | + name = "wasm", |
| 39 | + constraint_values = [ |
| 40 | + "@platforms//cpu:wasm32", |
| 41 | + "@platforms//os:none", |
| 42 | + ], |
| 43 | +) |
| 44 | + |
| 45 | +wasm_file( |
| 46 | + name = "test.wasm", |
| 47 | + src = "//tests:simple_binary", |
| 48 | +) |
| 49 | + |
| 50 | +build_test( |
| 51 | + name = "wasm_build_chk", |
| 52 | + targets = [":test.wasm"], |
| 53 | +) |
| 54 | + |
| 55 | +############################################################################### |
| 56 | + |
| 57 | +platform( |
| 58 | + name = "wasi", |
| 59 | + constraint_values = [ |
| 60 | + "@platforms//cpu:wasm32", |
| 61 | + "@platforms//os:wasi", |
| 62 | + ], |
| 63 | +) |
| 64 | + |
| 65 | +wasi_file( |
| 66 | + name = "test.wasi", |
| 67 | + src = "//tests:stdlib_binary", |
| 68 | +) |
| 69 | + |
| 70 | +build_test( |
| 71 | + name = "wasi_build_chk", |
| 72 | + targets = [":test.wasi"], |
| 73 | +) |
0 commit comments