Skip to content

Commit fa37243

Browse files
committed
Support out-of-source build
Until this moment, it was impossible to build `luatest` by out-of-source mean which is a common practice. Now it is fixed.
1 parent edc7cf0 commit fa37243

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.github/workflows/test_on_push.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ jobs:
2222

2323
- name: Install requirements for community
2424
run: |
25-
cmake .
26-
make bootstrap
25+
cmake -S . -B build
26+
make -C build bootstrap
2727
2828
# This server starts and listen on 8084 port that is used for tests
2929
- name: Stop Mono server
3030
run: sudo kill -9 $(sudo lsof -t -i tcp:8084) || true
3131

3232
- name: Run linter
33-
run: make lint
33+
run: make -C build lint
3434

3535
- name: Run tests
3636
run: bin/luatest -v --shuffle group

.luacheckrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
include_files = {"**/*.lua", "*.rockspec", "*.luacheckrc"}
2-
exclude_files = {"lua_modules/", ".luarocks/", ".rocks/", "tmp/"}
2+
exclude_files = {"build.luarocks/", "lua_modules/", "tmp/", ".luarocks/", ".rocks/"}
33

44
max_line_length = 120

CMakeLists.txt

+18-6
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,41 @@ set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES build)
3737

3838
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES .rocks)
3939
add_custom_command(
40-
OUTPUT .rocks
40+
OUTPUT ${PROJECT_SOURCE_DIR}/.rocks
4141
DEPENDS ${PROJECT_NAME}-scm-1.rockspec
4242
COMMAND tarantoolctl rocks make ./${PROJECT_NAME}-scm-1.rockspec
4343
COMMAND tarantoolctl rocks install http 1.1.0
4444
COMMAND tarantoolctl rocks install luacheck 0.25.0
4545
COMMAND tarantoolctl rocks install luacov 0.13.0
46+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
4647
)
4748

48-
add_custom_target(bootstrap DEPENDS .rocks)
49+
add_custom_target(bootstrap DEPENDS ${PROJECT_SOURCE_DIR}/.rocks)
4950

5051
add_custom_command(
51-
OUTPUT .rocks/bin/ldoc
52+
OUTPUT ${PROJECT_SOURCE_DIR}/.rocks/bin/ldoc
5253
DEPENDS bootstrap
5354
COMMAND tarantoolctl rocks install ldoc --server=http://rocks.moonscript.org
55+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
5456
)
5557

5658
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES doc)
5759
add_custom_target(doc
58-
DEPENDS .rocks/bin/ldoc
60+
DEPENDS ${PROJECT_SOURCE_DIR}/.rocks/bin/ldoc
5961
COMMAND .rocks/bin/ldoc -t ${PROJECT_NAME}-scm-1 -p ${PROJECT_NAME} --all .
62+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
6063
)
6164

62-
add_custom_target(lint DEPENDS bootstrap COMMAND .rocks/bin/luacheck .)
63-
add_custom_target(selftest DEPENDS bootstrap COMMAND bin/luatest --shuffle group)
65+
add_custom_target(lint
66+
DEPENDS bootstrap
67+
COMMAND .rocks/bin/luacheck .
68+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
69+
)
70+
add_custom_target(selftest
71+
DEPENDS bootstrap
72+
COMMAND bin/luatest --shuffle group
73+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
74+
)
6475

6576
add_custom_target(test_with_coverage_report
6677
DEPENDS bootstrap
@@ -69,6 +80,7 @@ add_custom_target(test_with_coverage_report
6980
COMMAND .rocks/bin/luacov .
7081
COMMAND echo
7182
COMMAND grep -A999 '^Summary' tmp/luacov.report.out
83+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
7284
)
7385

7486
## Test #######################################################################

0 commit comments

Comments
 (0)