Files
zed/tooling/xtask/src/main.rs
T
Piotr Osiewicz 5287b59b30 build: Allow pinning of webrtc build artifacts (✈️ edition) (#55336)
tl;dr: you can now run `cargo xtask setup_webrtc`, which:
1. Fetches webrtc artifacts into a gitignored directory in Zed repo
2. Adds a [env] section to `~/.cargo/config.toml` on your box which
forces
   LK to NOT download webrtc artifacts as a part of its build script

The end result: `cargo clean` is no longer a horrid experience with in
horrid network environments.

Caveats:
1. This does not handle appending to existing cargo config. The setup
   script will fail if there's one in place.
2. You need to redo this thing (fetch env var and whatnot) whenever LK
   version is bumped.
3. This is not mandatory for builds to work. You only really have to do
this for your own convenience, but builds will work just fine without it
(unless your connection sucks).

Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-05-04 06:22:51 +00:00

49 lines
1.8 KiB
Rust

mod tasks;
mod workspace;
use anyhow::Result;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "cargo xtask")]
struct Args {
#[command(subcommand)]
command: CliCommand,
}
#[derive(Subcommand)]
enum CliCommand {
/// Runs `cargo clippy`.
Clippy(tasks::clippy::ClippyArgs),
Compliance(tasks::compliance::ComplianceArgs),
Licenses(tasks::licenses::LicensesArgs),
/// Checks that packages conform to a set of standards.
PackageConformity(tasks::package_conformity::PackageConformityArgs),
/// Publishes GPUI and its dependencies to crates.io.
PublishGpui(tasks::publish_gpui::PublishGpuiArgs),
/// Downloads the pinned `webrtc-sys` release and configures `LK_CUSTOM_WEBRTC`.
SetupWebrtc(tasks::setup_webrtc::SetupWebrtcArgs),
/// Builds GPUI web examples and serves them.
WebExamples(tasks::web_examples::WebExamplesArgs),
Workflows(tasks::workflows::GenerateWorkflowArgs),
CheckWorkflows(tasks::workflow_checks::WorkflowValidationArgs),
}
fn main() -> Result<()> {
let args = Args::parse();
match args.command {
CliCommand::Clippy(args) => tasks::clippy::run_clippy(args),
CliCommand::Compliance(args) => tasks::compliance::check_compliance(args),
CliCommand::Licenses(args) => tasks::licenses::run_licenses(args),
CliCommand::PackageConformity(args) => {
tasks::package_conformity::run_package_conformity(args)
}
CliCommand::PublishGpui(args) => tasks::publish_gpui::run_publish_gpui(args),
CliCommand::SetupWebrtc(args) => tasks::setup_webrtc::run_setup_webrtc(args),
CliCommand::WebExamples(args) => tasks::web_examples::run_web_examples(args),
CliCommand::Workflows(args) => tasks::workflows::run_workflows(args),
CliCommand::CheckWorkflows(args) => tasks::workflow_checks::validate(args),
}
}