@@ -321,14 +321,11 @@ fn verify_dependencies(
321
321
Ok ( ( ) )
322
322
}
323
323
324
- fn transmit (
324
+ pub ( crate ) fn prepare_transmit (
325
325
gctx : & GlobalContext ,
326
326
pkg : & Package ,
327
- tarball : & File ,
328
- registry : & mut Registry ,
329
327
registry_id : SourceId ,
330
- dry_run : bool ,
331
- ) -> CargoResult < ( ) > {
328
+ ) -> CargoResult < NewCrate > {
332
329
let deps = pkg
333
330
. dependencies ( )
334
331
. iter ( )
@@ -410,12 +407,6 @@ fn transmit(
410
407
}
411
408
}
412
409
413
- // Do not upload if performing a dry run
414
- if dry_run {
415
- gctx. shell ( ) . warn ( "aborting upload due to dry run" ) ?;
416
- return Ok ( ( ) ) ;
417
- }
418
-
419
410
let deps_set = deps
420
411
. iter ( )
421
412
. map ( |dep| dep. name . clone ( ) )
@@ -447,30 +438,46 @@ fn transmit(
447
438
None => BTreeMap :: new ( ) ,
448
439
} ;
449
440
441
+ Ok ( NewCrate {
442
+ name : pkg. name ( ) . to_string ( ) ,
443
+ vers : pkg. version ( ) . to_string ( ) ,
444
+ deps,
445
+ features : string_features,
446
+ authors : authors. clone ( ) ,
447
+ description : description. clone ( ) ,
448
+ homepage : homepage. clone ( ) ,
449
+ documentation : documentation. clone ( ) ,
450
+ keywords : keywords. clone ( ) ,
451
+ categories : categories. clone ( ) ,
452
+ readme : readme_content,
453
+ readme_file : readme. clone ( ) ,
454
+ repository : repository. clone ( ) ,
455
+ license : license. clone ( ) ,
456
+ license_file : license_file. clone ( ) ,
457
+ badges : badges. clone ( ) ,
458
+ links : links. clone ( ) ,
459
+ rust_version,
460
+ } )
461
+ }
462
+
463
+ fn transmit (
464
+ gctx : & GlobalContext ,
465
+ pkg : & Package ,
466
+ tarball : & File ,
467
+ registry : & mut Registry ,
468
+ registry_id : SourceId ,
469
+ dry_run : bool ,
470
+ ) -> CargoResult < ( ) > {
471
+ let new_crate = prepare_transmit ( gctx, pkg, registry_id) ?;
472
+
473
+ // Do not upload if performing a dry run
474
+ if dry_run {
475
+ gctx. shell ( ) . warn ( "aborting upload due to dry run" ) ?;
476
+ return Ok ( ( ) ) ;
477
+ }
478
+
450
479
let warnings = registry
451
- . publish (
452
- & NewCrate {
453
- name : pkg. name ( ) . to_string ( ) ,
454
- vers : pkg. version ( ) . to_string ( ) ,
455
- deps,
456
- features : string_features,
457
- authors : authors. clone ( ) ,
458
- description : description. clone ( ) ,
459
- homepage : homepage. clone ( ) ,
460
- documentation : documentation. clone ( ) ,
461
- keywords : keywords. clone ( ) ,
462
- categories : categories. clone ( ) ,
463
- readme : readme_content,
464
- readme_file : readme. clone ( ) ,
465
- repository : repository. clone ( ) ,
466
- license : license. clone ( ) ,
467
- license_file : license_file. clone ( ) ,
468
- badges : badges. clone ( ) ,
469
- links : links. clone ( ) ,
470
- rust_version,
471
- } ,
472
- tarball,
473
- )
480
+ . publish ( & new_crate, tarball)
474
481
. with_context ( || format ! ( "failed to publish to registry at {}" , registry. host( ) ) ) ?;
475
482
476
483
if !warnings. invalid_categories . is_empty ( ) {
0 commit comments