fork/cargo
git clone https://git.julia.blue/fork/cargo
d54c5d404
0.87.0
1CARGO-PACKAGE(1) 2 3NAME 4 cargo-package — Assemble the local package into a distributable 5 tarball 6 7SYNOPSIS 8 cargo package [options] 9 10DESCRIPTION 11 This command will create a distributable, compressed .crate file with 12 the source code of the package in the current directory. The resulting 13 file will be stored in the target/package directory. This performs the 14 following steps: 15 16 1. Load and check the current workspace, performing some basic checks. 17 18 o Path dependencies are not allowed unless they have a version key. 19 Cargo will ignore the path key for dependencies in published 20 packages. dev-dependencies do not have this restriction. 21 22 2. Create the compressed .crate file. 23 24 o The original Cargo.toml file is rewritten and normalized. 25 26 o [patch], [replace], and [workspace] sections are removed from the 27 manifest. 28 29 o Cargo.lock is always included. When missing, a new lock file will 30 be generated. cargo-install(1) will use the packaged lock file if 31 the --locked flag is used. 32 33 o A .cargo_vcs_info.json file is included that contains information 34 about the current VCS checkout hash if available, as well as a 35 flag if the worktree is dirty. 36 37 o Symlinks are flattened to their target files. 38 39 o Files and directories are included or excluded based on rules 40 mentioned in the [include] and [exclude] fields 41 <https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields>. 42 43 3. Extract the .crate file and build it to verify it can build. 44 45 o This will rebuild your package from scratch to ensure that it can 46 be built from a pristine state. The --no-verify flag can be used 47 to skip this step. 48 49 4. Check that build scripts did not modify any source files. 50 51 The list of files included can be controlled with the include and 52 exclude fields in the manifest. 53 54 See the reference 55 <https://doc.rust-lang.org/cargo/reference/publishing.html> for more 56 details about packaging and publishing. 57 58 .cargo_vcs_info.json format 59 Will generate a .cargo_vcs_info.json in the following format 60 61 { 62 "git": { 63 "sha1": "aac20b6e7e543e6dd4118b246c77225e3a3a1302", 64 "dirty": true 65 }, 66 "path_in_vcs": "" 67 } 68 69 dirty indicates that the Git worktree was dirty when the package was 70 built. 71 72 path_in_vcs will be set to a repo-relative path for packages in 73 subdirectories of the version control repository. 74 75 The compatibility of this file is maintained under the same policy as 76 the JSON output of cargo-metadata(1). 77 78 Note that this file provides a best-effort snapshot of the VCS 79 information. However, the provenance of the package is not verified. 80 There is no guarantee that the source code in the tarball matches the 81 VCS information. 82 83OPTIONS 84 Package Options 85 -l, --list 86 Print files included in a package without making one. 87 88 --no-verify 89 Don’t verify the contents by building them. 90 91 --no-metadata 92 Ignore warnings about a lack of human-usable metadata (such as the 93 description or the license). 94 95 --allow-dirty 96 Allow working directories with uncommitted VCS changes to be 97 packaged. 98 99 --index index 100 The URL of the registry index to use. 101 102 --registry registry 103 Name of the registry to package for; see cargo publish --help for 104 more details about configuration of registry names. The packages 105 will not be published to this registry, but if we are packaging 106 multiple inter-dependent crates, lock-files will be generated under 107 the assumption that dependencies will be published to this registry. 108 109 Package Selection 110 By default, when no package selection options are given, the packages 111 selected depend on the selected manifest file (based on the current 112 working directory if --manifest-path is not given). If the manifest is 113 the root of a workspace then the workspaces default members are 114 selected, otherwise only the package defined by the manifest will be 115 selected. 116 117 The default members of a workspace can be set explicitly with the 118 workspace.default-members key in the root manifest. If this is not set, 119 a virtual workspace will include all workspace members (equivalent to 120 passing --workspace), and a non-virtual workspace will include only the 121 root crate itself. 122 123 -p spec…, --package spec… 124 Package only the specified packages. See cargo-pkgid(1) for the SPEC 125 format. This flag may be specified multiple times and supports 126 common Unix glob patterns like *, ? and []. However, to avoid your 127 shell accidentally expanding glob patterns before Cargo handles 128 them, you must use single quotes or double quotes around each 129 pattern. 130 131 --workspace 132 Package all members in the workspace. 133 134 --exclude SPEC… 135 Exclude the specified packages. Must be used in conjunction with the 136 --workspace flag. This flag may be specified multiple times and 137 supports common Unix glob patterns like *, ? and []. However, to 138 avoid your shell accidentally expanding glob patterns before Cargo 139 handles them, you must use single quotes or double quotes around 140 each pattern. 141 142 Compilation Options 143 --target triple 144 Package for the given architecture. The default is the host 145 architecture. The general format of the triple is 146 <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for 147 a list of supported targets. This flag may be specified multiple 148 times. 149 150 This may also be specified with the build.target config value 151 <https://doc.rust-lang.org/cargo/reference/config.html>. 152 153 Note that specifying this flag makes Cargo run in a different mode 154 where the target artifacts are placed in a separate directory. See 155 the build cache 156 <https://doc.rust-lang.org/cargo/reference/build-cache.html> 157 documentation for more details. 158 159 --target-dir directory 160 Directory for all generated artifacts and intermediate files. May 161 also be specified with the CARGO_TARGET_DIR environment variable, or 162 the build.target-dir config value 163 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to 164 target in the root of the workspace. 165 166 Feature Selection 167 The feature flags allow you to control which features are enabled. When 168 no feature options are given, the default feature is activated for every 169 selected package. 170 171 See the features documentation 172 <https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options> 173 for more details. 174 175 -F features, --features features 176 Space or comma separated list of features to activate. Features of 177 workspace members may be enabled with package-name/feature-name 178 syntax. This flag may be specified multiple times, which enables all 179 specified features. 180 181 --all-features 182 Activate all available features of all selected packages. 183 184 --no-default-features 185 Do not activate the default feature of the selected packages. 186 187 Manifest Options 188 --manifest-path path 189 Path to the Cargo.toml file. By default, Cargo searches for the 190 Cargo.toml file in the current directory or any parent directory. 191 192 --locked 193 Asserts that the exact same dependencies and versions are used as 194 when the existing Cargo.lock file was originally generated. Cargo 195 will exit with an error when either of the following scenarios 196 arises: 197 198 o The lock file is missing. 199 200 o Cargo attempted to change the lock file due to a different 201 dependency resolution. 202 203 It may be used in environments where deterministic builds are 204 desired, such as in CI pipelines. 205 206 --offline 207 Prevents Cargo from accessing the network for any reason. Without 208 this flag, Cargo will stop with an error if it needs to access the 209 network and the network is not available. With this flag, Cargo will 210 attempt to proceed without the network if possible. 211 212 Beware that this may result in different dependency resolution than 213 online mode. Cargo will restrict itself to crates that are 214 downloaded locally, even if there might be a newer version as 215 indicated in the local copy of the index. See the cargo-fetch(1) 216 command to download dependencies before going offline. 217 218 May also be specified with the net.offline config value 219 <https://doc.rust-lang.org/cargo/reference/config.html>. 220 221 --frozen 222 Equivalent to specifying both --locked and --offline. 223 224 --lockfile-path PATH 225 Changes the path of the lockfile from the default 226 (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock 227 (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that 228 providing --lockfile-path will ignore existing lockfile at the 229 default path, and instead will either use the lockfile from PATH, or 230 write a new lockfile into the provided PATH if it doesn’t exist. 231 This flag can be used to run most commands in read-only directories, 232 writing lockfile into the provided PATH. 233 234 This option is only available on the nightly channel 235 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 236 requires the -Z unstable-options flag to enable (see #14421 237 <https://github.com/rust-lang/cargo/issues/14421>). 238 239 Miscellaneous Options 240 -j N, --jobs N 241 Number of parallel jobs to run. May also be specified with the 242 build.jobs config value 243 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to 244 the number of logical CPUs. If negative, it sets the maximum number 245 of parallel jobs to the number of logical CPUs plus provided value. 246 If a string default is provided, it sets the value back to defaults. 247 Should not be 0. 248 249 --keep-going 250 Build as many crates in the dependency graph as possible, rather 251 than aborting the build on the first one that fails to build. 252 253 For example if the current package depends on dependencies fails and 254 works, one of which fails to build, cargo package -j1 may or may not 255 build the one that succeeds (depending on which one of the two 256 builds Cargo picked to run first), whereas cargo package -j1 257 --keep-going would definitely run both builds, even if the one run 258 first fails. 259 260 Display Options 261 -v, --verbose 262 Use verbose output. May be specified twice for “very verbose” 263 output which includes extra output such as dependency warnings and 264 build script output. May also be specified with the term.verbose 265 config value 266 <https://doc.rust-lang.org/cargo/reference/config.html>. 267 268 -q, --quiet 269 Do not print cargo log messages. May also be specified with the 270 term.quiet config value 271 <https://doc.rust-lang.org/cargo/reference/config.html>. 272 273 --color when 274 Control when colored output is used. Valid values: 275 276 o auto (default): Automatically detect if color support is 277 available on the terminal. 278 279 o always: Always display colors. 280 281 o never: Never display colors. 282 283 May also be specified with the term.color config value 284 <https://doc.rust-lang.org/cargo/reference/config.html>. 285 286 Common Options 287 +toolchain 288 If Cargo has been installed with rustup, and the first argument to 289 cargo begins with +, it will be interpreted as a rustup toolchain 290 name (such as +stable or +nightly). See the rustup documentation 291 <https://rust-lang.github.io/rustup/overrides.html> for more 292 information about how toolchain overrides work. 293 294 --config KEY=VALUE or PATH 295 Overrides a Cargo configuration value. The argument should be in 296 TOML syntax of KEY=VALUE, or provided as a path to an extra 297 configuration file. This flag may be specified multiple times. See 298 the command-line overrides section 299 <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides> 300 for more information. 301 302 -C PATH 303 Changes the current working directory before executing any specified 304 operations. This affects things like where cargo looks by default 305 for the project manifest (Cargo.toml), as well as the directories 306 searched for discovering .cargo/config.toml, for example. This 307 option must appear before the command name, for example cargo -C 308 path/to/my-project build. 309 310 This option is only available on the nightly channel 311 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 312 requires the -Z unstable-options flag to enable (see #10098 313 <https://github.com/rust-lang/cargo/issues/10098>). 314 315 -h, --help 316 Prints help information. 317 318 -Z flag 319 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for 320 details. 321 322ENVIRONMENT 323 See the reference 324 <https://doc.rust-lang.org/cargo/reference/environment-variables.html> 325 for details on environment variables that Cargo reads. 326 327EXIT STATUS 328 o 0: Cargo succeeded. 329 330 o 101: Cargo failed to complete. 331 332EXAMPLES 333 1. Create a compressed .crate file of the current package: 334 335 cargo package 336 337SEE ALSO 338 cargo(1), cargo-publish(1) 339