limrun-xcode-bazel
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBazel iOS builds on Limrun RBE
在Limrun RBE上进行Bazel iOS构建
Build Bazel Apple projects on Limrun's remote Mac workers — from any environment
(Linux, Windows, macOS, VM, container), no local Xcode. brings up
a remote RBE stack, tunnels it to a local port, and writes a config so
runs Apple actions remotely. Never fall back to
local Xcode or build tools.
lim xcode rbe.limrun/bazelisk build --config=limrun在Limrun的远程Mac工作节点上构建Bazel Apple项目——支持任意环境(Linux、Windows、macOS、虚拟机、容器),无需本地Xcode。会启动一个远程RBE栈,将其隧道连接到本地端口,并生成配置文件,使能够远程执行Apple相关构建操作。无需回退到本地Xcode或构建工具。
lim xcode rbe.limrun/bazelisk build --config=limrunAuth and CLI
认证与CLI
Install if needed: . Auth is or
(may be set outside the project — don't ask for it just because
it's absent). The CLI is the source of truth: the commands in this skill are
verified, but if a flag errors or you need one not shown here, check
instead of guessing.
npm install --global limlim loginLIM_API_KEYlim xcode rbe --help如需安装,请执行:。认证方式为或设置(可在项目外部设置,无需因缺失而询问用户)。CLI是权威来源:本技能中的命令均已验证,但如果某个标记报错或需要此处未展示的标记,请查看,不要自行猜测。
npm install --global limlim loginLIM_API_KEYlim xcode rbe --helpBuild
构建步骤
- From the Bazel workspace root (has /
MODULE.bazel), runWORKSPACE. It sets up the instance +lim xcode rbeconfig and prints the exact build command. The tunnel runs in the background (prints a PID);.limrun/keeps it foreground.--no-daemon - Run the printed command, e.g.
.
bazelisk --digest_function=sha256 build --config=limrun //App
Don't hand-write or the flags — the CLI generates them for the fleet's
Xcode and your OS. Re-run (after ) to refresh after a
fleet Xcode upgrade.
.limrun/lim xcode rbe--stopTo add your own Bazel flags to the limrun path without editing the generated
config, put them in at the workspace root. The
generated config try-imports it last, so your lines win, and
it survives regeneration ( does not).
user.limrun.bazelrcbuild:limrun --…lim xcode rbe.limrun/- 从Bazel工作区根目录(包含/
MODULE.bazel)运行WORKSPACE。它会设置实例和lim xcode rbe配置文件,并打印出确切的构建命令。隧道将在后台运行(会打印PID);使用.limrun/参数可使其在前台运行。--no-daemon - 运行打印出的命令,例如:。
bazelisk --digest_function=sha256 build --config=limrun //App
请勿手动编写配置或标记——CLI会根据集群的Xcode版本和你的操作系统自动生成。集群Xcode升级后,重新运行(先执行)即可刷新配置。
.limrun/lim xcode rbe--stop若要在不编辑生成的配置的情况下,向limrun路径添加自定义Bazel标记,请在工作区根目录创建****文件。生成的配置会最后尝试导入该文件,因此你在其中添加的行将生效,且该文件不会因重新生成而被覆盖(则会被覆盖)。
user.limrun.bazelrcbuild:limrun --…lim xcode rbe.limrun/Run on a simulator
在模拟器上运行
lim xcode rbebash
lim xcode get # is a simulator already attached?
lim ios create --attach # attach oneIf the attach output includes a signed stream URL, share it with the user as a
Markdown link, such as Live simulator.
With a simulator attached, every successful build automatically
reinstalls and relaunches the app, no separate install step:
--config=limrunbash
bazelisk --digest_function=sha256 build --config=limrun //AppNotes:
- Attach upfront if you already know you want a sim: (attaches at startup, removed on
lim xcode rbe --ios).--stop - Auto-install happens server-side from the build's events; there is no
subcommand or
lim xcode rbe installflag. To force a reinstall, rebuild (a cache-hit rebuild is seconds).--target - It fires when the successful invocation produced a single app, so in a
multi-app workspace build one app target per invocation (, not
//App); a multi-app build succeeds but installs nothing.//...
To tap, type, read the element tree, screenshot, or record the running app,
switch to the skill.
limrun-ios-simulatorlim xcode rbebash
lim xcode get # 是否已连接模拟器?
lim ios create --attach # 连接一个模拟器如果连接输出包含已签名的流URL,请将其以Markdown链接形式分享给用户,例如:实时模拟器。
连接模拟器后,每次成功执行构建都会自动重新安装并重启应用,无需单独的安装步骤:
--config=limrunbash
bazelisk --digest_function=sha256 build --config=limrun //App注意事项:
- 若已知需要模拟器,请提前连接:执行(启动时连接,执行
lim xcode rbe --ios时断开)。--stop - 自动安装在服务器端通过构建事件完成;没有子命令或
lim xcode rbe install标记。若要强制重新安装,请重新构建(缓存命中的重建仅需数秒)。--target - 只有当成功的构建生成单个应用时,自动安装才会触发,因此在多应用工作区中,每次构建请指定一个应用目标(如,而非
//App);多应用构建会成功,但不会安装任何应用。//...
若要对运行中的应用进行点击、输入、读取元素树、截图或录制操作,请切换至****技能。
limrun-ios-simulatorUpload builds as assets
将构建产物上传为资产
To publish a build as a Limrun asset (preview links, installing on other
simulators, CI artifacts), arm uploads at tunnel start or upload one build
after the fact:
bash
lim xcode rbe --auto-upload preview/my-app --upload-ttl 24h # every successful build refreshes the asset
lim xcode rbe upload preview/my-app --ttl 24h # one-shot: the newest successful build- holds for the tunnel's lifetime: each successful
--auto-uploadbuild re-uploads the app under that asset name, no post-build step. Upload results land in--config=limrun..limrun/rbe.log - runs from the workspace root and needs a background tunnel plus at least one successful build; it errors otherwise.
rbe upload - TTLs are Go durations (,
24h;30mis invalid) and optional.1d - To change the config of a running tunnel,
--auto-uploadand re-run; the CLI refuses a mismatched re-arm instead of silently ignoring it.--stop - Preview an uploaded app in a browser at
.
https://console.limrun.com/preview?asset=<name>&platform=ios
若要将构建产物发布为Limrun资产(预览链接、在其他模拟器上安装、CI工件),可在隧道启动时设置自动上传,或在构建完成后上传:
bash
lim xcode rbe --auto-upload preview/my-app --upload-ttl 24h # 每次成功构建都会刷新该资产
lim xcode rbe upload preview/my-app --ttl 24h # 单次上传:最新的成功构建产物- 在隧道运行期间有效:每次成功执行
--auto-upload构建都会将应用重新上传至指定资产名称下,无需构建后步骤。上传结果会保存到--config=limrun中。.limrun/rbe.log - 需从工作区根目录运行,且需要后台隧道和至少一次成功构建;否则会报错。
rbe upload - TTL为Go语言格式的时长(如、
24h;30m无效),为可选参数。1d - 若要更改运行中隧道的配置,请先执行
--auto-upload再重新运行;CLI会拒绝不匹配的重新配置,而非静默忽略。--stop - 可在浏览器中通过以下链接预览已上传的应用:。
https://console.limrun.com/preview?asset=<name>&platform=ios
Teardown
清理操作
Stop with (~20s to tear the remote stack down) and delete the instance with
lim xcode rbe --stoplim xcode delete <id>执行**停止服务(约20秒拆除远程栈),并执行**删除实例。
lim xcode rbe --stoplim xcode delete <id>Gotchas
常见问题
- Always pass before
--digest_function=sha256(use the command the CLI prints verbatim). The Limrun cache is SHA256-only; Bazel 9 defaults to BLAKE3. It's a startup flag, so it can't live inbuild. Symptoms: build →--config=limrun; install →Cannot use hash function BLAKE3 with remote cache.non-SHA256 digest … rebuild with --digest_function=sha256 - Run from the workspace root, not a subdirectory — it writes
lim xcode rbethere and fails fast otherwise..limrun/ - A green build doesn't prove remote execution — cache hits (/
action cache hit) make builds pass even with the tunnel gone. To force and verify real remote execution, seeremote cache hit.references/verify-remote.md - The printed path won't exist on your machine — the build command carries
.ipa, which keeps the artifact in the instance's cache and downloads nothing. Bazel still prints its usual--remote_download_outputs=minimalline, but that file is not on disk. This is expected, not a failed build. With a simulator attached, the build auto-installs from the artifact's cache digest (read from the build event log, not the local file). Only if you genuinely need theTarget //App:App up-to-date: …/App.ipalocally, drop.ipafrom the build command and Bazel downloads the top-level output; auto-install keeps working either way.--remote_download_outputs=minimal - A fresh instance can fail the first build with (e.g.
Lost inputs no longer available remotely). It's a transient cache eviction between instances, not a code error; Bazel prints… Assets.carand the retry succeeds. To avoid hitting it mid-demo, pre-warm with a full build right afterFound transient remote cache error, retrying the build....lim xcode rbe - (actool/ibtool) is a fleet-side device gap, not your config. Retry; if it persists, report it to Limrun.
You don't have permission to save … in "CoreSimulator" - The project's own Bazel settings can fight RBE (Xcode pinned via a Starlark
transition, custom , sandbox-hostile genrules). These are per-project, not Limrun bugs — walk
remote_default_exec_propertiesbefore concluding RBE is broken.references/project-compatibility.md
- 务必在前传递
build参数(使用CLI打印的完整命令)。Limrun缓存仅支持SHA256;Bazel 9默认使用BLAKE3。这是一个启动参数,因此无法在--digest_function=sha256中设置。症状:构建时提示--config=limrun;安装时提示Cannot use hash function BLAKE3 with remote cache。non-SHA256 digest … rebuild with --digest_function=sha256 - 请从工作区根目录运行,不要从子目录运行——它会在根目录写入
lim xcode rbe,否则会立即失败。.limrun/ - 构建成功并不代表已执行远程构建——缓存命中(/
action cache hit)会使构建即使在隧道断开的情况下也能通过。若要强制并验证真正的远程执行,请查看remote cache hit。references/verify-remote.md - 打印的路径在你的机器上不存在——构建命令包含
.ipa,该参数会将工件保留在实例缓存中,不会下载到本地。Bazel仍会打印常规的--remote_download_outputs=minimal行,但该文件并未存储在本地磁盘上。这是预期行为,并非构建失败。连接模拟器后,构建会通过工件的缓存摘要(从构建事件日志读取,而非本地文件)自动安装应用。只有当确实需要本地Target //App:App up-to-date: …/App.ipa文件时,才从构建命令中移除.ipa参数,Bazel会下载顶级输出文件;无论是否移除该参数,自动安装功能均正常工作。--remote_download_outputs=minimal - 新实例首次构建可能会因失败(例如
Lost inputs no longer available remotely)。这是实例间的临时缓存回收问题,并非代码错误;Bazel会打印… Assets.car,重试后即可成功。若要避免在演示中遇到此问题,请在Found transient remote cache error, retrying the build...执行完成后立即进行一次完整构建以预热缓存。lim xcode rbe - (actool/ibtool报错)是集群端的设备间隙问题,与你的配置无关。请重试;若问题持续,请向Limrun报告。
You don't have permission to save … in "CoreSimulator" - 项目自身的Bazel设置可能与RBE冲突(通过Starlark过渡固定Xcode、自定义、不兼容沙箱的genrules)。这些是项目特有的问题,并非Limrun的bug——在判定RBE故障前,请先查看
remote_default_exec_properties。",references/project-compatibility.md