[gjs: 1/18] CI: Generate compile database without running Meson




commit fecbffd1a50a53332addb67994a5deb4b40c0c3d
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Oct 8 12:18:49 2020 -0700

    CI: Generate compile database without running Meson
    
    Ninja has a compdb task which just generates the compile database, which
    is what we need here.

 .gitlab-ci.yml        |  2 ++
 tools/run_cppcheck.sh | 10 +++++++---
 tools/run_iwyu.sh     |  6 +++---
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 75a6c167..763cfa7e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -223,6 +223,7 @@ iwyu:
   image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs78-debug
   script:
     - test/test-ci.sh UPSTREAM_BASE
+    - meson setup _build
     - ./tools/run_iwyu.sh ci-upstream-base
   only:
     - branches
@@ -262,6 +263,7 @@ iwyu-full:
   stage: manual
   image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs78-debug
   script:
+    - meson setup _build
     - ./tools/run_iwyu.sh
   except:
     - schedules
diff --git a/tools/run_cppcheck.sh b/tools/run_cppcheck.sh
index 72053718..aad20b2d 100755
--- a/tools/run_cppcheck.sh
+++ b/tools/run_cppcheck.sh
@@ -2,8 +2,12 @@
 # SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
 # SPDX-FileCopyrightText: 2017 Claudio André <claudioandre br gmail com>
 
-ninja -C _build
-cppcheck --project=_build/compile_commands.json --inline-suppr \
+cd ${BUILDDIR:-_build}
+if ! ninja -t compdb > compile_commands.json; then
+    echo 'Generating compile_commands.json failed.'
+    exit 1
+fi
+cppcheck --project=compile_commands.json --inline-suppr \
     --enable=warning,performance,portability,missingInclude \
     -UHAVE_PRINTF_ALTERNATIVE_INT \
-    --library=gtk,tools/cppcheck.cfg --force --quiet $@
+    --library=gtk,../tools/cppcheck.cfg --force --quiet $@
diff --git a/tools/run_iwyu.sh b/tools/run_iwyu.sh
index 64353017..1efc5806 100755
--- a/tools/run_iwyu.sh
+++ b/tools/run_iwyu.sh
@@ -35,11 +35,11 @@ should_analyze () {
     esac
 }
 
-if ! meson setup _build; then
-    echo 'Meson failed.'
+cd ${BUILDDIR:-_build}
+if ! ninja -t compdb > compile_commands.json; then
+    echo 'Generating compile_commands.json failed.'
     exit 1
 fi
-cd ${BUILDDIR:-_build}
 
 echo "files: $files"
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]