69 Commits

Author SHA1 Message Date
Ed Page
320c279f43 Port cargo from toml-rs to toml_edit
Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`
2022-01-13 09:27:27 -06:00
l00556901
cf621fdc94 modify test 2021-12-02 19:55:56 +08:00
l00556901
64c69dffc5 fix some bugs 2021-12-01 11:21:06 +08:00
l00556901
56b8ae7c44 delete --host command and message 2021-12-01 10:29:46 +08:00
Eric Huss
30ff8424c9 Remove unnecessary format! 2021-07-26 12:56:53 -07:00
tcmal
8f1f0e40fd feat(package+publish): package arguments
adds -p, --workspace, and --exclude to package command,
and -p to publish command, as well as tests for both.

closes #7345
2021-07-26 16:31:58 +01:00
Weihang Lo
8c75e2ffa0
Update tests to use registry names 2021-07-22 00:50:30 +08:00
Eric Huss
b73e3d4fa5 Don't export lines_match.
Use better high-level interfaces to achieve the same thing.
2021-06-16 09:44:29 -07:00
Eric Huss
c9bd6e12e1 Minor update to registry API error messages. 2021-02-27 12:38:17 -08:00
Eric Huss
06b8d1cac1 Add a ResponseError for registry API interaction.
The intent here is to make it easier to work with API errors.

This also includes some new tests for checking network errors.
2021-02-02 17:44:57 -08:00
Eric Huss
340656e29d Add RegistryBuilder to help initializing test registries.
The intent here is to make it more flexible to create different registry
setups, and to reuse code a little more easily.
2021-02-02 15:48:48 -08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Nazım Can Altınova
32449a70db
Add a test case for new publish behavior change 2020-08-06 13:01:15 +02:00
Eric Huss
7a5f0369cb Fix failure with missing readme. 2020-06-11 14:55:33 -07:00
Eric Huss
65274ea7d5 Add a warning when using registry.token with source replacement. 2020-04-19 09:25:32 -07:00
Eric Huss
b4c374039f Do not implicitly load registry.token with --index.
The intent is to avoid leaking the crates.io token to other servers.
2020-04-19 09:20:54 -07:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss
944f5049f1 Re-implement proc-macro feature decoupling. 2020-03-22 15:08:02 -07:00
Eric Huss
5a1862cd36 Add proc-macro to the index. 2020-03-15 10:10:25 -07:00
Takayuki Nakata
8076f578a3 Refactoring of creating files in tests
Use `mkdir_p` and `fs::write`.
2020-01-14 16:15:29 +09:00
Takayuki Nakata
4b70f14903 Load credentials only when needed
Credentials are always loaded, even if these are not used. If
access to confidential files such as credentials is not given,
`cargo build` fails despite not using credentials.

Fixes #7624.
2020-01-07 23:40:58 +09:00
Matthias Krüger
34f2d4710b fix a couple of typos 2019-12-11 15:31:26 +01:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Alex Crichton
366ae3f7ba Turn the new lock file format on by default
This commit enables the support added in #7070 by default. This means
that gradually over time all `Cargo.lock` files will be migrated to the
new format. Cargo shipped with Rust 1.38.0 supports this new lock file
format, so any project using Rust 1.38.0 or above will converge quickly
onto the new lock file format and continue working.

The main benefit of the new format is to be more friendly to git merge
conflicts. Information is deduplicated throughout the lock file to avoid
verbose `depedencies` lists and the `checksum` data is all listed inline
with `[[package]]`. This has been deployed with rust-lang/rust for some
time now and it subjectively at least seems to have greatly reduced the
amount of bouncing that happens for touching `Cargo.lock`.
2019-11-12 07:00:18 -08:00
bors
78ba63019d Auto merge of #7333 - ehuss:allow-dev-dep-path, r=alexcrichton
Allow publishing with dev-dependencies without a version.

This change allows dev-dependencies without a `version` key to be published.  If a dev-dependency is missing the `version`, it will be stripped from the packaged manifest.
2019-10-15 14:38:29 +00:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Eric Huss
e4345b2e8e Validate uploaded Cargo.toml contents. 2019-09-10 17:06:32 -07:00
Eric Huss
d709c10d35 Allow publishing with dev-dependencies without a version. 2019-09-05 14:56:21 -07:00
Eric Huss
d682439b71 Allow git+version dependency to be published. 2019-08-19 09:37:52 -07:00
Eric Huss
cce87428c0 Improve error message when using API command with non-remote registry. 2019-08-11 18:58:52 -07:00
Sekhat Temporus
69226ed887 improve uncommitted changes cargo-package message
fixes #7003

Explicitly state what the suggested flag `--allow-dirty`
actually does when packaging/publishing the crate. Primarily,
that the uncommited changes are included within the resulting
package.
2019-07-01 18:48:59 +01:00
Eric Huss
34307c6122 Stabilize publish-lockfile. 2019-06-10 13:19:18 -07:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Alex Helfet
f7c424f362 Add check token before verify tests. 2019-04-16 17:52:07 +01:00
Eric Huss
bf23a7e430 Improve error message for publish key restriction.
The existing error message didn't really recognize that `publish` can be a
list.

This also adds support for `publish = ["crates-io"]` to restrict publishing
to crates.io only.
2019-04-11 11:44:26 -07:00
Eric Huss
e7124ba262 Testsuite: Make cwd() relative to project root.
It's a fairly common pattern, and it seemed natural to me.
2019-03-20 16:34:56 -07:00
bors
2e4cfc2b7d Auto merge of #6654 - ehuss:alt-stabilize, r=alexcrichton
Stabilize Alternative Registries

This includes a few minor changes besides stabilizing:
- `cargo search` won't display `crates.io` search URL for extra results for non-crates.io registries.
- Document using environment variables for API tokens.
- Explicit section in `config.md` for documenting the credentials file.

Closes rust-lang/rust#44931
Closes rust-lang/crates-io-cargo-teams#21
Closes #6589
Closes #4688
2019-02-12 19:47:40 +00:00
Jethro Beekman
d3f7bb0ae5 Having a [patch] section when publishing is not an error 2019-02-12 11:18:52 +05:30
Eric Huss
737382d7e1 Stabilize Alternative Registries 2019-02-11 15:16:13 -08:00
Eric Huss
b5144c7f83 Add test for publish with [patch] + cleanup. 2019-01-11 19:14:58 -08:00
bors
c9fa7db4d4 Auto merge of #6453 - spacekookie:publish-featured, r=alexcrichton
Adding feature-flags to `cargo publish` and `cargo package`

This change adds the `--features` and `--all-features` flags to the
above mentioned commands. This is to allow publishing of crates that
have certain feature requirements for compilation, without having to
rely on `--no-verify` which isn't good practise.

This PR adds two new fields `features` and `all_features` to both the
`PackageOpts` and `PublishOpts` and also adds the argument options
to the CLI commands.

Merging this feature will allow people to publish crates on crates.io
that require some feature flag to compile (or all?) without needing
to rely on not checking the package before uploading, potentially
resulting in less packaging errors and broken packages.
2019-01-10 18:37:22 +00:00
Katharina Fey
b29e37968a
Adding support for no-default-features to package and publish 2019-01-09 18:30:54 +01:00
Katharina Fey
8c3bf82f8e
Fixing the publish tests 2019-01-09 17:41:03 +01:00
Eric Huss
0a4cfa630f publish: rework the crates.io detection logic.
The old code used an unreliable method to detect if `cargo publish` was publishing to crates.io. This should work even if the `--index` flag is used.

Also includes a very minor rewording of an error message mentioning crates.io, even for alternative registries.
2019-01-05 10:56:49 -08:00
Eric Huss
3d84d0ad77 Add dependency registry to cargo metadata.
This adds the `registry` field for dependencies for alternate registries in
`cargo metadata`.
2018-12-29 21:14:25 -08:00
Katharina Fey
40cca8058d
Undoing bad formatting changes and removing redundant struct fields 2018-12-29 18:18:50 +01:00
Katharina Fey
142bafb7e6
Adding feature tests to publish and package 2018-12-29 11:45:05 +01:00
Eric Huss
f58d107e7c testsuite: Require failing commands to check output. 2018-12-28 17:59:36 -08:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00