-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include
patterns should report invalid paths
#14390
Comments
Its hard for an We can't break error for this because of compatibility. We likely can't transition it to an error because there are use cases. This could potentially be a warning. A big implementation challenge is knowing when an include is used as we delegate this logic to third-party helpers. |
A warning is fine I think. It's clear what happens if you ignore that warning: there is nothing there to include.
that's what I suspected. is |
It is still the cargo/src/cargo/sources/path.rs Lines 477 to 500 in 7ac34d3
Another challenge is that we should avoid flooding people with those warnings. #12235 is one way to make it configurable. |
I am... sympathetic to folkertdev's concern, at least. If it weren't for the CI I recently added literally last Friday, that runs a packaging test using You see, I moved the contents of the build.rs... which is now quite huge and basically its own build system... into another crate, and replaced the other crate's build.rs with this: diff --git a/pgrx-pg-sys/bindgen.rs b/pgrx-pg-sys/bindgen.rs
new file mode 100644
index 00000000..5cecbe61
--- /dev/null
+++ b/pgrx-pg-sys/bindgen.rs
@@ -0,0 +1,4 @@
+// not a build.rs so that it doesn't inherit the git history of the build.rs
+
+// little-known Rust quirk: you can import main from wherever
+use pgrx_bindgen::build::main; ...and from the same diff, you may notice something that wasn't changed, but should have: diff --git a/pgrx-pg-sys/Cargo.toml b/pgrx-pg-sys/Cargo.toml
index 85b33575..0dc2af1c 100644
--- a/pgrx-pg-sys/Cargo.toml
+++ b/pgrx-pg-sys/Cargo.toml
@@ -20,6 +20,7 @@ documentation = "https://docs.rs/pgrx-pg-sys"
readme = "README.md"
edition = "2021"
include = ["src/**/*", "README.md", "include/*", "cshim/*", "build.rs", "build/*"]
+build = "bindgen.rs" ...yeah. |
Is there any chance the existing little warnings like these can at least be made more prominent or repeated after the list of packages whizzes by? They're hard to pick out amidst the rest of everything. $ cargo +nightly package --workspace -Zpackage-workspace --allow-dirty
Packaging pgrx-pg-config v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-pg-config)
Packaged 7 files, 35.5KiB (9.5KiB compressed)
Packaging pgrx-sql-entity-graph v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-sql-entity-graph)
Packaged 55 files, 393.4KiB (65.9KiB compressed)
Packaging cargo-pgrx v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/cargo-pgrx)
Updating crates.io index
Packaged 39 files, 434.9KiB (102.5KiB compressed)
Packaging pgrx-macros v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-macros)
Packaged 7 files, 63.5KiB (14.5KiB compressed)
Packaging pgrx-bindgen v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-bindgen)
Packaged 7 files, 125.4KiB (31.9KiB compressed)
Packaging pgrx-pg-sys v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-pg-sys)
warning: ignoring `package.build` as `bindgen.rs` is not included in the published package
Packaged 45 files, 12.5MiB (1.7MiB compressed)
Packaging pgrx v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx)
Packaged 103 files, 881.7KiB (187.0KiB compressed)
Packaging pgrx-tests v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-tests)
warning: ignoring test `ui` as `tests/ui.rs` is not included in the published package
Updating crates.io index
Packaged 10 files, 97.8KiB (28.1KiB compressed)
Verifying pgrx-pg-config v0.0.999-rc.999 (/home/jubilee/tcdi/pgrx/pgrx-pg-config)
Updating crates.io index
Compiling proc-macro2 v1.0.86
# another ~100 lines of compiling messages This is partly because we've only just started on compiling the "root" packages all others depend on, and will be crawling up them to the main "facade" packages. These roots, having no dependencies on other packages (in the workspace, anyways), may be in a position where they essentially always build without problem. |
Switching things around to put those messages last is a very invasive change though there are other paths for improving this. Overall, I'd like to improve compilation output so that it doesn't take up so much permanent space (#8889). I'm particularly interested in this for improving the cargo-script experience. We are also working on adding control over cargo warnings by turning them into lints (#12235) and to turn warning lints into errors (#8424). |
Ah! Yeah, I figured that'd likely be one of those "surprisingly difficult things", but it seemed like something to ask rather than assume. Yeah, it requires opt-in so has the discoverability issue but if there's a set of lints we can opt in to denying, someone could write up a "how to set up prepublish CI with cargo" article and they would probably become common knowledge fairly fast. |
The cargo team discussed this today and felt like it would be good for this to be a lint warning. However, as noted above, it's unclear how feasible that is with the Since I believe this is essentially a duplicate of #9667, closing in favor of that. |
Problem
In rust-lang/libz-sys#205 I fixed a case where a typo in the
include
list meant that some files were not included in the published package. The fix was simple:The fact that this invalid path did not get reported meant that the package was broken for the s390x target. Not great.
Proposed Solution
Intuitively I think every
include
line should match at least one file. In any other cases, it's redundant (can be removed) or a typo (very valuable to report to the user).If that sounds reasonable I'd be happy have a go at implementing it.
Notes
No response
The text was updated successfully, but these errors were encountered: