Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
105 lines (94 loc) · 3.42 KB
/
Copy pathTaskfile.yml
File metadata and controls
105 lines (94 loc) · 3.42 KB
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
version: '3'
# https://taskfile.dev
vars:
NX_AARCH64: 22.1.8-3
# Modules to check with clang-format/clang-tidy;
MODULES: atk,font,g3d,ui2d,vfx
_MODULES1: ',{{.MODULES}}'
_MODULES2: '^{{.MODULES}}$'
SOURCES: '{{._MODULES1 | replace "," " lib/"}}'
CLANG_TIDY_LIBS: '{{.MODULES | replace " " "" | replace "," "|" }}'
env:
NX_AARCH64: '{{.NX_AARCH64}}'
tasks:
clone-deps:
desc: Clone dependencies for development
cmds:
- rm -rf lib/nnsdk
- git clone https://github.com/open-ead/nnsdk lib/nnsdk
pr:
desc: Run everything the PR checks
cmds:
- task: configure
- task: build
- task: check
configure:
desc: Configure CMake
cmds:
- silent: true
cmd: |
if [ -z "$CI" ]; then
[ -d "toolchain/musl" ] || git clone https://github.com/open-ead/botw-lib-musl toolchain/musl
VERSION={{.NX_AARCH64}}
OUTPUT=toolchain
[ -d "$OUTPUT/nx-aarch64-$VERSION" ] || curl -fsSL https://raw.githubusercontent.com/Pistonight/nx-aarch64/main/install.sh | VERSION="$VERSION" OUTPUT="$OUTPUT" sh
fi
- cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="$PWD/toolchain/Toolchain.cmake" -B build
- cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="$PWD/toolchain/Toolchain.cmake" -B test/header_check/build -S test/header_check
build:
desc: Check the project builds
vars:
VERIFY_TARGETS: '{{._MODULES2 | replace " " "" | replace "," "$ ^" | replace "^" "--target nn_" | replace "$" "_verify_interface_header_sets"}}'
cmds:
# the header check test already builds all the libs so we don't need an extra --build build here
- cmake --build build {{.VERIFY_TARGETS}}
- cmake --build test/header_check/build
check:
desc: Run clang-format and clang-tidy checks
cmds:
- task: clang-format
vars: { ARGS: -n -Werror }
- task: clang-tidy
fix:
desc: Run clang-format to format the code
cmds:
- task: clang-format
vars: { ARGS: -i }
clean:
desc: Remove CMake build files
cmds:
- rm -rf build
- rm -rf test/*/build
clang-format:
cmds:
- silent: true
cmd: |
clang=$NX_CLANG
if [ ! -d "$clang" ]; then
clang="toolchain/nx-aarch64-$NX_AARCH64"
fi
if [ ! -d "$clang" ]; then
echo "cannot find nx-aarch64 - please run 'task configure'"
exit 1
fi
echo 'running clang-format with {{numCPU}} cpus with args: {{.ARGS}}'
clang_format="$clang/bin/clang-format"
find {{.SOURCES}} -regextype posix-extended -regex '.*\.[ch](\+\+|pp|xx|c|h)?' | xargs -P {{numCPU}} -n 1 $clang_format {{.ARGS}}
clang-tidy:
vars:
ARGS: --warnings-as-errors="*" --header-filter="include/nn/({{.CLANG_TIDY_LIBS}})" -p build --quiet
cmds:
- silent: true
cmd: |
clang=$NX_CLANG
if [ ! -d "$clang" ]; then
clang="toolchain/nx-aarch64-$NX_AARCH64"
fi
if [ ! -d "$clang" ]; then
echo "cannot find nx-aarch64 - please run 'task configure'"
exit 1
fi
echo 'running clang-tidy with {{numCPU}} cpus';
clang_tidy="$clang/bin/clang-tidy"
find {{.SOURCES}} -regextype posix-extended -regex '.*\.[ch](\+\+|pp|xx|c|h)?' | xargs -P {{numCPU}} -n 1 sh -c 'printf "\r\033[Kclang-tidy: $1"; '$clang_tidy' {{.ARGS}} "$1"' _;
echo ''