Skip to content

Commit f9ffd0c

Browse files
Merge branch 'develop'
2 parents 008bf08 + 4b8b675 commit f9ffd0c

File tree

5 files changed

+43
-14
lines changed

5 files changed

+43
-14
lines changed

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# Changing version will trigger a new release!
66
# Please make the version change as the last step of your development.
77

8-
__version__ = "1.49.0"
8+
__version__ = "1.50.0"
99
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/workflows/python_pip/packager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ class DependencyBuilder(object):
203203
"cp37m": (2, 17),
204204
"cp38": (2, 26),
205205
"cp39": (2, 26),
206+
"cp310": (2, 26),
207+
"cp311": (2, 26),
208+
"cp312": (2, 26),
206209
}
207210
# Fallback version if we're on an unknown python version
208211
# not in _RUNTIME_GLIBC.

aws_lambda_builders/workflows/rust_cargo/cargo_lambda.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ def run(self, command, cwd):
100100
if "RUST_LOG" not in os.environ:
101101
os.environ["RUST_LOG"] = "debug"
102102
LOG.debug("RUST_LOG environment variable set to `%s`", os.environ.get("RUST_LOG"))
103+
104+
if not os.getenv("CARGO_TARGET_DIR"):
105+
# This results in the "target" dir being created under the member dir of a cargo workspace
106+
# This is for supporting sam build for a Cargo Workspace project
107+
os.environ["CARGO_TARGET_DIR"] = "target"
108+
103109
cargo_process = self._osutils.popen(
104110
command,
105111
stderr=subprocess.PIPE,

requirements/dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
coverage==7.4.4
1+
coverage==7.5.1
22
flake8==3.8.4
33
pytest-cov==5.0.0
44

@@ -8,5 +8,5 @@ parameterized==0.9.0
88
pyelftools~=0.31 # Used to verify the generated Go binary architecture in integration tests (utils.py)
99

1010
# formatter
11-
black==24.4.0
12-
ruff==0.4.1
11+
black==24.4.2
12+
ruff==0.4.3

tests/integration/workflows/rust_cargo/test_rust_cargo.py

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from aws_lambda_builders.workflows.rust_cargo.feature_flag import EXPERIMENTAL_FLAG_CARGO_LAMBDA
1010

1111

12-
def rm_target_lambda(base):
13-
shutil.rmtree(os.path.join(base, "target", "lambda"), ignore_errors=True)
12+
def rm_target(base):
13+
shutil.rmtree(os.path.join(base, "target"), ignore_errors=True)
1414

1515

1616
class TestRustCargo(TestCase):
@@ -52,7 +52,7 @@ def test_failed_build_project(self):
5252

5353
def test_builds_hello_project(self):
5454
source_dir = os.path.join(self.TEST_DATA_FOLDER, "hello")
55-
rm_target_lambda(source_dir)
55+
rm_target(source_dir)
5656

5757
self.builder.build(
5858
source_dir,
@@ -70,7 +70,7 @@ def test_builds_hello_project(self):
7070

7171
def test_builds_hello_project_with_artifact_name(self):
7272
source_dir = os.path.join(self.TEST_DATA_FOLDER, "hello")
73-
rm_target_lambda(source_dir)
73+
rm_target(source_dir)
7474

7575
self.builder.build(
7676
source_dir,
@@ -89,7 +89,7 @@ def test_builds_hello_project_with_artifact_name(self):
8989

9090
def test_builds_hello_project_for_arm64(self):
9191
source_dir = os.path.join(self.TEST_DATA_FOLDER, "hello")
92-
rm_target_lambda(source_dir)
92+
rm_target(source_dir)
9393

9494
self.builder.build(
9595
source_dir,
@@ -109,10 +109,10 @@ def test_builds_hello_project_for_arm64(self):
109109

110110
def test_builds_workspaces_project_with_bin_name(self):
111111
source_dir = os.path.join(self.TEST_DATA_FOLDER, "workspaces")
112-
rm_target_lambda(source_dir)
112+
rm_target(source_dir)
113113

114114
self.builder.build(
115-
source_dir,
115+
f"{source_dir}",
116116
self.artifacts_dir,
117117
self.scratch_dir,
118118
os.path.join(source_dir, "Cargo.toml"),
@@ -125,10 +125,30 @@ def test_builds_workspaces_project_with_bin_name(self):
125125
output_files = set(os.listdir(self.artifacts_dir))
126126

127127
self.assertEqual(expected_files, output_files)
128+
self.assertIn("foo", os.listdir(os.path.join(source_dir, "target", "lambda")))
129+
130+
def test_builds_workspace_member(self):
131+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "workspaces")
132+
rm_target(source_dir)
133+
134+
self.builder.build(
135+
f"{source_dir}/bar",
136+
self.artifacts_dir,
137+
self.scratch_dir,
138+
os.path.join(source_dir, "Cargo.toml"),
139+
runtime=self.runtime,
140+
experimental_flags=[EXPERIMENTAL_FLAG_CARGO_LAMBDA],
141+
)
142+
143+
expected_files = {"bootstrap"}
144+
output_files = set(os.listdir(self.artifacts_dir))
145+
146+
self.assertEqual(expected_files, output_files)
147+
self.assertIn("bar", os.path.join(source_dir, "bar", "target", "lambda"))
128148

129149
def test_builds_workspaces_project_with_package_option(self):
130150
source_dir = os.path.join(self.TEST_DATA_FOLDER, "workspaces")
131-
rm_target_lambda(source_dir)
151+
rm_target(source_dir)
132152

133153
self.builder.build(
134154
source_dir,
@@ -147,7 +167,7 @@ def test_builds_workspaces_project_with_package_option(self):
147167

148168
def test_builds_multi_function_project_with_function_a(self):
149169
source_dir = os.path.join(self.TEST_DATA_FOLDER, "multi-binary")
150-
rm_target_lambda(source_dir)
170+
rm_target(source_dir)
151171

152172
self.builder.build(
153173
source_dir,
@@ -166,7 +186,7 @@ def test_builds_multi_function_project_with_function_a(self):
166186

167187
def test_builds_multi_function_project_with_function_b(self):
168188
source_dir = os.path.join(self.TEST_DATA_FOLDER, "multi-binary")
169-
rm_target_lambda(source_dir)
189+
rm_target(source_dir)
170190

171191
self.builder.build(
172192
source_dir,

0 commit comments

Comments
 (0)