Skip to content

Commit

Permalink
feat: no debug symbols as default and add a command to build with deb…
Browse files Browse the repository at this point in the history
…ug symbols
  • Loading branch information
yangby-cryptape committed Nov 27, 2019
1 parent 15280bd commit f1c867b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
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/release-with-debug-symbols

.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/release-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 prod
}

main "$@"

0 comments on commit f1c867b

Please sign in to comment.