@@ -174,6 +174,7 @@ class RustPlugin {
174174 cargoPackage ,
175175 binary ,
176176 profile ,
177+ debugInfo ,
177178 srcPath ,
178179 cargoRegistry ,
179180 cargoDownloads ,
@@ -198,6 +199,9 @@ class RustPlugin {
198199 // release or dev
199200 customArgs . push ( "-e" , `PROFILE=${ profile } ` ) ;
200201 }
202+ if ( debugInfo ) {
203+ customArgs . push ( "-e" , `DEBUGINFO=${ debugInfo } ` ) ;
204+ }
201205 if ( cargoPackage != undefined ) {
202206 if ( cargoFlags ) {
203207 cargoFlags = `${ cargoFlags } -p ${ cargoPackage } ` ;
@@ -219,7 +223,7 @@ class RustPlugin {
219223 ] . filter ( ( i ) => i ) ;
220224 }
221225
222- dockerBuild ( funcArgs , cargoPackage , binary , profile ) {
226+ dockerBuild ( funcArgs , cargoPackage , binary , profile , debugInfo ) {
223227 const cargoHome = process . env . CARGO_HOME || path . join ( homedir ( ) , ".cargo" ) ;
224228 const cargoRegistry = path . join ( cargoHome , "registry" ) ;
225229 const cargoDownloads = path . join ( cargoHome , "git" ) ;
@@ -230,6 +234,7 @@ class RustPlugin {
230234 cargoPackage ,
231235 binary ,
232236 profile ,
237+ debugInfo ,
233238 this . srcPath ,
234239 cargoRegistry ,
235240 cargoDownloads ,
@@ -280,10 +285,11 @@ class RustPlugin {
280285
281286 this . serverless . cli . log ( `Building Rust ${ func . handler } func...` ) ;
282287 let profile = ( func . rust || { } ) . profile || this . custom . profile ;
288+ let debugInfo = ( func . rust || { } ) . debugInfo || this . custom . debugInfo ;
283289
284290 const res = this . buildLocally ( func )
285291 ? this . localBuild ( func . rust , cargoPackage , binary , profile )
286- : this . dockerBuild ( func . rust , cargoPackage , binary , profile ) ;
292+ : this . dockerBuild ( func . rust , cargoPackage , binary , profile , debugInfo ) ;
287293 if ( res . error || res . status > 0 ) {
288294 this . serverless . cli . log (
289295 `Rust build encountered an error: ${ res . error } ${ res . status } .`
0 commit comments