blob: 3bf48b856e4fd5b5a6b6b3c2124a0262e08bf638 [file] [log] [blame]
Matthew Maurerbd398542019-09-05 16:25:08 -07001'\" t
2.\" Title: cargo-package
3.\" Author: [see the "AUTHOR(S)" section]
4.\" Generator: Asciidoctor 1.5.8
5.\" Date: 2019-02-13
6.\" Manual: \ \&
7.\" Source: \ \&
8.\" Language: English
9.\"
10.TH "CARGO\-PACKAGE" "1" "2019-02-13" "\ \&" "\ \&"
11.ie \n(.g .ds Aq \(aq
12.el .ds Aq '
13.ss \n[.ss] 0
14.nh
15.ad l
16.de URL
17\fI\\$2\fP <\\$1>\\$3
18..
19.als MTO URL
20.if \n[.g] \{\
21. mso www.tmac
22. am URL
23. ad l
24. .
25. am MTO
26. ad l
27. .
28. LINKSTYLE blue R < >
29.\}
30.SH "NAME"
31cargo\-package \- Assemble the local package into a distributable tarball
32.SH "SYNOPSIS"
33.sp
34\fBcargo package [\fIOPTIONS\fP]\fP
35.SH "DESCRIPTION"
36.sp
37This command will create a distributable, compressed \fB.crate\fP file with the
38source code of the package in the current directory. The resulting file will
39be stored in the \fBtarget/package\fP directory. This performs the following
40steps:
41.sp
42.RS 4
43.ie n \{\
44\h'-04' 1.\h'+01'\c
45.\}
46.el \{\
47. sp -1
48. IP " 1." 4.2
49.\}
50Load and check the current workspace, performing some basic checks.
51.sp
52.RS 4
53.ie n \{\
54\h'-04'\(bu\h'+03'\c
55.\}
56.el \{\
57. sp -1
58. IP \(bu 2.3
59.\}
60Path dependencies are not allowed unless they have a version key. Cargo
61will ignore the path key for dependencies in published packages.
62.RE
63.RE
64.sp
65.RS 4
66.ie n \{\
67\h'-04' 2.\h'+01'\c
68.\}
69.el \{\
70. sp -1
71. IP " 2." 4.2
72.\}
73Create the compressed \fB.crate\fP file.
74.sp
75.RS 4
76.ie n \{\
77\h'-04'\(bu\h'+03'\c
78.\}
79.el \{\
80. sp -1
81. IP \(bu 2.3
82.\}
83The original \fBCargo.toml\fP file is rewritten and normalized.
84.RE
85.sp
86.RS 4
87.ie n \{\
88\h'-04'\(bu\h'+03'\c
89.\}
90.el \{\
91. sp -1
92. IP \(bu 2.3
93.\}
94\fB[patch]\fP, \fB[replace]\fP, and \fB[workspace]\fP sections are removed from the
95manifest.
96.RE
97.sp
98.RS 4
99.ie n \{\
100\h'-04'\(bu\h'+03'\c
101.\}
102.el \{\
103. sp -1
104. IP \(bu 2.3
105.\}
106A \fB.cargo_vcs_info.json\fP file is included that contains information
107about the current VCS checkout hash if available (not included with
108\fB\-\-allow\-dirty\fP).
109.RE
110.RE
111.sp
112.RS 4
113.ie n \{\
114\h'-04' 3.\h'+01'\c
115.\}
116.el \{\
117. sp -1
118. IP " 3." 4.2
119.\}
120Extract the \fB.crate\fP file and build it to verify it can build.
121.RE
122.sp
123.RS 4
124.ie n \{\
125\h'-04' 4.\h'+01'\c
126.\}
127.el \{\
128. sp -1
129. IP " 4." 4.2
130.\}
131Check that build scripts did not modify any source files.
132.RE
133.sp
134The list of files included can be controlled with the \fBinclude\fP and \fBexclude\fP
135fields in the manifest.
136.sp
137See \c
138.URL "https://doc.rust\-lang.org/cargo/reference/publishing.html" "the reference" " "
139for more details about
140packaging and publishing.
141.SH "OPTIONS"
142.SS "Package Options"
143.sp
144\fB\-l\fP, \fB\-\-list\fP
145.RS 4
146Print files included in a package without making one.
147.RE
148.sp
149\fB\-\-no\-verify\fP
150.RS 4
151Don\(cqt verify the contents by building them.
152.RE
153.sp
154\fB\-\-no\-metadata\fP
155.RS 4
156Ignore warnings about a lack of human\-usable metadata (such as the
157description or the license).
158.RE
159.sp
160\fB\-\-allow\-dirty\fP
161.RS 4
162Allow working directories with uncommitted VCS changes to be packaged.
163.RE
164.SS "Compilation Options"
165.sp
166\fB\-\-target\fP \fITRIPLE\fP
167.RS 4
168Package for the given architecture. The default is the host
169architecture. The general format of the triple is
170\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a
171list of supported targets.
172.sp
173This may also be specified with the \fBbuild.target\fP
174.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
175.RE
176.sp
177\fB\-\-target\-dir\fP \fIDIRECTORY\fP
178.RS 4
179Directory for all generated artifacts and intermediate files. May also be
180specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the
181\fBbuild.target\-dir\fP \c
182.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
183Defaults
184to \fBtarget\fP in the root of the workspace.
185.RE
186.SS "Feature Selection"
187.sp
188When no feature options are given, the \fBdefault\fP feature is activated for
189every selected package.
190.sp
191\fB\-\-features\fP \fIFEATURES\fP
192.RS 4
193Space or comma separated list of features to activate. These features only
194apply to the current directory\(cqs package. Features of direct dependencies
195may be enabled with \fB<dep\-name>/<feature\-name>\fP syntax.
196.RE
197.sp
198\fB\-\-all\-features\fP
199.RS 4
200Activate all available features of all selected packages.
201.RE
202.sp
203\fB\-\-no\-default\-features\fP
204.RS 4
205Do not activate the \fBdefault\fP feature of the current directory\(cqs
206package.
207.RE
208.SS "Manifest Options"
209.sp
210\fB\-\-manifest\-path\fP \fIPATH\fP
211.RS 4
212Path to the \fBCargo.toml\fP file. By default, Cargo searches in the current
213directory or any parent directory for the \fBCargo.toml\fP file.
214.RE
215.sp
216\fB\-\-frozen\fP, \fB\-\-locked\fP
217.RS 4
218Either of these flags requires that the \fBCargo.lock\fP file is
219up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will
220exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from
221attempting to access the network to determine if it is out\-of\-date.
222.sp
223These may be used in environments where you want to assert that the
224\fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network
225access.
226.RE
227.SS "Miscellaneous Options"
228.sp
229\fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP
230.RS 4
231Number of parallel jobs to run. May also be specified with the
232\fBbuild.jobs\fP \c
233.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
234Defaults to
235the number of CPUs.
236.RE
237.SS "Display Options"
238.sp
239\fB\-v\fP, \fB\-\-verbose\fP
240.RS 4
241Use verbose output. May be specified twice for "very verbose" output which
242includes extra output such as dependency warnings and build script output.
243May also be specified with the \fBterm.verbose\fP
244.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
245.RE
246.sp
247\fB\-q\fP, \fB\-\-quiet\fP
248.RS 4
249No output printed to stdout.
250.RE
251.sp
252\fB\-\-color\fP \fIWHEN\fP
253.RS 4
254Control when colored output is used. Valid values:
255.sp
256.RS 4
257.ie n \{\
258\h'-04'\(bu\h'+03'\c
259.\}
260.el \{\
261. sp -1
262. IP \(bu 2.3
263.\}
264\fBauto\fP (default): Automatically detect if color support is available on the
265terminal.
266.RE
267.sp
268.RS 4
269.ie n \{\
270\h'-04'\(bu\h'+03'\c
271.\}
272.el \{\
273. sp -1
274. IP \(bu 2.3
275.\}
276\fBalways\fP: Always display colors.
277.RE
278.sp
279.RS 4
280.ie n \{\
281\h'-04'\(bu\h'+03'\c
282.\}
283.el \{\
284. sp -1
285. IP \(bu 2.3
286.\}
287\fBnever\fP: Never display colors.
288.RE
289.sp
290May also be specified with the \fBterm.color\fP
291.URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "."
292.RE
293.SS "Common Options"
294.sp
295\fB\-h\fP, \fB\-\-help\fP
296.RS 4
297Prints help information.
298.RE
299.sp
300\fB\-Z\fP \fIFLAG\fP...
301.RS 4
302Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for
303details.
304.RE
305.SH "ENVIRONMENT"
306.sp
307See \c
308.URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " "
309for
310details on environment variables that Cargo reads.
311.SH "EXIT STATUS"
312.sp
3130
314.RS 4
315Cargo succeeded.
316.RE
317.sp
318101
319.RS 4
320Cargo failed to complete.
321.RE
322.SH "EXAMPLES"
323.sp
324.RS 4
325.ie n \{\
326\h'-04' 1.\h'+01'\c
327.\}
328.el \{\
329. sp -1
330. IP " 1." 4.2
331.\}
332Create a compressed \fB.crate\fP file of the current package:
333.sp
334.if n .RS 4
335.nf
336cargo package
337.fi
338.if n .RE
339.RE
340.SH "SEE ALSO"
341.sp
342\fBcargo\fP(1), \fBcargo\-publish\fP(1)