Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: no debug symbols as default and add a command to build with debug symbols #1849

Merged
merged 2 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ members = [
]

[profile.release]
debug = true
overflow-checks = true

[target.'cfg(all(not(target_env = "msvc"), not(target_os="macos")))'.dependencies]
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ prod-docker:
prod-test:
RUSTFLAGS="--cfg disable_faketime" RUSTDOCFLAGS="--cfg disable_faketime" cargo test ${VERBOSE} --all -- --nocapture

.PHONY: prod-with-debug
prod-with-debug:
devtools/release/make-with-debug-symbols prod
yangby-cryptape marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: docker
docker: ## Build docker image
docker build -f docker/hub/Dockerfile -t nervos/ckb:$$(git describe) .
Expand Down
31 changes: 31 additions & 0 deletions devtools/release/make-with-debug-symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -euo pipefail

case "$OSTYPE" in
darwin*)
if ! type gsed &> /dev/null; then
echo "GNU sed not found! You can install via Homebrew" >&2
echo >&2
echo " brew install gnu-sed" >&2
exit 1
fi
SED=gsed
;;
*)
SED=sed
;;
esac

function restore_manifest_file () {
${SED} -i -e '/\[profile.release\]/{n;d}' Cargo.toml
}

trap restore_manifest_file EXIT

function main() {
${SED} -i "/\[profile.release\]/adebug = true" Cargo.toml
make "$@"
}

main "$@"