77
88set -ex
99
10+ SOURCE_FOLDER=$1
11+ BUILD_FOLDER=$2
12+
1013# Ensure we are in the right directory
11- SCRIPT=$( realpath " $0 " )
12- SCRIPTPATH=$( dirname " $SCRIPT " )
13- cd " $SCRIPTPATH /../"
14+ cd " $SOURCE_FOLDER "
1415
1516# Ensure that we do see a "Compiling" in the output
1617# as if we do it means we have a cargo::rerun-if-changed incorrectly
1718function check_build_contains_compiling() {
18- BUILD=$( cargo build -p qml-minimal-no-cmake 2>&1 )
19+ BUILD=$( cargo build --target-dir= " $BUILD_FOLDER " - p qml-minimal-no-cmake 2>&1 )
1920
2021 if ! echo " $BUILD " | grep -q Compiling; then
2122 echo " cargo build is missing text 'Compiling', likely an incorrect cargo::rerun-if-changed in a build script."
@@ -26,7 +27,7 @@ function check_build_contains_compiling() {
2627# Ensure that we don't see any "Compiling" in the output
2728# as if we do it means we have a cargo::rerun-if-changed incorrectly
2829function check_build_no_compiling() {
29- BUILD=$( cargo build -p qml-minimal-no-cmake 2>&1 )
30+ BUILD=$( cargo build --target-dir= " $BUILD_FOLDER " - p qml-minimal-no-cmake 2>&1 )
3031
3132 if echo " $BUILD " | grep -q Compiling; then
3233 echo " cargo build contained text 'Compiling', likely an incorrect cargo::rerun-if-changed in a build script."
@@ -35,20 +36,20 @@ function check_build_no_compiling() {
3536}
3637
3738# Build once
38- cargo build -p qml-minimal-no-cmake
39+ cargo build --target-dir= " $BUILD_FOLDER " - p qml-minimal-no-cmake
3940
4041# Build a second time
4142check_build_no_compiling
4243
4344# Modify a qml file
44- touch " $SCRIPTPATH /.. /examples/cargo_without_cmake/qml/main.qml"
45+ touch " $SOURCE_FOLDER /examples/cargo_without_cmake/qml/main.qml"
4546
4647# Build a third and fourth time
4748check_build_contains_compiling
4849check_build_no_compiling
4950
5051# Modify a Rust file
51- touch " $SCRIPTPATH /.. /examples/cargo_without_cmake/src/cxxqt_object.rs"
52+ touch " $SOURCE_FOLDER /examples/cargo_without_cmake/src/cxxqt_object.rs"
5253
5354# Build a fifth and sixth time
5455check_build_contains_compiling
0 commit comments