{"id":20589665,"url":"https://github.com/coreos/cargo-vendor-filterer","last_synced_at":"2025-04-05T15:04:03.108Z","repository":{"id":37085596,"uuid":"503887619","full_name":"coreos/cargo-vendor-filterer","owner":"coreos","description":"Tool to `cargo vendor` with filtering","archived":false,"fork":false,"pushed_at":"2025-02-21T15:23:06.000Z","size":207,"stargazers_count":42,"open_issues_count":13,"forks_count":10,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T14:05:54.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-15T18:54:46.000Z","updated_at":"2025-02-21T15:23:11.000Z","dependencies_parsed_at":"2024-03-15T14:29:03.828Z","dependency_job_id":"e6a8fd98-dc2a-4b74-bf45-962f739f75c5","html_url":"https://github.com/coreos/cargo-vendor-filterer","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcargo-vendor-filterer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcargo-vendor-filterer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcargo-vendor-filterer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fcargo-vendor-filterer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreos","download_url":"https://codeload.github.com/coreos/cargo-vendor-filterer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353729,"owners_count":20925329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T07:30:21.219Z","updated_at":"2025-04-05T15:04:03.089Z","avatar_url":"https://github.com/coreos.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cargo vendor`, but with filtering\n\nThe core `cargo vendor` tool is useful to save all dependencies.\nHowever, it doesn't offer any filtering; today cargo includes\nall platforms, but some projects only care about Linux\nfor example.\n\nMore information: \u003chttps://github.com/rust-lang/cargo/issues/7058\u003e\n\nAdditionally some projects are not interested by vendoring test code\nor development dependencies of used crates and these filters\nare also not supported with no development planned yet.\n\nMore information: \u003chttps://github.com/rust-lang/cargo/issues/13474\u003e\nor \u003chttps://github.com/rust-lang/cargo/issues/7065\u003e\n\n## Generating a vendor/ directory with filtering\n\nHere's a basic example which filters out all crates that don't target Linux;\nfor example this will drop out crates like `winapi-x86_64-pc-windows-gnu` and\n`core-foundation` that are Windows or MacOS only.\n\n```sh\n$ cargo vendor-filterer --platform=x86_64-unknown-linux-gnu\n```\n\nYou may instead want to filter by tiers:\n\n```sh\n$ cargo vendor-filterer --tier=2\n```\n\nCurrently this will drop out crates such as `redox_syscall`.\n\nYou can also declaratively specify the desired vendor configuration via the [Cargo metadata](https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table)\nkey `package.metadata.vendor-filter`.  In this example, we include only tier 1 and 2 Linux platforms, and additionally remove some vendored C sources, `tests` folders\nand development dependencies from all crates:\n\n```toml\n[package.metadata.vendor-filter]\nplatforms = [\"*-unknown-linux-gnu\"]\ntier = \"2\"\nall-features = true\nkeep-dep-kinds = \"no-dev\"\nexclude-crate-paths = [ { name = \"curl-sys\", exclude = \"curl\" },\n                        { name = \"libz-sys\", exclude = \"src/zlib\" },\n                        { name = \"libz-sys\", exclude = \"src/smoke.c\" },\n                        { name = \"libz-sys\", exclude = \"src/zlib-ng\" },\n                        { name = \"*\", exclude = \"tests\" },\n                      ]\n```\n\nFor workspaces, use the corresponding [workspace metadata](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-metadata-table)\nkey `workspace.metadata.vendor-filter`.\n\n### Available options for for `package.metadata.vendor-filter` in Cargo.toml\n\n- `platforms`: List of rustc target triples; this is the same values accepted by\n  e.g. `cargo metadata --filter-platform`.  You can specify multiple values,\n  and `*` wildcards are supported.  For example, `*-unknown-linux-gnu`.\n- `tier`: This can be either \"1\" or \"2\".  It may be specified in addition to `platforms`.\n- `all-features`: Enable all features of the current crate when vendoring.\n- `keep-dep-kinds`: Specify which dependencies kinds to keep.\n  Can be one of: all, normal, build, dev, no-normal, no-build, no-dev\n- `exclude-crate-paths`: Remove files and directories from target crates.  A key\n  use case for this is removing the vendored copy of C libraries embedded in\n  crates like `libz-sys`, when you only want to support dynamically linking.\n  `*` wildcard removes the folder from all creates (typical use case for `tests` folder).\n\nAll of these options have corresponding CLI flags; see `cargo vendor-filterer --help`.\n\n## Generating reproducible vendor tarballs\n\nYou can also provide `--format=tar.zstd` to output a reproducible tar archive\ncompressed via zstd; the default filename will be `vendor.tar.zstd`.  Similarly\nthere is `--format=tar.gz` for gzip, and `--format=tar` to output an uncompressed tar archive, which you\ncan compress however you like.  It's also strongly recommended to use `--prefix=vendor`\nwhich has less surprising behavior when unpacked in e.g. a home directory.  For example,\n`--prefix=vendor --format=tar.zstd` together.\n\nThis option requires `SOURCE_DATE_EPOCH` set in the environment, or an external `git` and the working directory must be a git repository.\n\nWith `--format=tar.zstd`, this currently requires an external `zstd` binary.\n\nThis uses the suggested logic from https://reproducible-builds.org/docs/archives/\nto output a reproducible archive; in other words, another process/tool\ncan also perform a `git clone` of your project and regenerate the vendor\ntarball using the same version of `cargo vendor-filterer` to verify it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreos%2Fcargo-vendor-filterer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreos%2Fcargo-vendor-filterer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreos%2Fcargo-vendor-filterer/lists"}