mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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
Notes:
sideshowbarker
2024-07-17 01:00:06 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/d185217599 Pull-request: https://github.com/SerenityOS/serenity/pull/19911
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 -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
|
||||
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
|
||||
# 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
|
||||
|
@ -72,7 +72,7 @@ jobs:
|
|||
python -m pip install --upgrade pip
|
||||
pip install flake8 requests
|
||||
- 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 ===
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ for cmd in \
|
|||
Meta/check-style.py \
|
||||
Meta/lint-executable-resources.sh \
|
||||
Meta/lint-gml-format.sh \
|
||||
Meta/lint-gn.sh \
|
||||
Meta/lint-keymaps.py \
|
||||
Meta/lint-prettier.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…
Reference in a new issue