@@ -13,7 +13,7 @@ use crate::cache::{Cache, CacheError};
13
13
use crate :: config:: { PackageName , ServiceName } ;
14
14
use crate :: input:: { BuildInput , BuildInputs , MappedPath , TargetDirectory , TargetPackage } ;
15
15
use crate :: progress:: { NoProgress , Progress } ;
16
- use crate :: target:: Target ;
16
+ use crate :: target:: TargetMap ;
17
17
use crate :: timer:: BuildTimer ;
18
18
19
19
use anyhow:: { anyhow, bail, Context , Result } ;
@@ -183,7 +183,7 @@ pub struct Package {
183
183
/// Identifies the targets for which the package should be included.
184
184
///
185
185
/// If ommitted, the package is assumed to be included for all targets.
186
- pub only_for_targets : Option < BTreeMap < String , String > > ,
186
+ pub only_for_targets : Option < TargetMap > ,
187
187
188
188
/// A human-readable string with suggestions for setup if packaging fails.
189
189
#[ serde( default ) ]
@@ -204,7 +204,7 @@ async fn new_zone_archive_builder(
204
204
/// Configuration that can modify how a package is built.
205
205
pub struct BuildConfig < ' a > {
206
206
/// Describes the [Target] to build the package for.
207
- pub target : & ' a Target ,
207
+ pub target : & ' a TargetMap ,
208
208
209
209
/// Describes how progress will be communicated back to the caller.
210
210
pub progress : & ' a dyn Progress ,
@@ -213,7 +213,7 @@ pub struct BuildConfig<'a> {
213
213
pub cache_disabled : bool ,
214
214
}
215
215
216
- static DEFAULT_TARGET : Target = Target ( BTreeMap :: new ( ) ) ;
216
+ static DEFAULT_TARGET : TargetMap = TargetMap ( BTreeMap :: new ( ) ) ;
217
217
static DEFAULT_PROGRESS : NoProgress = NoProgress :: new ( ) ;
218
218
219
219
impl Default for BuildConfig < ' _ > {
@@ -266,7 +266,7 @@ impl Package {
266
266
#[ deprecated = "Use 'Package::create', which now takes a 'BuildConfig', and implements 'Default'" ]
267
267
pub async fn create_for_target (
268
268
& self ,
269
- target : & Target ,
269
+ target : & TargetMap ,
270
270
name : & PackageName ,
271
271
output_directory : & Utf8Path ,
272
272
) -> Result < File > {
@@ -362,7 +362,7 @@ impl Package {
362
362
pub async fn create_with_progress_for_target (
363
363
& self ,
364
364
progress : & impl Progress ,
365
- target : & Target ,
365
+ target : & TargetMap ,
366
366
name : & PackageName ,
367
367
output_directory : & Utf8Path ,
368
368
) -> Result < File > {
@@ -444,7 +444,7 @@ impl Package {
444
444
445
445
fn get_paths_inputs (
446
446
& self ,
447
- target : & Target ,
447
+ target : & TargetMap ,
448
448
paths : & Vec < InterpolatedMappedPath > ,
449
449
) -> Result < BuildInputs > {
450
450
let mut inputs = BuildInputs :: new ( ) ;
@@ -532,7 +532,7 @@ impl Package {
532
532
fn get_all_inputs (
533
533
& self ,
534
534
package_name : & PackageName ,
535
- target : & Target ,
535
+ target : & TargetMap ,
536
536
output_directory : & Utf8Path ,
537
537
zoned : bool ,
538
538
version : Option < & semver:: Version > ,
@@ -870,7 +870,7 @@ pub struct InterpolatedString(String);
870
870
impl InterpolatedString {
871
871
// Interpret the string for the specified target.
872
872
// Substitutes key/value pairs as necessary.
873
- pub fn interpolate ( & self , target : & Target ) -> Result < String > {
873
+ pub fn interpolate ( & self , target : & TargetMap ) -> Result < String > {
874
874
let mut input = self . 0 . as_str ( ) ;
875
875
let mut output = String :: new ( ) ;
876
876
@@ -912,7 +912,7 @@ pub struct InterpolatedMappedPath {
912
912
}
913
913
914
914
impl InterpolatedMappedPath {
915
- fn interpolate ( & self , target : & Target ) -> Result < MappedPath > {
915
+ fn interpolate ( & self , target : & TargetMap ) -> Result < MappedPath > {
916
916
Ok ( MappedPath {
917
917
from : Utf8PathBuf :: from ( self . from . interpolate ( target) ?) ,
918
918
to : Utf8PathBuf :: from ( self . to . interpolate ( target) ?) ,
@@ -926,7 +926,7 @@ mod test {
926
926
927
927
#[ test]
928
928
fn interpolate_noop ( ) {
929
- let target = Target ( BTreeMap :: new ( ) ) ;
929
+ let target = TargetMap ( BTreeMap :: new ( ) ) ;
930
930
let is = InterpolatedString ( String :: from ( "nothing to change" ) ) ;
931
931
932
932
let s = is. interpolate ( & target) . unwrap ( ) ;
@@ -935,7 +935,7 @@ mod test {
935
935
936
936
#[ test]
937
937
fn interpolate_single ( ) {
938
- let mut target = Target ( BTreeMap :: new ( ) ) ;
938
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
939
939
target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
940
940
let is = InterpolatedString ( String :: from ( "{{key1}}" ) ) ;
941
941
@@ -945,7 +945,7 @@ mod test {
945
945
946
946
#[ test]
947
947
fn interpolate_single_with_prefix ( ) {
948
- let mut target = Target ( BTreeMap :: new ( ) ) ;
948
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
949
949
target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
950
950
let is = InterpolatedString ( String :: from ( "prefix-{{key1}}" ) ) ;
951
951
@@ -955,7 +955,7 @@ mod test {
955
955
956
956
#[ test]
957
957
fn interpolate_single_with_suffix ( ) {
958
- let mut target = Target ( BTreeMap :: new ( ) ) ;
958
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
959
959
target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
960
960
let is = InterpolatedString ( String :: from ( "{{key1}}-suffix" ) ) ;
961
961
@@ -965,7 +965,7 @@ mod test {
965
965
966
966
#[ test]
967
967
fn interpolate_multiple ( ) {
968
- let mut target = Target ( BTreeMap :: new ( ) ) ;
968
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
969
969
target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
970
970
target. 0 . insert ( "key2" . to_string ( ) , "value2" . to_string ( ) ) ;
971
971
let is = InterpolatedString ( String :: from ( "{{key1}}-{{key2}}" ) ) ;
@@ -976,7 +976,7 @@ mod test {
976
976
977
977
#[ test]
978
978
fn interpolate_missing_key ( ) {
979
- let mut target = Target ( BTreeMap :: new ( ) ) ;
979
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
980
980
target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
981
981
let is = InterpolatedString ( String :: from ( "{{key3}}" ) ) ;
982
982
@@ -991,7 +991,7 @@ mod test {
991
991
992
992
#[ test]
993
993
fn interpolate_missing_closing ( ) {
994
- let mut target = Target ( BTreeMap :: new ( ) ) ;
994
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
995
995
target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
996
996
let is = InterpolatedString ( String :: from ( "{{key1" ) ) ;
997
997
@@ -1011,7 +1011,7 @@ mod test {
1011
1011
// as part of they key -- INCLUDING other "{{" characters.
1012
1012
#[ test]
1013
1013
fn interpolate_key_as_literal ( ) {
1014
- let mut target = Target ( BTreeMap :: new ( ) ) ;
1014
+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
1015
1015
target. 0 . insert ( "oh{{no" . to_string ( ) , "value" . to_string ( ) ) ;
1016
1016
let is = InterpolatedString ( String :: from ( "{{oh{{no}}" ) ) ;
1017
1017
0 commit comments