mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
Meta: Add gn linter
This just calls ``gn format`` on any .gn or .gni files, but it matches the pattern of the other linters.
This commit is contained in:
parent
a21a08cc9d
commit
d185217599
3 changed files with 32 additions and 2 deletions
4
.github/workflows/cmake.yml
vendored
4
.github/workflows/cmake.yml
vendored
|
@ -59,7 +59,7 @@ jobs:
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
|
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y clang-format-16 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip
|
sudo apt-get install -y clang-format-16 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip generate-ninja
|
||||||
if ${{ matrix.arch == 'aarch64' }}; then
|
if ${{ matrix.arch == 'aarch64' }}; then
|
||||||
# FIXME: Remove this when we no longer build our own Qemu binary.
|
# FIXME: Remove this when we no longer build our own Qemu binary.
|
||||||
sudo apt-get install libgtk-3-dev libpixman-1-dev libsdl2-dev libslirp-dev
|
sudo apt-get install libgtk-3-dev libpixman-1-dev libsdl2-dev libslirp-dev
|
||||||
|
@ -72,7 +72,7 @@ jobs:
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install flake8 requests
|
pip install flake8 requests
|
||||||
- name: Check versions
|
- name: Check versions
|
||||||
run: set +e; g++ --version; g++-12 --version; clang-format --version; clang-format-16 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version
|
run: set +e; g++ --version; g++-12 --version; clang-format --version; clang-format-16 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version; gn --version
|
||||||
|
|
||||||
# === PREPARE FOR BUILDING ===
|
# === PREPARE FOR BUILDING ===
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ for cmd in \
|
||||||
Meta/check-style.py \
|
Meta/check-style.py \
|
||||||
Meta/lint-executable-resources.sh \
|
Meta/lint-executable-resources.sh \
|
||||||
Meta/lint-gml-format.sh \
|
Meta/lint-gml-format.sh \
|
||||||
|
Meta/lint-gn.sh \
|
||||||
Meta/lint-keymaps.py \
|
Meta/lint-keymaps.py \
|
||||||
Meta/lint-prettier.sh \
|
Meta/lint-prettier.sh \
|
||||||
Meta/lint-python.sh \
|
Meta/lint-python.sh \
|
||||||
|
|
29
Meta/lint-gn.sh
Executable file
29
Meta/lint-gn.sh
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||||
|
cd "${script_path}/.." || exit 1
|
||||||
|
|
||||||
|
if [ "$#" -eq "0" ]; then
|
||||||
|
mapfile -t files < <(
|
||||||
|
git ls-files '*.gn' '*.gni'
|
||||||
|
)
|
||||||
|
else
|
||||||
|
files=()
|
||||||
|
for file in "$@"; do
|
||||||
|
if [[ "${file}" == *".gn" ]] || [[ "${file}" == *".gni" ]]; then
|
||||||
|
files+=("${file}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${#files[@]} )); then
|
||||||
|
if ! command -v gn >/dev/null 2>&1 ; then
|
||||||
|
echo "gn is not available, but gn files need linting! Either skip this script, or install gn."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
gn format "${files[@]}"
|
||||||
|
else
|
||||||
|
echo "No .gn or .gni files to check."
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue