create region via allocator so it survives until through make phase

This commit is contained in:
Emil Lerch 2024-08-28 09:47:01 -07:00
parent a8a560a480
commit 91149957b5
Signed by untrusted user: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -93,7 +93,8 @@ pub fn configureBuild(b: *std.Build, exe: *std.Build.Step.Compile, function_name
const iam_step = b.step("awslambda_iam", "Create/Get IAM role for function"); const iam_step = b.step("awslambda_iam", "Create/Get IAM role for function");
iam_step.dependOn(&iam.step); iam_step.dependOn(&iam.step);
var region = @import("lambdabuild/Region.zig"){ const region = try b.allocator.create(@import("lambdabuild/Region.zig"));
region.* = .{
.allocator = b.allocator, .allocator = b.allocator,
.specified_region = b.option([]const u8, "region", "Region to use [default is autodetect from environment/config]"), .specified_region = b.option([]const u8, "region", "Region to use [default is autodetect from environment/config]"),
}; };
@ -104,7 +105,7 @@ pub fn configureBuild(b: *std.Build, exe: *std.Build.Step.Compile, function_name
.package = package_step.packagedFileLazyPath(), .package = package_step.packagedFileLazyPath(),
.arch = exe.root_module.resolved_target.?.result.cpu.arch, .arch = exe.root_module.resolved_target.?.result.cpu.arch,
.iam_step = iam, .iam_step = iam,
.region = &region, .region = region,
}); });
deploy.step.dependOn(&package_step.step); deploy.step.dependOn(&package_step.step);
@ -118,7 +119,7 @@ pub fn configureBuild(b: *std.Build, exe: *std.Build.Step.Compile, function_name
const invoke = Invoke.create(b, .{ const invoke = Invoke.create(b, .{
.name = function_name, .name = function_name,
.payload = payload, .payload = payload,
.region = &region, .region = region,
}); });
invoke.step.dependOn(&deploy.step); invoke.step.dependOn(&deploy.step);
const run_step = b.step("awslambda_run", "Run the app in AWS lambda"); const run_step = b.step("awslambda_run", "Run the app in AWS lambda");