@@ -526,47 +526,25 @@ fn compute_deps_custom_build(
526
526
dep. kind ( ) == DepKind :: Build && dep. artifact ( ) . is_some ( )
527
527
} ) ;
528
528
529
- build_artifact_requirements_to_units (
530
- unit,
531
- unit_for. root_compile_kind ( ) ,
532
- artifact_build_deps,
533
- state,
534
- & mut result,
535
- ) ?;
536
-
537
- Ok ( result)
538
- }
539
-
540
- /// Given a `parent` unit which is a build script with artifact dependencies `artifact_deps`,
541
- /// produce units that build all required artifact kinds (like binaries,
542
- /// static libraries, etc) with the correct compile target.
543
- ///
544
- /// Computing the compile target for artifact units is more involved as it has to handle
545
- /// various target configurations specific to artifacts, like `target = "target"` and
546
- /// `target = "<triple>"`, which makes knowing the root units compile target
547
- /// `root_unit_compile_target` necessary.
548
- fn build_artifact_requirements_to_units (
549
- parent : & Unit ,
550
- root_unit_compile_target : CompileKind ,
551
- artifact_deps : Vec < ( PackageId , & HashSet < Dependency > ) > ,
552
- state : & State < ' _ , ' _ > ,
553
- ret : & mut Vec < UnitDep > ,
554
- ) -> CargoResult < ( ) > {
555
- // This really wants to be true for build dependencies, otherwise resolver = "2"
556
- // will fail. // It means that the host features will be separated from normal
557
- // features, thus won't be unified with them.
558
- let host_features = true ;
559
- let unit_for = UnitFor :: new_host ( host_features, root_unit_compile_target) ;
560
- for ( dep_pkg_id, deps) in artifact_deps {
529
+ // Produce units that build all required artifact kinds (like binaries,
530
+ // static libraries, etc) with the correct compile target.
531
+ //
532
+ // Computing the compile target for artifact units is more involved as it has to handle
533
+ // various target configurations specific to artifacts, like `target = "target"` and
534
+ // `target = "<triple>"`, which makes knowing the root units compile target
535
+ // `root_unit_compile_target` necessary.
536
+ let root_unit_compile_target = unit_for. root_compile_kind ( ) ;
537
+ let unit_for = UnitFor :: new_host ( /*host_features*/ true , root_unit_compile_target) ;
538
+ for ( dep_pkg_id, deps) in artifact_build_deps {
561
539
let artifact_pkg = state. get ( dep_pkg_id) ;
562
540
for build_dep in deps. iter ( ) . filter ( |d| d. is_build ( ) ) {
563
541
let artifact = build_dep. artifact ( ) . expect ( "artifact dep" ) ;
564
542
let resolved_artifact_compile_kind = artifact
565
543
. target ( )
566
544
. map ( |target| target. to_resolved_compile_kind ( root_unit_compile_target) ) ;
567
545
568
- ret . extend ( artifact_targets_to_unit_deps (
569
- parent ,
546
+ result . extend ( artifact_targets_to_unit_deps (
547
+ unit ,
570
548
unit_for. with_artifact_features_from_resolved_compile_kind (
571
549
resolved_artifact_compile_kind,
572
550
) ,
@@ -577,7 +555,8 @@ fn build_artifact_requirements_to_units(
577
555
) ?) ;
578
556
}
579
557
}
580
- Ok ( ( ) )
558
+
559
+ Ok ( result)
581
560
}
582
561
583
562
/// Given a `parent` unit containing a dependency `dep` whose package is `artifact_pkg`,
0 commit comments