-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeta.sh
More file actions
executable file
·79 lines (70 loc) · 2.43 KB
/
meta.sh
File metadata and controls
executable file
·79 lines (70 loc) · 2.43 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
#!/bin/bash
set -e
platform=$ANDROID_HOME/platforms/android-36/android.jar
clean() {
find . -type d -name "target" -exec rm -rf {} +
}
vscode() {
mkdir -p .vscode
echo "{\"[java]\": {\"editor.defaultFormatter\": \"xaver.clang-format\", \"editor.formatOnSave\": true}," > .vscode/settings.json
echo "\"java.saveActions.organizeImports\":true," >> .vscode/settings.json
echo "\"java.completion.importOrder\":[\"java\",\"android\",\"com\",\"nl\",\"org\",\"\"]," >> .vscode/settings.json
echo "\"java.project.sourcePaths\":[" >> .vscode/settings.json
for dir in $(find . -name "src" ! -path "*/target/*") $(find . -name "src-gen"); do
echo "\"$dir\"," >> .vscode/settings.json
done
echo "],\"java.project.referencedLibraries\":[\"$platform\",\"./bin/bassiemusic/target/jar-cache/*.jar\"]," >> .vscode/settings.json
echo "\"java.compile.nullAnalysis.mode\":\"automatic\"," >> .vscode/settings.json
echo "\"java.compile.nullAnalysis.nullable\":[\"org.jspecify.annotations.Nullable\"]," >> .vscode/settings.json
echo "\"java.compile.nullAnalysis.nonnull\":[\"org.jspecify.annotations.NonNull\"]," >> .vscode/settings.json
echo "\"java.compile.nullAnalysis.nonnullbydefault\":[\"org.jspecify.annotations.NullMarked\"]," >> .vscode/settings.json
echo "\"rust-analyzer.linkedProjects\":[" >> .vscode/settings.json
for file in $(find . -name "Cargo.toml"); do
echo "\"$file\"," >> .vscode/settings.json
done
echo "]}" >> .vscode/settings.json
}
check_copyright() {
exit=0
for file in $(find . -type f \( -name "*.java" -o -name "*.rs" \) ! -path "*/target/*"); do
if ! grep -E -q "Copyright \(c\) 20[0-9]{2}(-20[0-9]{2})? Bastiaan van der Plaat" "$file"; then
echo "Bad copyright header in: $file"
exit=1
fi
done
if [ "$exit" -ne 0 ]; then
exit 1
fi
}
check_format() {
# Format
echo "Checking Java formatting..."
clang-format --dry-run --Werror $(find . -type f -name "*.java" ! -path "*/target/*")
}
build() {
echo "Building all projects..."
# FIXME: Do null analysis
for dir in $(ls bin); do
bob build --time -C "bin/$dir"
done
}
check() {
check_copyright
check_format
build
}
case "${1:-check}" in
clean)
clean
;;
vscode)
vscode
;;
check)
check
;;
*)
echo "Usage: $0 {clean|vscode|check}"
exit 1
;;
esac