Skip to content

Commit 7e35932

Browse files
authored
Merge pull request softprops#44 from maxcountryman/feature/debuginfo
conditionally remove debuginfo from release builds
2 parents 02d5647 + 871e5b0 commit 7e35932

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ isolate the lambda specific build artifacts from your host-local build artifacts
2424

2525
> **⚠️ Note:** you can switch from the `release` profile to a custom profile like `dev` by providing a `PROFILE` environment variable set to the name of the desired profile. i.e. `-e PROFILE=dev` in your docker run
2626
27+
> **⚠️ Note:** you can include debug symbols in optimized release build binaries by setting `DEBUGINFO`. By default, debug symbols will be stripped from the release binary and set aside in a separate .debug file.
28+
2729
You will want to volume mount `/code` to the directory containing your cargo project.
2830

2931
You can pass additional flags to `cargo`, the Rust build tool, by setting the `CARGO_FLAGS` docker env variable
@@ -77,4 +79,4 @@ $ unzip -o \
7779
# Ctrl-D to yield control back to your function
7880
```
7981

80-
Doug Tangren (softprops) 2018
82+
Doug Tangren (softprops) 2018

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
set -eo pipefail
66
mkdir -p target/lambda
77
export PROFILE=${PROFILE:-release}
8+
export DEBUGINFO=${DEBUGINFO}
89
# cargo uses different names for target
910
# of its build profiles
1011
if [[ "${PROFILE}" == "release" ]]; then
@@ -30,7 +31,7 @@ export CARGO_TARGET_DIR=$PWD/target/lambda
3031

3132
function package() {
3233
file="$1"
33-
if [[ "${PROFILE}" == "release" ]]; then
34+
if [[ "${PROFILE}" == "release" ]] && [[ -z "${DEBUGINFO}" ]]; then
3435
objcopy --only-keep-debug "$file" "$file.debug"
3536
objcopy --strip-debug --strip-unneeded "$file"
3637
objcopy --add-gnu-debuglink="$file.debug" "$file"

0 commit comments

Comments
 (0)