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(toml): Decouple target discovery from Target creation #13701

Merged
merged 23 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
71e362f
test(package): Clean up a build.rs test
epage Apr 3, 2024
cc9710e
refactor(toml): Be consistent in readme resolve name
epage Apr 3, 2024
d3cfa7f
refactor(toml): Clarify which manifest is being used
epage Apr 4, 2024
b86b4b4
refactor(toml): Clarify conversion nature of target fn's
epage Apr 4, 2024
74e8d76
refactor(toml): Simplify lib resolving
epage Apr 5, 2024
6ef9779
refactor(toml): Abstract out lib name validation
epage Apr 5, 2024
019bae2
refactor(toml): Consolidate lib discovery
epage Apr 5, 2024
f900b3f
refactor(toml): Split lib discovery from Target creation
epage Apr 5, 2024
b08d197
refactor(toml): Move lib resolving up a level
epage Apr 5, 2024
f2b0678
refactor(toml): Pull out legacy_bin_path
epage Apr 4, 2024
b061bc5
refactor(toml): Abstract out bin name validation
epage Apr 4, 2024
72ee140
refactor(toml): Split bin discovery from Target creation
epage Apr 4, 2024
c699941
refactor(toml): Move bin resolving up a level
epage Apr 4, 2024
943f9bc
refactor(toml): Track paths in TomlTarget, rather than next to it
epage Apr 4, 2024
36891ba
refactor(toml): Move unique name validation out of resolving
epage Apr 4, 2024
8439a4b
refactor(toml): Split target discovery from Target creation
epage Apr 4, 2024
e8f56df
refactor(toml): Clarify meaning of target 'clean' fn's
epage Apr 4, 2024
f243c91
refactor(toml): Move target resolving up a level
epage Apr 4, 2024
b2ca065
refactor(toml): Prefer common constant for bench dir name
epage Apr 5, 2024
b6c7544
refactor(toml): Avoid incomplete constant for bin dir name
epage Apr 5, 2024
f38136e
refactor(toml): Give higher level info to target inference
epage Apr 4, 2024
f1f7bbf
refactor(toml): Simplify file/dir target inference
epage Apr 4, 2024
ff41868
refactor(toml): Use relative paths in resolved targets
epage Apr 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use crate::util::{self, context::ConfigRelativePath, GlobalContext, IntoUrl, Opt
mod embedded;
mod targets;

use self::targets::targets;
use self::targets::to_targets;

/// See also `bin/cargo/commands/run.rs`s `is_manifest_command`
pub fn is_embedded(path: &Path) -> bool {
Expand Down Expand Up @@ -476,7 +476,7 @@ fn resolve_package_toml<'a>(
.map(|value| field_inherit_with(value, "documentation", || inherit()?.documentation()))
.transpose()?
.map(manifest::InheritableField::Value),
readme: readme_for_package(
readme: resolve_package_readme(
package_root,
original_package
.readme
Expand Down Expand Up @@ -530,7 +530,7 @@ fn resolve_package_toml<'a>(
}

/// Returns the name of the README file for a [`manifest::TomlPackage`].
fn readme_for_package(
fn resolve_package_readme(
package_root: &Path,
readme: Option<&manifest::StringOrBool>,
) -> Option<String> {
Expand Down Expand Up @@ -764,7 +764,7 @@ impl InheritableFields {

/// Gets the field `workspace.package.readme`.
fn readme(&self, package_root: &Path) -> CargoResult<manifest::StringOrBool> {
let Some(readme) = readme_for_package(
let Some(readme) = resolve_package_readme(
self._ws_root.as_path(),
self.package.as_ref().and_then(|p| p.readme.as_ref()),
) else {
Expand Down Expand Up @@ -1065,7 +1065,7 @@ fn to_real_manifest(
// If we have no lib at all, use the inferred lib, if available.
// If we have a lib with a path, we're done.
// If we have a lib with no path, use the inferred lib or else the package name.
let targets = targets(
let targets = to_targets(
&features,
&resolved_toml,
package_name,
Expand Down
Loading