[gjs: 2/7] build: Port IWYU runner script to use compilation database



commit 868294f324efc6b276ccc5e1c8b1d02439676be9
Author: Philip Chimento <philip endlessm com>
Date:   Tue Aug 27 16:01:38 2019 +0300

    build: Port IWYU runner script to use compilation database
    
    Using Meson, we get a compilation database in the build directory, which
    makes it much easier to run IWYU. We remove the 'make iwyu' target from
    the Autotools makefile and instead port the tools/run_iwyu.sh script to
    use the compilation database generated by Meson.

 Makefile.am          |  4 ----
 configure.ac         |  1 -
 tools/run_iwyu.sh    | 37 ++++++++++++++++++++++++++++++++
 tools/run_iwyu.sh.in | 59 ----------------------------------------------------
 4 files changed, 37 insertions(+), 64 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a93efb17..9d532ed5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -257,8 +257,4 @@ cppcheck:
                --enable=warning,performance,portability,information,missingInclude \
                --force -q $(top_srcdir) -I $(top_builddir)
 
-# Include What You Use: run 'make iwyu | tee iwyu.log'
-iwyu: tools/run_iwyu.sh
-       SRCDIR=$(abs_top_srcdir) BUILDDIR=$(abs_top_builddir) tools/run_iwyu.sh 2>&1
-
 -include $(top_srcdir)/git.mk
diff --git a/configure.ac b/configure.ac
index 1e58000c..4b3b510d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -357,7 +357,6 @@ dnl automake 1.11/1.12 defines this but does not substitute it
 AC_SUBST([pkglibexecdir], ["${libexecdir}/${PACKAGE}"])
 
 AC_CONFIG_FILES([Makefile gjs-1.0.pc win32/config.h.win32])
-AC_CONFIG_FILES([tools/run_iwyu.sh], [chmod +x tools/run_iwyu.sh])
 dnl Symlink the files from gobject-introspection's test libraries into the tree;
 dnl Automake plans to drop support for compiling them in-place.
 AC_CONFIG_LINKS([
diff --git a/tools/run_iwyu.sh b/tools/run_iwyu.sh
new file mode 100755
index 00000000..7a6260ce
--- /dev/null
+++ b/tools/run_iwyu.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+ninja -C _build
+cd _build
+
+IWYU="iwyu_tool -p ."
+PRIVATE_MAPPING="--mapping_file=../tools/gjs-private-iwyu.imp"
+PUBLIC_MAPPING="--mapping_file=../tools/gjs-public-iwyu.imp"
+
+for FILE in ../gi/*.cpp ../gi/gjs_gi_trace.h ../gjs/atoms.cpp \
+    ../gjs/byteArray.cpp ../gjs/coverage.cpp ../gjs/debugger.cpp \
+    ../gjs/deprecation.cpp ../gjs/error-types.cpp ../gjs/engine.cpp \
+    ../gjs/global.cpp ../gjs/importer.cpp ../gjs/jsapi-util-args.h \
+    ../gjs/jsapi-util-error.cpp ../gjs/jsapi-util-root.h \
+    ../gjs/jsapi-util-string.cpp ../js/jsapi-util.cpp ../gjs/module.cpp \
+    ../gjs/native.cpp ../gjs/stack.cpp ../modules/cairo-*.cpp \
+    ../modules/console.cpp ../modules/system.cpp ../test/*.cpp ../util/*.cpp \
+    ../libgjs-private/*.c
+do
+    $IWYU $FILE -- $PRIVATE_MAPPING
+done
+$IWYU ../gjs/context.cpp -- $PRIVATE_MAPPING \
+    --check_also=../gjs/context-private.h
+$IWYU ../gjs/jsapi-dynamic-class.cpp -- $PRIVATE_MAPPING \
+    --check_also=../gjs/jsapi-class.h
+$IWYU ../gjs/mem.cpp -- $PRIVATE_MAPPING --check_also=../gjs/mem-private.h
+$IWYU ../gjs/profiler.cpp -- $PRIVATE_MAPPING \
+    --check_also=../gjs/profiler-private.h
+$IWYU ../modules/cairo.cpp -- $PRIVATE_MAPPING \
+    --check_also=../modules/cairo-module.h \
+    --check_also=../modules/cairo-private.h
+
+for FILE in ../gjs/macros.h ../gjs/console.cpp \
+    ../installed-tests/minijasmine.cpp
+do
+    $IWYU $FILE -- $PUBLIC_MAPPING
+done


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