Runfiles for `rust_wasm_bindgen` targets

未关闭
#4,172 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
rust, wasm

调研方向

从 rust_wasm_bindgen 规则及其 wasm_file 目标开始,使用提供的 tar 示例来了解预期的构件布局。调查底层 rust_binary 的 runfiles 是如何生成的,以及生成的应用是如何打包的。当示例可以在 tar 中包含 app.runfiles/,而不需要含义不明确的可执行入口点时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

wasm

Currently, rust_wasm_bindgen doesn't include runfiles of the underlying wasm_file target which in some cases is a rust_binary that uses the runfiles API as the common way to look up data files at runtime. For example:

load("@tar.bzl", "tar")
load("@rules_rust_wasm_bindgen//:defs.bzl", "rust_wasm_bindgen")

rust_wasm_bindgen(
    name = "app",
    target = "web",
    wasm_file = "//:app",
)

tar(
    name = "archive",
    srcs = [
        "index.html",
        ":app",
    ],
    include_runfiles = True,
)

Currently app is only the generated web files from wasm-bindgen and the .wasm file itself but there is no runfiles tree rendered next to it. I believe this is because rust_wasm_bindgen is not executable and therefore no runfiles tree is created. It would be easy to convert this to an executable but it's unclear what the "entrypoint" would be or if this makes sense semantically as the wasm file nor any of the javascript is directly executable. It would be nice though to have a way to author something like the example and have app.runfiles/ in the tar.

主要语言
Starlark
星标
857
派生
701
平均合并
4 天 7 小时
30 天内合并 PR
46

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bazelbuild/rules_rust 的其他 Issue

查看 bazelbuild/rules_rust 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。