Skip to content

Commit 23f5ed0

Browse files
committed
feat(build): graduate Rust cargo-lambda support from experimental
Remove the experimental/beta flag requirement for building Rust functions with the rust-cargolambda build method. Users no longer need to pass --beta-features or set SAM_CLI_BETA_RUST_CARGO_LAMBDA=1 to build Rust Lambda functions. Changes: - Remove RustCargoLambda from ExperimentalFlag class - Remove _check_rust_cargo_experimental_flag() method from BuildContext - Update integration tests to not require beta_features flag - Update unit tests to remove mock for deleted method
1 parent f37dc09 commit 23f5ed0

File tree

4 files changed

+1
-25
lines changed

4 files changed

+1
-25
lines changed

samcli/commands/_utils/experimental.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class ExperimentalFlag:
5454
"experimentalTerraformSupport", EXPERIMENTAL_ENV_VAR_PREFIX + "TERRAFORM_SUPPORT"
5555
)
5656
}
57-
RustCargoLambda = ExperimentalEntry("experimentalCargoLambda", EXPERIMENTAL_ENV_VAR_PREFIX + "RUST_CARGO_LAMBDA")
5857

5958

6059
def is_experimental_enabled(config_entry: ExperimentalEntry) -> bool:

samcli/commands/build/build_context.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import click
1212

1313
from samcli.commands._utils.constants import DEFAULT_BUILD_DIR
14-
from samcli.commands._utils.experimental import ExperimentalFlag, prompt_experimental
1514
from samcli.commands._utils.template import (
1615
get_template_data,
1716
move_template,
@@ -281,7 +280,6 @@ def run(self) -> None:
281280
)
282281

283282
self._check_exclude_warning()
284-
self._check_rust_cargo_experimental_flag()
285283

286284
for f in self.get_resources_to_build().functions:
287285
EventTracker.track_event(EventName.BUILD_FUNCTION_RUNTIME.value, f.runtime)
@@ -696,25 +694,6 @@ def _check_exclude_warning(self) -> None:
696694
if self._resource_identifier in excludes:
697695
LOG.warning(self._EXCLUDE_WARNING_MESSAGE)
698696

699-
def _check_rust_cargo_experimental_flag(self) -> None:
700-
"""
701-
Prints warning message and confirms if user wants to use beta feature
702-
"""
703-
WARNING_MESSAGE = (
704-
'Build method "rust-cargolambda" is a beta feature.\n'
705-
"Please confirm if you would like to proceed\n"
706-
'You can also enable this beta feature with "sam build --beta-features".'
707-
)
708-
resources_to_build = self.get_resources_to_build()
709-
is_building_rust = False
710-
for function in resources_to_build.functions:
711-
if function.metadata and function.metadata.get("BuildMethod", "") == "rust-cargolambda":
712-
is_building_rust = True
713-
break
714-
715-
if is_building_rust:
716-
prompt_experimental(ExperimentalFlag.RustCargoLambda, WARNING_MESSAGE)
717-
718697
@property
719698
def build_in_source(self) -> Optional[bool]:
720699
return self._build_in_source

tests/integration/buildcmd/build_integ_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ def _test_with_rust_cargo_lambda(
11411141
overrides = self.get_override(runtime, code_uri, architecture, handler)
11421142
if binary:
11431143
overrides["Binary"] = binary
1144-
cmdlist = self.get_command_list(use_container=use_container, parameter_overrides=overrides, beta_features=True)
1144+
cmdlist = self.get_command_list(use_container=use_container, parameter_overrides=overrides)
11451145

11461146
newenv = os.environ.copy()
11471147
if build_mode:

tests/unit/commands/buildcmd/test_build_context.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,14 +1254,12 @@ def test_must_catch_function_not_found_exception(
12541254
@patch("samcli.commands.build.build_context.BuildContext._is_sam_template")
12551255
@patch("samcli.commands.build.build_context.BuildContext.get_resources_to_build")
12561256
@patch("samcli.commands.build.build_context.BuildContext._check_exclude_warning")
1257-
@patch("samcli.commands.build.build_context.BuildContext._check_rust_cargo_experimental_flag")
12581257
@patch("samcli.lib.build.app_builder.ApplicationBuilder.build")
12591258
@patch("samcli.lib.telemetry.event.EventTracker.track_event")
12601259
def test_build_in_source_event_sent(
12611260
self,
12621261
mock_track_event,
12631262
mock_builder,
1264-
mock_rust,
12651263
mock_warning,
12661264
mock_get_resources,
12671265
mock_is_sam_template,

0 commit comments

Comments
 (0)