@@ -281,8 +281,7 @@ def run(self) -> None:
281281 )
282282
283283 self ._check_exclude_warning ()
284- self ._check_build_method_experimental_flag ('rust-cargolambda' )
285- self ._check_build_method_experimental_flag ('python-uv' )
284+ self ._check_build_method_experimental_flag ()
286285
287286 for f in self .get_resources_to_build ().functions :
288287 EventTracker .track_event (EventName .BUILD_FUNCTION_RUNTIME .value , f .runtime )
@@ -697,24 +696,23 @@ def _check_exclude_warning(self) -> None:
697696 if self ._resource_identifier in excludes :
698697 LOG .warning (self ._EXCLUDE_WARNING_MESSAGE )
699698
700- def _check_build_method_experimental_flag (self , build_method : str ) -> None :
699+ def _check_build_method_experimental_flag (self ) -> None :
701700 """
702701 Prints warning message and confirms if user wants to use beta feature
703702 """
704- WARNING_MESSAGE = (
705- f'Build method "{ build_method } " is a beta feature.\n '
706- 'Please confirm if you would like to proceed\n '
707- 'You can also enable this beta feature with "sam build --beta-features".'
708- )
703+ EXPERIMENTAL_BUILD_METHODS = { "rust-cargolambda" : ExperimentalFlag .RustCargoLambda , "python-uv" : ExperimentalFlag .UvPackageManager }
704+
709705 resources_to_build = self .get_resources_to_build ()
710- is_building_experimental = False
711706 for function in resources_to_build .functions :
712- if function .metadata and function .metadata .get ("BuildMethod" , "" ) == build_method :
713- is_building_experimental = True
714- break
707+ if function .metadata and function .metadata .get ("BuildMethod" , "" ) in EXPERIMENTAL_BUILD_METHODS :
708+ build_method = function .metadata .get ("BuildMethod" , "" )
709+ WARNING_MESSAGE = (
710+ f'Build method "{ build_method } " is a beta feature.\n '
711+ 'Please confirm if you would like to proceed\n '
712+ 'You can also enable this beta feature with "sam build --beta-features".'
713+ )
715714
716- if is_building_experimental :
717- prompt_experimental (ExperimentalFlag .RustCargoLambda if build_method == "rust-cargolambda" else ExperimentalFlag .UvPackageManager , WARNING_MESSAGE )
715+ prompt_experimental (EXPERIMENTAL_BUILD_METHODS [build_method ], WARNING_MESSAGE )
718716
719717 @property
720718 def build_in_source (self ) -> Optional [bool ]:
0 commit comments