273 Commits

Author SHA1 Message Date
Arlo Siemsen
312e2aab7f Use strip_path_canonical for getting the relative path
This resolve an issue where the package path contains a symlink that's resolved by git
2024-04-03 12:59:49 -05:00
Arlo Siemsen
45c390a2a5 Switch to using gitoxide by default for listing files 2024-04-03 12:05:26 -05:00
Ed Page
cad9673785 refactor(package): Move preamble to Manifest 2024-03-28 13:29:24 -05:00
Sebastian Thiel
a710d459af
assure repositories are always walked into to avoid .git folders.
With a traditional walk, `.git` will be picked up, and so will be
ignored directories. This commit also doesn't give submodules special
treatment - instead it just tries to open directories as repositories,
or walks them if that fails.
2024-03-18 10:07:04 +01:00
Sebastian Thiel
9115545053
implement list_files_gix to be used when gitoxide is enabled. 2024-03-18 10:06:13 +01:00
Lin Yihai
cf45a5c186 test: Add test for packaging a public dependency 2024-03-01 20:19:41 +08:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Lin Yihai
75aaa40c78 Remove the unnecessary backticks 2023-11-22 11:09:55 +08:00
Lin Yihai
edfbcf0a6c Return a hard error when custom build outside package 2023-11-21 11:10:46 +08:00
Lin Yihai
92ce5a2b27 Change the logging level and other improvement. 2023-11-20 12:57:26 +08:00
Lin Yihai
ac1e66d947 Add testcase for custom build file warning 2023-11-17 17:11:57 +08:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
Lin Yihai
b2b026bfbb Improve testcase include_files_called_target_git 2023-11-14 11:25:11 +08:00
Lin Yihai
722d8f1c1d Add target folder but not committed 2023-11-10 15:49:57 +08:00
Lin Yihai
4577c0ec61 Correct the situation with git repository test cases 2023-11-10 14:22:03 +08:00
Karel Peeters
2c503f89c4 Add unit test for files called target.
https://github.com/rust-lang/cargo/issues/12790
2023-11-10 10:38:26 +08:00
Ed Page
bfb5d1db0e fix(toml): Default package.publish based on presence of package.version
Before the default was hardcoded to `true`.  The problem was that means
that to remove the `package.version` boilerplate, you had to add
`package.publish = false` boilerplate.

To make the errors easier to understand in this situation, I err on the
side of encouraging people to put `publish = true` in their manifests.

By making this change, we also unblock "cargo script" /
`Cargo.toml` unifying the handling of `package.publish`.
2023-10-11 13:17:03 -05:00
Ed Page
1923b5b862 feat(toml): Allow versionless packages
This defaults the version to `0.0.0` for most of cargo.

It is an error to lack a version and have a package publishable.
That means you have to add `publish = false`.
2023-10-11 13:13:44 -05:00
Ed Page
5c9a126911 test(toml): Verify existing version-less behavior 2023-10-06 12:21:07 -05:00
Scott Schafer
b2b3cfa524
feat: Add Edition2024 2023-10-04 13:11:52 -06:00
Ed Page
cc6b6c9584 fix(package): Avoid multiple package list entries
To keep things simple, especially in getting a `Hash` implementation
correct, I'm leveraging `unicase` for case-insensitive
comparisons which is an existing dependency and I've been using for
years on other projects.

This also opens the door for us to add cross-platform compatibility
hazard warnings about multiple paths that would write to the same
location on a case insensitive file system.  I held off on that because
I assume we would want #12235 first.

This does mean we can't test the "no manifest" case anymore because the
one case (no pun intended) I knew of for hitting it is now gone.
2023-07-26 11:02:47 -05:00
Ed Page
9b14e39cd7 test(package): Verify mixed-case Cargo.toml 2023-07-26 10:10:21 -05:00
Ed Page
3166e5f614 fix(package): Warn when manifest is not more generally found
Being a bit cautious about not turning this into an error since this is
most likely because of case insensitive filesystems.
2023-07-24 16:49:38 -05:00
Ed Page
f4c97b24a8 test(package): Verify the no-manifest case 2023-07-24 16:41:15 -05:00
Ed Page
bbb6aff67a fix(package): Normalize cargo.toml to Cargo.toml for windows 2023-07-24 16:29:14 -05:00
Ed Page
5dd39df6f1 test(package): Verify cargo.toml behavior 2023-07-24 16:13:21 -05:00
Eval EXEC
e906797b91
Add test case for confilict README.md check
Signed-off-by: Eval EXEC <execvy@gmail.com>
2023-05-14 16:55:23 +08:00
Kyle Matsuda
27e95997ce failing tests on empty readme and license-path fields 2023-04-25 12:27:39 -06:00
Scott Schafer
de2e97403f chore: update package tests to use check 2023-02-20 12:21:27 -06:00
Anton Lazarev
24500354bf
add new tests for filesizes 2022-10-28 17:13:25 -07:00
Anton Lazarev
9333b8f5ba
update package, publish, and publish_lockfile tests 2022-10-28 17:13:25 -07:00
Scott Schafer
ab18bd40d5 refactor(testsuite): Replace [project] with [package] 2022-09-26 09:51:16 -06:00
Weihang Lo
52a418c516
test: ignore broken but excluded file during traversing 2022-08-20 00:56:43 +01:00
Wim Looman
492358a19f
Only override published resolver when the workspace is different 2022-08-10 09:26:50 +02:00
Eric Holk
e9c7544c19 Move Windows path test function to test code 2022-08-03 15:59:59 -07:00
Eric Holk
f122dbbd41 Use GetFullPathNameW to test restricted names
The previous commit tests whether the current machine supports Windows
restricted names by creating a file and checking whether that succeeds.
This commit reworks this testto use GetFullPathNameW, which can be done
without having to create and remove new files.
2022-08-03 15:59:58 -07:00
Eric Holk
0adcc183bc Test if reserved filenames are allowed in Windows
Recent versions of Windows have removed the limitation on filenames like
`aux` or `con`. This change allows the `package::reserved_windows_name`
to still pass by first trying to create a file with a reserved name to
see if Windows supports it. If so, it skips the rest of the test.
Otherwise, we keep the same behavior as before.
2022-08-03 15:59:58 -07:00
Wim Looman
d953c3b2d7
Override to resolver=1 in published package 2022-07-29 16:03:05 +02:00
Arlo Siemsen
24dac452c5 Improve testing framework for http registries
Improve integration of the http server introduced by the http-registry feature.
Now the same HTTP server is used for serving downloads, the index, and
the API.

This makes it easier to write tests that deal with authentication and
http registries.
2022-06-10 16:51:35 -05:00
Jeremy Banks
42424065f6 Add test to confirm that Cargo.toml.orig files are reserved. 2022-04-09 14:03:09 -04:00
Jon Gjengset
79cc65fa5a Add tests for ignoring symlinks 2022-03-22 16:21:39 -07:00
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
Weihang Lo
d92dceaeba
Test IO error resilience while walking directories
Remove `build_script::build_script_scan_eacces`  test case because cargo
ignores it and returns its path during a `cargo build`. The caller still
has a chance to hit the IO error if they does access it.
2022-01-05 14:29:59 +08:00
Weihang Lo
6fa0f01d87
Test filesystem loop during traversal
Use unordered since order of warning differs on each platform.
2021-12-15 09:42:14 +08:00
Nipunn Koorapati
b8b127a870 Support path_in_vcs as part of cargo_vcs_metadata 2021-09-26 13:37:56 -04: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
Eric Huss
97a135049a Handle git deleted files with dirty worktree. 2021-07-01 18:10:35 -07:00
Bryysen
4e1910d9d3 Error when packaging with git dependencies without version
If `cargo package` is run on a package that specifies a git dependency
without a version, cargo will error. This should help with clarifying
that git dependencies will be stripped when packaging, and that the
dependency has to be fetched from a registry.
2021-06-23 02:01:29 +02:00
Alex Crichton
a02b6e5bfc Update tar dependency to 0.4.34
Pulls in a fix which should avoid 0 mtime files from showing up.

Closes #9512
2021-05-27 14:16:59 -07:00