Skip to content

Commit 89e72df

Browse files
committed
allow for explicitly turning on debuginfo for builds
1 parent cf459f0 commit 89e72df

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RustPlugin {
5050
this.serverless.service.package.excludeDevDependencies = false;
5151
}
5252

53-
runDocker(funcArgs, cargoPackage, binary, profile) {
53+
runDocker(funcArgs, cargoPackage, binary, profile, debugInfo) {
5454
const cargoHome = process.env.CARGO_HOME || path.join(homedir(), ".cargo");
5555
const cargoRegistry = path.join(cargoHome, "registry");
5656
const cargoDownloads = path.join(cargoHome, "git");
@@ -74,6 +74,9 @@ class RustPlugin {
7474
// release or dev
7575
customArgs.push("-e", `PROFILE=${profile}`);
7676
}
77+
if (debugInfo) {
78+
customArgs.push("-e", `DEBUGINFO=${debugInfo}`);
79+
}
7780
if (cargoPackage != undefined) {
7881
if (cargoFlags) {
7982
cargoFlags = `${cargoFlags} -p ${cargoPackage}`;
@@ -121,7 +124,8 @@ class RustPlugin {
121124
}
122125
this.serverless.cli.log(`Building native Rust ${func.handler} func...`);
123126
let profile = (func.rust || {}).profile || this.custom.profile;
124-
const res = this.runDocker(func.rust, cargoPackage, binary, profile);
127+
let debugInfo = (func.rust || {}).debugInfo || this.custom.debugInfo;
128+
const res = this.runDocker(func.rust, cargoPackage, binary, profile, debugInfo);
125129
if (res.error || res.status > 0) {
126130
this.serverless.cli.log(
127131
`Dockerized Rust build encountered an error: ${res.error} ${res.status}.`

0 commit comments

Comments
 (0)