@@ -13,7 +13,7 @@ use crate::cache::{Cache, CacheError};
1313use crate :: config:: { PackageName , ServiceName } ;
1414use crate :: input:: { BuildInput , BuildInputs , MappedPath , TargetDirectory , TargetPackage } ;
1515use crate :: progress:: { NoProgress , Progress } ;
16- use crate :: target:: Target ;
16+ use crate :: target:: TargetMap ;
1717use crate :: timer:: BuildTimer ;
1818
1919use anyhow:: { anyhow, bail, Context , Result } ;
@@ -183,7 +183,7 @@ pub struct Package {
183183 /// Identifies the targets for which the package should be included.
184184 ///
185185 /// 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 > ,
187187
188188 /// A human-readable string with suggestions for setup if packaging fails.
189189 #[ serde( default ) ]
@@ -204,7 +204,7 @@ async fn new_zone_archive_builder(
204204/// Configuration that can modify how a package is built.
205205pub struct BuildConfig < ' a > {
206206 /// Describes the [Target] to build the package for.
207- pub target : & ' a Target ,
207+ pub target : & ' a TargetMap ,
208208
209209 /// Describes how progress will be communicated back to the caller.
210210 pub progress : & ' a dyn Progress ,
@@ -213,7 +213,7 @@ pub struct BuildConfig<'a> {
213213 pub cache_disabled : bool ,
214214}
215215
216- static DEFAULT_TARGET : Target = Target ( BTreeMap :: new ( ) ) ;
216+ static DEFAULT_TARGET : TargetMap = TargetMap ( BTreeMap :: new ( ) ) ;
217217static DEFAULT_PROGRESS : NoProgress = NoProgress :: new ( ) ;
218218
219219impl Default for BuildConfig < ' _ > {
@@ -266,7 +266,7 @@ impl Package {
266266 #[ deprecated = "Use 'Package::create', which now takes a 'BuildConfig', and implements 'Default'" ]
267267 pub async fn create_for_target (
268268 & self ,
269- target : & Target ,
269+ target : & TargetMap ,
270270 name : & PackageName ,
271271 output_directory : & Utf8Path ,
272272 ) -> Result < File > {
@@ -362,7 +362,7 @@ impl Package {
362362 pub async fn create_with_progress_for_target (
363363 & self ,
364364 progress : & impl Progress ,
365- target : & Target ,
365+ target : & TargetMap ,
366366 name : & PackageName ,
367367 output_directory : & Utf8Path ,
368368 ) -> Result < File > {
@@ -444,7 +444,7 @@ impl Package {
444444
445445 fn get_paths_inputs (
446446 & self ,
447- target : & Target ,
447+ target : & TargetMap ,
448448 paths : & Vec < InterpolatedMappedPath > ,
449449 ) -> Result < BuildInputs > {
450450 let mut inputs = BuildInputs :: new ( ) ;
@@ -532,7 +532,7 @@ impl Package {
532532 fn get_all_inputs (
533533 & self ,
534534 package_name : & PackageName ,
535- target : & Target ,
535+ target : & TargetMap ,
536536 output_directory : & Utf8Path ,
537537 zoned : bool ,
538538 version : Option < & semver:: Version > ,
@@ -870,7 +870,7 @@ pub struct InterpolatedString(String);
870870impl InterpolatedString {
871871 // Interpret the string for the specified target.
872872 // Substitutes key/value pairs as necessary.
873- pub fn interpolate ( & self , target : & Target ) -> Result < String > {
873+ pub fn interpolate ( & self , target : & TargetMap ) -> Result < String > {
874874 let mut input = self . 0 . as_str ( ) ;
875875 let mut output = String :: new ( ) ;
876876
@@ -912,7 +912,7 @@ pub struct InterpolatedMappedPath {
912912}
913913
914914impl InterpolatedMappedPath {
915- fn interpolate ( & self , target : & Target ) -> Result < MappedPath > {
915+ fn interpolate ( & self , target : & TargetMap ) -> Result < MappedPath > {
916916 Ok ( MappedPath {
917917 from : Utf8PathBuf :: from ( self . from . interpolate ( target) ?) ,
918918 to : Utf8PathBuf :: from ( self . to . interpolate ( target) ?) ,
@@ -926,7 +926,7 @@ mod test {
926926
927927 #[ test]
928928 fn interpolate_noop ( ) {
929- let target = Target ( BTreeMap :: new ( ) ) ;
929+ let target = TargetMap ( BTreeMap :: new ( ) ) ;
930930 let is = InterpolatedString ( String :: from ( "nothing to change" ) ) ;
931931
932932 let s = is. interpolate ( & target) . unwrap ( ) ;
@@ -935,7 +935,7 @@ mod test {
935935
936936 #[ test]
937937 fn interpolate_single ( ) {
938- let mut target = Target ( BTreeMap :: new ( ) ) ;
938+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
939939 target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
940940 let is = InterpolatedString ( String :: from ( "{{key1}}" ) ) ;
941941
@@ -945,7 +945,7 @@ mod test {
945945
946946 #[ test]
947947 fn interpolate_single_with_prefix ( ) {
948- let mut target = Target ( BTreeMap :: new ( ) ) ;
948+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
949949 target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
950950 let is = InterpolatedString ( String :: from ( "prefix-{{key1}}" ) ) ;
951951
@@ -955,7 +955,7 @@ mod test {
955955
956956 #[ test]
957957 fn interpolate_single_with_suffix ( ) {
958- let mut target = Target ( BTreeMap :: new ( ) ) ;
958+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
959959 target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
960960 let is = InterpolatedString ( String :: from ( "{{key1}}-suffix" ) ) ;
961961
@@ -965,7 +965,7 @@ mod test {
965965
966966 #[ test]
967967 fn interpolate_multiple ( ) {
968- let mut target = Target ( BTreeMap :: new ( ) ) ;
968+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
969969 target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
970970 target. 0 . insert ( "key2" . to_string ( ) , "value2" . to_string ( ) ) ;
971971 let is = InterpolatedString ( String :: from ( "{{key1}}-{{key2}}" ) ) ;
@@ -976,7 +976,7 @@ mod test {
976976
977977 #[ test]
978978 fn interpolate_missing_key ( ) {
979- let mut target = Target ( BTreeMap :: new ( ) ) ;
979+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
980980 target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
981981 let is = InterpolatedString ( String :: from ( "{{key3}}" ) ) ;
982982
@@ -991,7 +991,7 @@ mod test {
991991
992992 #[ test]
993993 fn interpolate_missing_closing ( ) {
994- let mut target = Target ( BTreeMap :: new ( ) ) ;
994+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
995995 target. 0 . insert ( "key1" . to_string ( ) , "value1" . to_string ( ) ) ;
996996 let is = InterpolatedString ( String :: from ( "{{key1" ) ) ;
997997
@@ -1011,7 +1011,7 @@ mod test {
10111011 // as part of they key -- INCLUDING other "{{" characters.
10121012 #[ test]
10131013 fn interpolate_key_as_literal ( ) {
1014- let mut target = Target ( BTreeMap :: new ( ) ) ;
1014+ let mut target = TargetMap ( BTreeMap :: new ( ) ) ;
10151015 target. 0 . insert ( "oh{{no" . to_string ( ) , "value" . to_string ( ) ) ;
10161016 let is = InterpolatedString ( String :: from ( "{{oh{{no}}" ) ) ;
10171017
0 commit comments