-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
WIP: cargo: Support building multiple versions of the same crate #12363
base: master
Are you sure you want to change the base?
Conversation
30904b9
to
d9c664a
Compare
de93962
to
7900636
Compare
55f111e
to
b068532
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cargo forces the build.rs to be panic=unwind. It would probably make sense to do the same here?
b068532
to
b4a2169
Compare
Compiling and linking code is part of the Compiler base class, there is no reason it cannot also run executables.
When doing a compiler check with a File object, there is no need to dump the file into logs, we can just print the path. The file could potentially be big.
This is not exposed in API, but will be used internally.
Add cfg token to be able to parse the top level cfg() function. Fix parser which was creating a new iterator when recursing which causer the caller function's iterator to not have advanced when recursing function returns.
That function will be reused to add target dependencies as well.
This returns --target value from rustc command line, or the native target.
It compiles and run build.rs to return a list of a configs for cargo projects.
We are not using them yet, but we should already at least declare its options dictionary. This avoid crashing when generated code adds features into that dict that was not yet declared.
b4a2169
to
7ab8559
Compare
In that case build.rs cannot be used and must be ported manually.
When the proc-macro rlib is in a different subdir, it would miss the needed -L argument and rustc would not find it. Meson was assuming that proc-macros are only needed when building libraries that uses it, but it turns out that was wrong, as show by the unit test.
7ab8559
to
600d1e6
Compare
@@ -188,6 +188,8 @@ | |||
|
|||
members: T.List[str] | |||
exclude: T.List[str] | |||
package: Package | |||
dependencies: T.Dict[str, DependencyV], |
Check failure
Code scanning / CodeQL
Syntax error Error
@@ -20,8 +20,12 @@ | |||
import collections | |||
import typing as T | |||
|
|||
from functools import lru_cache |
Check notice
Code scanning / CodeQL
Unused import Note
If dependency name does not match the package name, we have to rename the crate name to the dependency name. Yes, that makes 3 different names for the same dependency, good job cargo! For example: - package name: cairo-sys-rs - crate name: cairo-sys - dependency name: ffi
FTR, the latest changes here make it possible to build a GTK4 Rust application successfully: sdroege/mandelbrot@3ea3548 |
I started to split this PR in smaller parts to make it easier to review. |
That makes a lot of sense. Could you please link them here? 🙏 |
Ah nm, I didn't see the edit of the description. 🤦 |
cargo: Add support for
system-deps
dependenciesrust: recursively pull proc-macro dependencies as well
cargo: Abort if project has build-dependencies
cargo: Set CARGO_PKG_* in env when building and running build.rs
cargo: Only build one crate type at a time
cargo: Fix error when defining options on build-dependencies
rust: Add rust.cargo_cfg() module method
rust: Add get_target_triplet() method
cargo: Split function that adds a single dependency
cargo: builder: Add elseblock support
cargo: Fix cfg() parsing
cargo: Add patch_directory into generated wrap if available
cargo: Generate .wrap file from crates.io dependencies
cargo: Add API version into dependency name
cargo: Ensure Dependency.package always has a value
modules: Add helper to add project/global arguments
compilers: Allow setting env and workdir for run checks
compilers: Do not dump File content in log for compiler checks.
compilers: Every compiler can run code
build: Warning message was not telling which target it links to.
I've split this PR into smaller ones: