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