Skip to content
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

refactor(schemas): Pull out mod for proposed schemas package #13097

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

epage
Copy link
Contributor

@epage epage commented Dec 1, 2023

Originally for #12801 we talked about a cargo-util-manifest-schema package

  • util in the name to not clash with plugins
  • manifest specific to keep the scope down

The problem is we have types that aren't manifest specific, like

  • PartialVersion (currently slated for cargo-util-semverext)
  • RustVersion
  • PackageIdSpec
  • SourceKind (soon)

Things get messy if we try to break things down into common packages. Instead, I think it'd be useful to have a schemas package that has mods for each type of schema, re-exporting what is needed.

Normally, componentizing your package by the layer in the stack is a recipe for pain.
I don't think that'll apply here because these are meant to be so low level.

The other big concern could be compile times. My hope is it won't be too bad.

So this moves the util/toml types into the module and we can add more in the future.

Originally for rust-lang#12801 we talked about a `cargo-util-manifest-schema` package
- `util` in the name to not clash with plugins
- manifest specific to keep the scope down

The problem is we have types that aren't manifest specific, like
- `PartialVersion` (currently slated for `cargo-util-semverext`)
- `RustVersion`
- `PackageIdSpec`
- `SourceKind` (soon)

Things get messy if we try to break things down into common packages.
Instead, I think it'd be useful to have a schemas package that has mods
for each type of schema, re-exporting what is needed.

Normally, componentizing your package by the layer in the stack is a
recipe for pain.
I don't think that'll apply here because these are meant to be so low
level.

The other big concern could be compile times.  My hope is it won't be
too bad.

So this moves the `util/toml` types into the module and we can add more
in the future.
@rustbot
Copy link
Collaborator

rustbot commented Dec 1, 2023

r? @ehuss

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-cli Area: Command-line interface, option parsing, etc. A-manifest Area: Cargo.toml issues A-profiles Area: profiles A-workspaces Area: workspaces S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2023
@epage epage force-pushed the schemas branch 4 times, most recently from 23054a4 to cb2a02b Compare December 2, 2023 16:10
@ehuss
Copy link
Contributor

ehuss commented Dec 4, 2023

I don't have a particular opinion here, this seems fine to me.

I'm going to kick this to @weihanglo if he has any opinions on the organization, but if not feel free to r=ehuss.

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good!

src/cargo/util_schemas/mood.rs Outdated Show resolved Hide resolved
src/cargo/util_schemas/mod.rs Show resolved Hide resolved
@weihanglo
Copy link
Member

Thanks for the review and the update, people.

Let's go and merge this!

@bors r=ehuss

@bors
Copy link
Contributor

bors commented Dec 5, 2023

📌 Commit e46df98 has been approved by ehuss

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2023
@bors
Copy link
Contributor

bors commented Dec 5, 2023

⌛ Testing commit e46df98 with merge a5fa676...

@bors
Copy link
Contributor

bors commented Dec 5, 2023

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing a5fa676 to master...

@bors bors merged commit a5fa676 into rust-lang:master Dec 5, 2023
20 checks passed
@epage epage deleted the schemas branch December 5, 2023 17:27
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 6, 2023
Update cargo

5 commits in 623b788496b3e51dc2f9282373cf0f6971a229b5..9787229614b27854cf73d57ffae430d7c1e6caa4
2023-12-02 18:10:03 +0000 to 2023-12-06 02:29:23 +0000
- feat(spec): Extend PackageIdSpec with source kind + git ref for unambiguous specs (rust-lang/cargo#12933)
- test(trim-paths): assert `OSO` and `SO` cannot be trimmed (rust-lang/cargo#13118)
- refactor(schemas): Pull out mod for proposed schemas package (rust-lang/cargo#13097)
- chore(test): remove unnecesary packages and versions for `optionals` tests (rust-lang/cargo#13108)
- chore(config): migrate renovate config (rust-lang/cargo#13106)

r? ghost
@rustbot rustbot added this to the 1.76.0 milestone Dec 6, 2023
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
Update cargo

5 commits in 623b788496b3e51dc2f9282373cf0f6971a229b5..9787229614b27854cf73d57ffae430d7c1e6caa4
2023-12-02 18:10:03 +0000 to 2023-12-06 02:29:23 +0000
- feat(spec): Extend PackageIdSpec with source kind + git ref for unambiguous specs (rust-lang/cargo#12933)
- test(trim-paths): assert `OSO` and `SO` cannot be trimmed (rust-lang/cargo#13118)
- refactor(schemas): Pull out mod for proposed schemas package (rust-lang/cargo#13097)
- chore(test): remove unnecesary packages and versions for `optionals` tests (rust-lang/cargo#13108)
- chore(config): migrate renovate config (rust-lang/cargo#13106)

r? ghost
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Update cargo

5 commits in 623b788496b3e51dc2f9282373cf0f6971a229b5..9787229614b27854cf73d57ffae430d7c1e6caa4
2023-12-02 18:10:03 +0000 to 2023-12-06 02:29:23 +0000
- feat(spec): Extend PackageIdSpec with source kind + git ref for unambiguous specs (rust-lang/cargo#12933)
- test(trim-paths): assert `OSO` and `SO` cannot be trimmed (rust-lang/cargo#13118)
- refactor(schemas): Pull out mod for proposed schemas package (rust-lang/cargo#13097)
- chore(test): remove unnecesary packages and versions for `optionals` tests (rust-lang/cargo#13108)
- chore(config): migrate renovate config (rust-lang/cargo#13106)

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-cli Area: Command-line interface, option parsing, etc. A-manifest Area: Cargo.toml issues A-profiles Area: profiles A-workspaces Area: workspaces S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants