File tree 2 files changed +11
-4
lines changed 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,14 @@ RUST_SKIP_BUILD=1
100
100
101
101
## Customizing build flags
102
102
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.
104
111
105
112
## Using the edge version of the buildpack
106
113
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ BUILD_PATH=""
32
32
RUST_INSTALL_DIESEL=0
33
33
# These flags are passed to `cargo install diesel`, e.g. '--no-default-features --features postgres'
34
34
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 "
37
37
38
38
# Load our toolchain configuration, if any was specified.
39
39
if [ -f " $BUILD_DIR /rust-toolchain" ]; then
@@ -137,7 +137,7 @@ if [ $RUST_SKIP_BUILD -ne 1 ]; then
137
137
echo " -----> Building application using Cargo"
138
138
cd " $BUILD_DIR /$BUILD_PATH "
139
139
rm -rf target/
140
- cargo build " $CARGO_BUILD_FLAGS "
140
+ cargo build $RUST_CARGO_BUILD_FLAGS
141
141
mkdir -p target/release
142
142
find " $CARGO_TARGET_DIR /release" -maxdepth 1 -type f -executable -exec cp -a -t target/release {} \;
143
143
else
You can’t perform that action at this time.
0 commit comments