You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/02/20 14:44:26 UTC

[GitHub] [mynewt-core] utzig commented on a change in pull request #2493: apps/rust_blinky: Support cargo release builds

utzig commented on a change in pull request #2493:
URL: https://github.com/apache/mynewt-core/pull/2493#discussion_r579665741



##########
File path: apps/rust_blinky/cargo_build.sh
##########
@@ -32,5 +33,16 @@ else
   exit 1
 fi
 
-cargo build --target="${TARGET}" --target-dir="${MYNEWT_PKG_BIN_DIR}"
-cp "${MYNEWT_PKG_BIN_DIR}"/${TARGET}/debug/*.a "${MYNEWT_PKG_BIN_ARCHIVE}"
+# Map mynewt build profile to cargo build profile
+if [[ ${MYNEWT_BUILD_PROFILE} == 'debug' ]]; then
+  # mynewt debug profile -> cargo debug profile
+  CARGO_PROFILE="debug"
+  CARGO_ARGS=""
+else
+  # all other mynewt profiles -> cargo release profile
+  CARGO_PROFILE="release"
+  CARGO_ARGS=" --release"
+fi
+
+cargo build --target="${TARGET}" --target-dir="${MYNEWT_PKG_BIN_DIR}"${CARGO_ARGS}

Review comment:
       This would look better if there was a space between `${MYNEWT_PKG_BIN_DIR}"` and `${CARGO_ARGS}`, and of course, no space inside `CARGO_ARGS`, any reason for doing it this way?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org