Commit fa96218
authored
Fix wasm staticlib extensions (bazelbuild#3968)
`rust_static_library` targets fail for wasm-style platform mappings
whose `staticlib_ext` is empty.
This became visible after
bazelbuild#3864 changed the allocator
shim target to use `rust_static_library`. When building that target for
the wasm platform, rules_rust computes:
```
crate_type = "staticlib"
staticlib_ext = ""
```
`determine_lib_name` treats the empty extension as invalid and fails
with:
```
Unknown crate_type: staticlib
```
Static library outputs for these wasm/WASI-style targets should use
archive output names, e.g. libfoo.a. Binary and dylib outputs can
continue using .wasm.
This updates the wasm-style staticlib mappings to .a for:
- threads
- unknown
- wasi
- wasip1
- wasip2
This is easily reproducible from the rules_rust repository, before this
change:
```
bazel build --platforms=//rust/platform:wasm32 //ffi/rs/allocator_library:allocator_library
```
fails during analysis with:
```
Unknown crate_type: staticlib
```
closes bazelbuild#38941 parent 278d31e commit fa96218
2 files changed
Lines changed: 24 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
155 | 168 | | |
156 | 169 | | |
157 | 170 | | |
158 | 171 | | |
| 172 | + | |
159 | 173 | | |
160 | 174 | | |
161 | 175 | | |
| |||
176 | 190 | | |
177 | 191 | | |
178 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
179 | 196 | | |
180 | 197 | | |
181 | 198 | | |
| |||
184 | 201 | | |
185 | 202 | | |
186 | 203 | | |
| 204 | + | |
187 | 205 | | |
188 | 206 | | |
189 | 207 | | |
0 commit comments