Clippy linter should set MOZ_TOPOBJDIR
Categories
(Developer Infrastructure :: Lint and Formatting, defect, P3)
Tracking
(Not tracked)
People
(Reporter: janerik, Assigned: Sylvestre)
References
(Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
For FOG we're relying on some buildtime-generated code, which is placed into a directory under MOZ_TOPOBJDIR
and then included from Rust code like this:
include!(concat!(
env!("MOZ_TOPOBJDIR"),
"/toolkit/components/glean/api/src/pings.rs"
));
This breaks clippy linting as MOZ_TOPOBJDIR
isn't set, the include fails and thus the build fails.
For now we can work around that by using:
#[cfg(not(feature = "cargo-clippy"))]
and manually write a subset of what would normally be auto-generated.
It would be nice if the clippy task sets MOZ_TOPOBJDIR
correctly.
Now I'm not sure how these tasks run on CI and whether the build happens before that such that the files are even generated.
If not then of course this wouldn't help and we still need the workaround to get clippy to work correctly on try.
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
Args to call clippy are defined here:
https://searchfox.org/mozilla-central/source/tools/lint/clippy/__init__.py#187-191
And called this way:
https://searchfox.org/mozilla-central/source/taskcluster/ci/source-test/mozlint.yml#377-388
in the CI
Do you want to give a try ?
thanks
Reporter | ||
Comment 2•4 years ago
|
||
Hm.... maybe?
Doesn't look like any of the linters uses any MOZ_*
environment variable, so I wonder if clippy really should.
And the question still stands if clippy actually depends on a build, because without those there won't be any files in MOZ_TOPOBJDIR
anyway and we still need the workaround.
Assignee | ||
Comment 3•4 years ago
|
||
We have linters taking different paths for the CI. For example:
https://searchfox.org/mozilla-central/source/tools/lint/clang-format/__init__.py#140-144
https://searchfox.org/mozilla-central/source/tools/lint/android/lints.py#29-31
etc
We could require some pre-analysis step (ex: "mach build foo/") in clippy if needed.
Comment 4•4 years ago
|
||
The severity field is not set for this bug.
:ahal, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Assignee | ||
Comment 5•3 years ago
|
||
Might not fully work as it expects also
obj-x86_64-pc-linux-gnu/dist/xpcrs/bt/all.rs or
obj-x86_64-pc-linux-gnu/dist/xpcrs/bt/nsIEarlyHintObserver.rs
Updated•3 years ago
|
Assignee | ||
Comment 6•3 years ago
|
||
Setting this variable fixes some issues but not all of them.
clippy expects some generated files in the obj directories. They will need to be generated before doing anything else.
Updated•2 years ago
|
Updated•1 year ago
|
Description
•