build: Simplified the calling of cargo.sh
This commit is contained in:
@ -42,7 +42,7 @@ Use the `cargo.sh` script for maintaining the Cargo part of the build. The scrip
|
||||
|
||||
```
|
||||
cd build_dir
|
||||
sh /source_path/cargo.sh /source_path '' test
|
||||
sh /source_path/cargo.sh '' test
|
||||
```
|
||||
|
||||
### Cargo dependencies
|
||||
@ -53,6 +53,6 @@ Dependencies must be specified in `Cargo.toml` with 2 numbers: "major.minor". Si
|
||||
|
||||
```
|
||||
cd build_dir
|
||||
sh /source_path/cargo.sh /source_path '' update
|
||||
sh /source_path/cargo.sh '' update
|
||||
ninja test
|
||||
```
|
||||
|
||||
8
cargo.sh
Normal file → Executable file
8
cargo.sh
Normal file → Executable file
@ -6,16 +6,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
SOURCE_DIR="$1"
|
||||
SCRIPT_PATH=`realpath $0`
|
||||
SOURCE_DIR=`dirname $0`
|
||||
|
||||
export CARGO_TARGET_DIR=`pwd`
|
||||
if [ ! -z ${2} ]; then
|
||||
OUT_PATH=`realpath "${2}"`
|
||||
if [ ! -z ${1} ]; then
|
||||
OUT_PATH=`realpath "${1}"`
|
||||
fi
|
||||
|
||||
cd $SOURCE_DIR
|
||||
shift
|
||||
shift
|
||||
cargo $BUILD_ARG $@
|
||||
|
||||
if [ ! -z ${OUT_PATH} ]; then
|
||||
|
||||
@ -60,13 +60,13 @@ rslibs = custom_target(
|
||||
output: ['librs.a'],
|
||||
install: false,
|
||||
console: true,
|
||||
command: [cargo_script, '@CURRENT_SOURCE_DIR@', '@OUTPUT@', 'build']
|
||||
command: [cargo_script, '@OUTPUT@', 'build']
|
||||
)
|
||||
|
||||
test(
|
||||
'rstest',
|
||||
cargo_script,
|
||||
args: [meson.source_root(), '', 'test']
|
||||
args: ['', 'test']
|
||||
)
|
||||
|
||||
libsqueekboard = static_library('libsqueekboard',
|
||||
|
||||
@ -51,7 +51,7 @@ foreach layout : ['us', 'nb', 'number']
|
||||
test(
|
||||
'test_layout_' + layout,
|
||||
cargo_script,
|
||||
args: [meson.source_root(), '', 'run', '--example', 'test_layout', layout]
|
||||
args: ['', 'run', '--example', 'test_layout', layout]
|
||||
)
|
||||
endforeach
|
||||
|
||||
|
||||
Reference in New Issue
Block a user