-
Notifications
You must be signed in to change notification settings - Fork 81
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] Implement config v0 -> v1 migration. #1653
base: main
Are you sure you want to change the base?
Conversation
ce26547
to
9a7d939
Compare
This is currently based off #1661. When that gets merged, I'll rebase off |
9a7d939
to
8670bcb
Compare
bd40eca
to
101bc69
Compare
The various TODO:
|
We were discussing This is the interactive portion of Unlike most of the rest of Because this code is working from and generating a For each bit of user-selectable config, we use the dialoguer crate to prompt the user for their input unless the user passed the |
4f99c57
to
9f39ac6
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.
Left a comment on the as-yet incomplete items in init.rs
, just to track them, along with a couple of things to keep an eye on testing.
Aside from the remaining init.rs
changes, I think the only other remaining work is in the tests. All of our tests are written in the old config format, and are specifically using Cargo.toml
, so they need to be updated to use dist-workspace.toml
in the new config format in order to pass.
cargo-dist/src/init.rs
Outdated
} = &meta; | ||
|
||
/* |
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.
This whole section needs to be uncommented and reimplemented for the new structure.
cargo-dist/src/init.rs
Outdated
|
||
apply_installers_common(npm_table, &npm.common); | ||
|
||
// TODO: similar to shell |
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.
Impl missing here.
cargo-dist/src/init.rs
Outdated
|
||
apply_installers_common(powershell_table, &powershell.common); | ||
|
||
// TODO: similar to shell |
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.
Impl missing here.
cargo-dist/src/init.rs
Outdated
|
||
apply_installers_common(shell_table, &shell.common); | ||
|
||
// TODO |
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.
Impl missing here.
cargo-dist/src/init.rs
Outdated
panic!("Expected [dist.publishers] to be a table"); | ||
}; | ||
|
||
// ... |
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.
Impl missing here.
…host the assets. NOTE: pkg used to only be shown if it was already configured. However, since we have an outstanding PR for finishing up pkg support.
package_configs.push(app_config( | ||
workspaces, | ||
pkg_idx, | ||
workspace_layer.clone(), | ||
package_metadata.to_toml_layer(false), | ||
package_metadata.clone(), // fixme: this seems suspect since we call seemingly-mutating functions on it later |
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.
this is probably fine because package_metadata.to_toml_layer(false)
returned a new object anyway?
eprintln!("let's setup your dist config..."); | ||
eprintln!(); | ||
|
||
// For each [workspace] Cargo.toml in the workspaces, initialize [profile] | ||
let mut did_add_profile = false; | ||
for workspace_idx in workspaces.all_workspace_indices() { | ||
let workspace = workspaces.workspace(workspace_idx); | ||
if workspace.kind == WorkspaceKind::Rust { | ||
let mut workspace_toml = config::load_toml(&workspace.manifest_path)?; | ||
did_add_profile |= init_dist_profile(cfg, &mut workspace_toml)?; | ||
config::write_toml(&workspace.manifest_path, workspace_toml)?; | ||
} | ||
} | ||
|
||
if did_add_profile { | ||
eprintln!("{check} added [profile.dist] to your workspace Cargo.toml"); | ||
} | ||
|
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.
This is moved later in the function, to avoid dist init
being canceled but still overwriting Cargo.toml
.
The following PRs have been split off of this one:
Display
forChecksumStyle
, deriveDefault
forArtifactLayer
andInstallerLayer
#1698validate_install_paths()
andmerge_workspace_config()
toTomlLayer
#1703[profile.dist]
until after migrations; consolidate migrations under one prompt. #1704dist::init
anddist::tasks
into folder-based modules #1705dist::config::v0
. #1706dist::migrate
out fromdist::init
#1718config::version::want_v1()
and emptydo_migrate_from_v0()
#1724do_migrate_from_v0()
implementation #1725init_dist_profile()
out into its own file #1726dist::init::apply_dist
#1727apply_dist()
#1730Required functionality for this PR:
dist migrate
move v0 to v1do_migrate_from_v0()
actually copy workspace members to the new configuration.dist init
use v1dist init
load v1dist plan
(and other commands) gives an actionable error for v0 configsCurrent state (2025-01-10):