Skip to content

Commit 9ee1391

Browse files
committed
Add option to script to build libs in release mode (and set it in the build workflow)
1 parent 589811d commit 9ee1391

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
distribution: 'temurin'
3434
cache: 'maven'
3535
#- uses: actions-rust-lang/setup-rust-toolchain@v1
36-
- run: ./update-rust-jni-libs.sh
36+
- run: ./update-rust-jni-libs.sh -r
3737
if: ${{ matrix.os.image == 'macos-latest' }}
3838

3939
- name: test

update-rust-jni-libs.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,30 @@
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
#
2828

29+
set -euxo pipefail
2930

31+
# Run Cargo in debug mode by default
32+
CARGO_OPTIONS=""
33+
TARGET_SUBDIR="debug"
3034

31-
set -euxo pipefail
35+
while getopts ":r" OPTION; do
36+
case $OPTION in
37+
r) # Run Cargo in release mode
38+
CARGO_OPTIONS="--release"
39+
TARGET_SUBDIR="release"
40+
esac
41+
done
3242

3343
RESOURCES="../resources/engineering/swat/watch/jni/"
3444

3545
cd src/main/rust
3646

37-
3847
function build() {
3948
rustup target add $1
40-
cargo build --target $1
49+
cargo build --target $1 $CARGO_OPTIONS
4150
mkdir -p "$RESOURCES/$2/"
42-
cp "target/$1/debug/librust_fsevents_jni.dylib" "$RESOURCES/$2/"
51+
cp "target/$1/$TARGET_SUBDIR/librust_fsevents_jni.dylib" "$RESOURCES/$2/"
4352
}
4453

4554
build "x86_64-apple-darwin" "macos-x64"
4655
build "aarch64-apple-darwin" "macos-aarch64"
47-

0 commit comments

Comments
 (0)