File tree 2 files changed +19
-13
lines changed
2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,24 @@ impl Package {
186
186
self . targets ( ) . iter ( ) . any ( |t| t. is_custom_build ( ) )
187
187
}
188
188
189
+ /// Returns explicit kinds either forced by `forced-target` in `Cargo.toml`,
190
+ /// fallback to `default-target`, or specified in cli parameters.
191
+ pub fn explicit_kinds ( & self , requested_kinds : & [ CompileKind ] , explicit_host_kind : CompileKind ) -> Vec < CompileKind > {
192
+ if let Some ( k) = self . manifest ( ) . forced_kind ( ) {
193
+ vec ! [ k]
194
+ } else {
195
+ requested_kinds
196
+ . iter ( )
197
+ . map ( |kind| match kind {
198
+ CompileKind :: Host => {
199
+ self . manifest ( ) . default_kind ( ) . unwrap_or ( explicit_host_kind)
200
+ }
201
+ CompileKind :: Target ( t) => CompileKind :: Target ( * t) ,
202
+ } )
203
+ . collect ( )
204
+ }
205
+ }
206
+
189
207
pub fn map_source ( self , to_replace : SourceId , replace_with : SourceId ) -> Package {
190
208
Package {
191
209
inner : Rc :: new ( PackageInner {
Original file line number Diff line number Diff line change @@ -1065,19 +1065,7 @@ fn generate_targets(
1065
1065
// why this is done. However, if the package has its own
1066
1066
// `package.target` key, then this gets used instead of
1067
1067
// `$HOST`
1068
- let explicit_kinds = if let Some ( k) = pkg. manifest ( ) . forced_kind ( ) {
1069
- vec ! [ k]
1070
- } else {
1071
- requested_kinds
1072
- . iter ( )
1073
- . map ( |kind| match kind {
1074
- CompileKind :: Host => {
1075
- pkg. manifest ( ) . default_kind ( ) . unwrap_or ( explicit_host_kind)
1076
- }
1077
- CompileKind :: Target ( t) => CompileKind :: Target ( * t) ,
1078
- } )
1079
- . collect ( )
1080
- } ;
1068
+ let explicit_kinds = pkg. explicit_kinds ( requested_kinds, explicit_host_kind) ;
1081
1069
1082
1070
for kind in explicit_kinds. iter ( ) {
1083
1071
let profile = profiles. get_profile (
You can’t perform that action at this time.
0 commit comments