Skip to content

Commit 30af6de

Browse files
committed
Remove profiles information from the package structure.
Signed-off-by: David Calavera <david.calavera@gmail.com>
1 parent 78c108f commit 30af6de

File tree

4 files changed

+22
-36
lines changed

4 files changed

+22
-36
lines changed

src/cargo/core/package.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use crate::util::network::http::http_handle_and_timeout;
3131
use crate::util::network::http::HttpTimeout;
3232
use crate::util::network::retry::{Retry, RetryResult};
3333
use crate::util::network::sleep::SleepTracker;
34-
use crate::util::toml::TomlProfiles;
3534
use crate::util::PartialVersion;
3635
use crate::util::{self, internal, Config, Progress, ProgressStyle};
3736

@@ -106,8 +105,6 @@ pub struct SerializedPackage {
106105
metabuild: Option<Vec<String>>,
107106
default_run: Option<String>,
108107
rust_version: Option<PartialVersion>,
109-
#[serde(skip_serializing_if = "Option::is_none")]
110-
profiles: Option<TomlProfiles>,
111108
}
112109

113110
impl Package {
@@ -267,7 +264,6 @@ impl Package {
267264
publish: self.publish().as_ref().cloned(),
268265
default_run: self.manifest().default_run().map(|s| s.to_owned()),
269266
rust_version: self.rust_version(),
270-
profiles: self.manifest().profiles().cloned(),
271267
}
272268
}
273269
}

src/cargo/ops/cargo_output_metadata.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::core::compiler::{CompileKind, RustcTargetData};
33
use crate::core::dependency::DepKind;
44
use crate::core::package::SerializedPackage;
55
use crate::core::resolver::{features::CliFeatures, HasDevUnits, Resolve};
6-
use crate::core::{MaybePackage, Package, PackageId, Workspace};
6+
use crate::core::{Package, PackageId, Workspace};
77
use crate::ops::{self, Packages};
88
use crate::util::interning::InternedString;
99
use crate::util::toml::TomlProfiles;
@@ -41,11 +41,6 @@ pub fn output_metadata(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> Cargo
4141
(packages, Some(resolve))
4242
};
4343

44-
let workspace_profiles = match ws.root_maybe() {
45-
MaybePackage::Virtual(vm) => vm.profiles().cloned(),
46-
_ => None, // regular packages include the profile information under their package section
47-
};
48-
4944
Ok(ExportInfo {
5045
packages,
5146
workspace_members: ws.members().map(|pkg| pkg.package_id()).collect(),
@@ -55,7 +50,7 @@ pub fn output_metadata(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> Cargo
5550
version: VERSION,
5651
workspace_root: ws.root().to_path_buf(),
5752
metadata: ws.custom_metadata().cloned(),
58-
workspace_profiles,
53+
profiles: ws.profiles().cloned(),
5954
})
6055
}
6156

@@ -73,7 +68,7 @@ pub struct ExportInfo {
7368
workspace_root: PathBuf,
7469
metadata: Option<toml::Value>,
7570
#[serde(skip_serializing_if = "Option::is_none")]
76-
workspace_profiles: Option<TomlProfiles>,
71+
profiles: Option<TomlProfiles>,
7772
}
7873

7974
#[derive(Serialize)]

tests/testsuite/metadata.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4322,15 +4322,7 @@ lto = "thin"
43224322
"features": {},
43234323
"manifest_path": "[..]Cargo.toml",
43244324
"metadata": null,
4325-
"publish": null,
4326-
"profiles": {
4327-
"custom-lto": {
4328-
"lto": "thin"
4329-
},
4330-
"release": {
4331-
"strip": "symbols"
4332-
}
4333-
}
4325+
"publish": null
43344326
}
43354327
],
43364328
"workspace_members": ["foo 0.5.0 (path+file:[..]foo)"],
@@ -4349,7 +4341,15 @@ lto = "thin"
43494341
"target_directory": "[..]foo/target",
43504342
"version": 1,
43514343
"workspace_root": "[..]/foo",
4352-
"metadata": null
4344+
"metadata": null,
4345+
"profiles": {
4346+
"custom-lto": {
4347+
"lto": "thin"
4348+
},
4349+
"release": {
4350+
"strip": "symbols"
4351+
}
4352+
}
43534353
}"#,
43544354
)
43554355
.run();
@@ -4484,7 +4484,7 @@ fn workspace_metadata_with_profiles() {
44844484
"version": 1,
44854485
"workspace_root": "[..]/foo",
44864486
"metadata": null,
4487-
"workspace_profiles": {
4487+
"profiles": {
44884488
"custom-lto": {
44894489
"lto": "thin"
44904490
},

tests/testsuite/script.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,12 +1061,7 @@ fn cmd_metadata_with_embedded() {
10611061
"features": {},
10621062
"manifest_path": "[..]script.rs",
10631063
"metadata": null,
1064-
"publish": [],
1065-
"profiles": {
1066-
"release": {
1067-
"strip": true
1068-
}
1069-
}
1064+
"publish": []
10701065
}
10711066
],
10721067
"workspace_members": ["script 0.0.0 (path+file:[..]foo)"],
@@ -1085,7 +1080,12 @@ fn cmd_metadata_with_embedded() {
10851080
"target_directory": "[ROOT]/home/.cargo/target/[..]",
10861081
"version": 1,
10871082
"workspace_root": "[..]/foo",
1088-
"metadata": null
1083+
"metadata": null,
1084+
"profiles": {
1085+
"release": {
1086+
"strip": true
1087+
}
1088+
}
10891089
}"#,
10901090
)
10911091
.with_stderr(
@@ -1141,12 +1141,7 @@ fn cmd_read_manifest_with_embedded() {
11411141
"features":{},
11421142
"manifest_path":"[..]script.rs",
11431143
"metadata": null,
1144-
"publish": [],
1145-
"profiles": {
1146-
"release": {
1147-
"strip": true
1148-
}
1149-
}
1144+
"publish": []
11501145
}"#,
11511146
)
11521147
.with_stderr(

0 commit comments

Comments
 (0)