7
7
8
8
set -ex
9
9
10
+ SOURCE_FOLDER=$1
11
+ BUILD_FOLDER=$2
12
+
10
13
# Ensure we are in the right directory
11
- SCRIPT=$( realpath " $0 " )
12
- SCRIPTPATH=$( dirname " $SCRIPT " )
13
- cd " $SCRIPTPATH /../"
14
+ cd " $SOURCE_FOLDER "
14
15
15
16
# Ensure that we do see a "Compiling" in the output
16
17
# as if we do it means we have a cargo::rerun-if-changed incorrectly
17
18
function 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 )
19
20
20
21
if ! echo " $BUILD " | grep -q Compiling; then
21
22
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() {
26
27
# Ensure that we don't see any "Compiling" in the output
27
28
# as if we do it means we have a cargo::rerun-if-changed incorrectly
28
29
function 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 )
30
31
31
32
if echo " $BUILD " | grep -q Compiling; then
32
33
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() {
35
36
}
36
37
37
38
# Build once
38
- cargo build -p qml-minimal-no-cmake
39
+ cargo build --target-dir= " $BUILD_FOLDER " - p qml-minimal-no-cmake
39
40
40
41
# Build a second time
41
42
check_build_no_compiling
42
43
43
44
# 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"
45
46
46
47
# Build a third and fourth time
47
48
check_build_contains_compiling
48
49
check_build_no_compiling
49
50
50
51
# 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"
52
53
53
54
# Build a fifth and sixth time
54
55
check_build_contains_compiling
0 commit comments