Skip to content

Commit cfa7351

Browse files
committed
Implements requires changes.
- Rename the variable comment - Remove double quotes for the `cargo buil` command. - Details documention in the README.md
1 parent 55700e5 commit cfa7351

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,14 @@ RUST_SKIP_BUILD=1
100100

101101
## Customizing build flags
102102

103-
By default the command line used to build the rust binary is `cargo build --release`.
103+
If you want to change the cargo build command, you can set the `RUST_CARGO_BUILD_FLAGS` variable inside the `RustConfig` file.
104+
105+
```sh
106+
RUST_CARGO_BUILD_FLAGS="--release -p some_package --bin some_exe --bin some_bin_2"
107+
```
108+
109+
The default value of `RUST_CARGO_BUILD_FLAGS` is `--release`.
110+
If the variable is not set in `RustConfig`, the default value will be used to build the project.
104111

105112
## Using the edge version of the buildpack
106113

bin/compile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ BUILD_PATH=""
3232
RUST_INSTALL_DIESEL=0
3333
# These flags are passed to `cargo install diesel`, e.g. '--no-default-features --features postgres'
3434
DIESEL_FLAGS=""
35-
# `CARGO_BUILD_FLAGS` default build command
36-
CARGO_BUILD_FLAGS=""
35+
# Default build flags to pass to `cargo build`.
36+
RUST_CARGO_BUILD_FLAGS="--release"
3737

3838
# Load our toolchain configuration, if any was specified.
3939
if [ -f "$BUILD_DIR/rust-toolchain" ]; then
@@ -137,7 +137,7 @@ if [ $RUST_SKIP_BUILD -ne 1 ]; then
137137
echo "-----> Building application using Cargo"
138138
cd "$BUILD_DIR/$BUILD_PATH"
139139
rm -rf target/
140-
cargo build "$CARGO_BUILD_FLAGS"
140+
cargo build $RUST_CARGO_BUILD_FLAGS
141141
mkdir -p target/release
142142
find "$CARGO_TARGET_DIR/release" -maxdepth 1 -type f -executable -exec cp -a -t target/release {} \;
143143
else

0 commit comments

Comments
 (0)