Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for multiple input source files #3

Open
fmease opened this issue Jan 28, 2024 · 7 comments
Open

Support for multiple input source files #3

fmease opened this issue Jan 28, 2024 · 7 comments
Assignees
Labels
C-high Techincal complexity: High K-feature-request Kind: Feature request P-high Priority: High S-actionable Status: Actionable

Comments

@fmease
Copy link
Owner

fmease commented Jan 28, 2024

If multiple input source files are passed, we should do something very similar to cargo doc, i.e., “running rustc N-1 times and rustdoc N times” given N input files.

Figure out what -x/--cross-crate means if multiple files are passed. Probably reject.

We should have more “dev-y” configuration options available like passing --cfg doc to dependency crates (which is what Cargo doesn't do at the moment, CC rust-lang/rust#114952) or not running rustc at all (I don't know if that's useful, maybe for debugging cross-crate stuff; basically N input files => N rustdoc executions (modulo compiletest revisions, lol)).

@fmease fmease self-assigned this Jan 28, 2024
@fmease
Copy link
Owner Author

fmease commented Aug 7, 2024

Just hit a case where I need this. Plz fix!

@fmease
Copy link
Owner Author

fmease commented Dec 4, 2024

I kinda wanna be able to concisely describe the crate graph with a single CLI flag. Once we have >2 crates, there are a multiple possibilities, most of which are reasonable -- there wouldn't be a reasonable default.

Of course, instead of that (or as a MVP) we could just make "everything to the left" a dependency to "everything to the right": So for d.rs c.rs b.rs a.rs, a is the root crate with deps {d,c,b}, b has {c,d}, c has {d} and d has {}.

@fmease fmease added C-high Techincal complexity: High S-needs-decision Status: Needs decision S-needs-design Status: Needs design K-feature-request Kind: Feature request P-high Priority: High labels Dec 4, 2024
@fmease
Copy link
Owner Author

fmease commented Jan 25, 2025

Hmm, maybe the MVP should just be -x <file.rs>? So no dependency graphs of height > 2 (excluding sysroot crates). We can always replace it / iterate on it. Having -x would already be super nice for quickly testing snippets without having to add any compiletest directives (and a dummy auxiliary/ folder).

@fmease
Copy link
Owner Author

fmease commented Jan 28, 2025

Scrap the -x. Let's turn <PATH> into <PATH>... (i.e., start accepting multiple paths) and introduce an optional -G, --crate-graph <GRAPH> flag where GRAPH is a custom textual representation of the crate graph.

For c.rs b.rs a.rs, -G defaults to 0-1-2 which means "crate at arg 0 is the dependency of crate at arg 1 which is the dependency of crate at arg 2" (the syntax isn't 0<-1<-2 because you'd need to escape/quote it in {,ba,z}sh etc.). I was about to say c-b-a would also work in this case (i.e., by name instead of by index) when I remembered crate names like 0, 1, 2, … are completely legal 😢. Either we ignore that or we introduce (optional or required) disambiguators.

Other examples for -G: 0,1-2 "c and b are (direct) dependencies of a (and b doesn't depend on c)".

@fmease
Copy link
Owner Author

fmease commented Jan 28, 2025

The MVP should only support the normal build mode, i.e., exclude cross-crate -X and compiletest -@ builds.

@fmease
Copy link
Owner Author

fmease commented Jan 28, 2025

TODO: Extend the µDSL to support specifying crate types (important for modeling proc-macro deps and generally, too). Probably sth. like proc-macro:a-b (pm:a-b, …).

@fmease fmease added S-actionable Status: Actionable and removed S-needs-design Status: Needs design S-needs-decision Status: Needs decision labels Jan 28, 2025
@fmease
Copy link
Owner Author

fmease commented Jan 28, 2025

Ah, regarding the µDSL I should clarify that 0-1-2 is shorthand for 0-1 1-2. Space separation should allow us to represent any directed graph we want. Edit: Space separation is awkward too on the command line, find a better separator (; is out, too). Maybe simply _ lol (oh but that's a valid crate name iirc). Maybe +?

… -Gpm:0-2+pm:1-2+2-3 …

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-high Techincal complexity: High K-feature-request Kind: Feature request P-high Priority: High S-actionable Status: Actionable
Projects
None yet
Development

No branches or pull requests

1 participant