-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplates.yaml
116 lines (110 loc) · 3.82 KB
/
templates.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
garden:
includes: variables.yaml
templates:
bin:
description: Add ${TREE_PATH}/bin to ${PATH}.
environment:
PATH: "${TREE_PATH}/bin"
cmake:
description: Build a generic cmake project
environment:
PATH: "${prefix}/bin"
variables:
# cmake_build_type maps ${build_mode} to an appropriate CMAKE_BUILD_TYPE.
# The default build mode maps to CMAKE_BUILD_TYPE=RelWithDebInfo.
# Variants on "debug/dbg" map to "Debug".
# Variants on "opt/optimize/rel/release" map to "Release".
cmake_build_type: |
$ case "${build_mode}" in
*debug*|*dbg*)
echo Debug
;;
*opt*|*rel*)
echo Release
;;
*)
echo RelWithDebInfo
;;
esac
cmake_generator: Ninja
cmake_extra_args: ""
commands:
build: |
build_dir=build/${build_mode}
test -d $build_dir &&
test $build_dir/cmake.conf -nt CMakeLists.txt ||
cmake \
-G ${cmake_generator} \
-B $build_dir \
-D CMAKE_INSTALL_PREFIX=${prefix} \
-D CMAKE_BUILD_TYPE=${cmake_build_type} \
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
-D CMAKE_INSTALL_MESSAGE=NEVER \
${cmake_extra_args} .
cmake --build $build_dir -- -j${num_procs}
# Link build/compile_commands.json to the current build
rm -f build/compile_commands.json
ln -s ${build_mode}/compile_commands.json build/compile_commands.json
install: |
cmake --install build/${build_mode}
git-annex-ignore:
description: |
Configure git-annex to ignore the origin repository. This is needed when
origin contains only metadata and the data is replacated across multiple worktrees
using git-annex.
variables:
git_annex_ignore_remote: origin
gitconfig:
remote.${git_annex_ignore_remote}.annex-ignore: true
remote.${git_annex_ignore_remote}.annex-sync: false
makefile:
variables:
make_args: ""
make_cmd: make -j${num_procs} DESTDIR="${DESTDIR}" prefix="${prefix}" ${make_args}
commands:
build: ${make_cmd} all "$@"
install: ${make_cmd} install "$@"
test: ${make_cmd} test "$@"
python:
description: |
Setup a Python virtualenv named after the current Python version.
Add envXY/bin to ${PATH} to activate the virtualenv.
Add ${TREE_PATH} to ${PYTHONPATH} to make the modules available.
environment:
PATH: ${TREE_PATH}/${py_venv}/bin
PYTHONPATH: "${TREE_PATH}"
commands:
setup: |
test -d ${py_venv} || ${python} -m venv ${py_venv_args} ${py_venv}
source ${py_venv}/bin/activate
pip install --upgrade pip
pip install wheel
dev: |
source ${py_venv}/bin/activate
pip install --editable .
rust:
variables:
cargo_build_args: ""
cargo_build_release: $ test "${build_mode}" = "release" && printf '%s' --release
cargo_install_args: ""
cargo_install_release: $ test "${build_mode}" = "release" && printf '%s' --release
cargo_test_args: ""
environment:
PATH: "${TREE_PATH}/${target_path}"
commands:
build: cargo build --jobs ${num_procs} ${cargo_build_release} ${cargo_build_args} "$@"
check: |
cargo check --jobs ${num_procs} "$@"
cargo clippy --all -- -D warnings
cargo fmt --check
check/clippy: cargo clippy --fix "$@" -- -D warnings
check/fmt: cargo fmt --check "$@"
clean: cargo clean "$@"
doc: cargo doc --jobs ${num_procs} "$@"
fmt: cargo fmt "$@"
install: cargo install ${cargo_install_release} ${cargo_install_args} --path . "$@"
publish: cargo publish "$@"
run: cargo run "$@"
test: cargo test --jobs ${num_procs} ${cargo_test_args} "$@"
update: cargo update "$@"
...