@@ -7,7 +7,6 @@ use std::sync::Arc;
77use std:: task:: Poll ;
88
99use crate :: core:: compiler:: { BuildConfig , CompileMode , DefaultExecutor , Executor } ;
10- use crate :: core:: manifest;
1110use crate :: core:: manifest:: Target ;
1211use crate :: core:: resolver:: CliFeatures ;
1312use crate :: core:: { registry:: PackageRegistry , resolver:: HasDevUnits } ;
@@ -17,7 +16,7 @@ use crate::sources::PathSource;
1716use crate :: util:: cache_lock:: CacheLockMode ;
1817use crate :: util:: context:: JobsConfig ;
1918use crate :: util:: errors:: CargoResult ;
20- use crate :: util:: toml:: { prepare_for_publish, to_real_manifest } ;
19+ use crate :: util:: toml:: prepare_for_publish;
2120use crate :: util:: { self , human_readable_bytes, restricted_names, FileLock , GlobalContext } ;
2221use crate :: { drop_println, ops} ;
2322use anyhow:: Context as _;
@@ -453,24 +452,7 @@ fn build_lock(ws: &Workspace<'_>, orig_pkg: &Package) -> CargoResult<String> {
453452 let gctx = ws. gctx ( ) ;
454453 let orig_resolve = ops:: load_pkg_lockfile ( ws) ?;
455454
456- // Convert Package -> TomlManifest -> Manifest -> Package
457- let contents = orig_pkg. manifest ( ) . contents ( ) ;
458- let document = orig_pkg. manifest ( ) . document ( ) ;
459- let toml_manifest =
460- prepare_for_publish ( orig_pkg. manifest ( ) . resolved_toml ( ) , ws, orig_pkg. root ( ) ) ?;
461- let source_id = orig_pkg. package_id ( ) . source_id ( ) ;
462- let mut warnings = Default :: default ( ) ;
463- let mut errors = Default :: default ( ) ;
464- let manifest = to_real_manifest (
465- contents. to_owned ( ) ,
466- document. clone ( ) ,
467- toml_manifest,
468- source_id,
469- orig_pkg. manifest_path ( ) ,
470- gctx,
471- & mut warnings,
472- & mut errors,
473- ) ?;
455+ let manifest = prepare_for_publish ( orig_pkg, ws) ?;
474456 let new_pkg = Package :: new ( manifest, orig_pkg. manifest_path ( ) ) ;
475457
476458 // Regenerate Cargo.lock using the old one as a guide.
@@ -736,10 +718,8 @@ fn tar(
736718 FileContents :: Generated ( generated_kind) => {
737719 let contents = match generated_kind {
738720 GeneratedFile :: Manifest => {
739- let manifest =
740- prepare_for_publish ( pkg. manifest ( ) . resolved_toml ( ) , ws, pkg. root ( ) ) ?;
741- let toml = toml:: to_string_pretty ( & manifest) ?;
742- format ! ( "{}\n {}" , manifest:: MANIFEST_PREAMBLE , toml)
721+ let manifest = prepare_for_publish ( pkg, ws) ?;
722+ manifest. to_resolved_contents ( ) ?
743723 }
744724 GeneratedFile :: Lockfile => build_lock ( ws, pkg) ?,
745725 GeneratedFile :: VcsInfo ( ref s) => serde_json:: to_string_pretty ( s) ?,
0 commit comments