summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2019-11-23 23:16:23 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2019-11-29 19:42:47 -0800
commit822741991f93a2b8597b2f287f9e71af876a75a5 (patch)
tree4a47849b18ec054c8f4fb065366e2a5aafd64378 /tools
parent53011a0dc74669e305a590a227513cd6aeafd556 (diff)
downloadgjs-822741991f93a2b8597b2f287f9e71af876a75a5.tar.gz
build: Improve IWYU script
Allow build directories other than _build with the BUILDDIR environment variable; add a few files that were missed; adapt to newer IWYU versions that require -Xiwyu for their arguments; and automatically keep config.h without having to comment a special IWYU pragma.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run_iwyu.sh55
1 files changed, 30 insertions, 25 deletions
diff --git a/tools/run_iwyu.sh b/tools/run_iwyu.sh
index 7a6260ce..57b7bc5e 100755
--- a/tools/run_iwyu.sh
+++ b/tools/run_iwyu.sh
@@ -1,37 +1,42 @@
#!/bin/sh
-ninja -C _build
-cd _build
+SRCDIR=$(pwd)
+
+cd ${BUILDDIR:-_build}
+ninja
IWYU="iwyu_tool -p ."
-PRIVATE_MAPPING="--mapping_file=../tools/gjs-private-iwyu.imp"
-PUBLIC_MAPPING="--mapping_file=../tools/gjs-public-iwyu.imp"
+PRIVATE_MAPPING="-Xiwyu --mapping_file=$SRCDIR/tools/gjs-private-iwyu.imp -Xiwyu --keep=config.h"
+PUBLIC_MAPPING="-Xiwyu --mapping_file=$SRCDIR/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
+for FILE in $SRCDIR/gi/*.cpp $SRCDIR/gjs/atoms.cpp $SRCDIR/gjs/byteArray.cpp \
+ $SRCDIR/gjs/coverage.cpp $SRCDIR/gjs/debugger.cpp \
+ $SRCDIR/gjs/deprecation.cpp $SRCDIR/gjs/error-types.cpp \
+ $SRCDIR/gjs/engine.cpp $SRCDIR/gjs/global.cpp $SRCDIR/gjs/importer.cpp \
+ $SRCDIR/gjs/jsapi-util-error.cpp $SRCDIR/gjs/jsapi-util-string.cpp \
+ $SRCDIR/gjs/module.cpp $SRCDIR/gjs/native.cpp $SRCDIR/gjs/stack.cpp \
+ $SRCDIR/modules/cairo-*.cpp $SRCDIR/modules/console.cpp \
+ $SRCDIR/modules/system.cpp $SRCDIR/test/*.cpp $SRCDIR/util/*.cpp \
+ $SRCDIR/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
+$IWYU $SRCDIR/gjs/context.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=$SRCDIR/gjs/context-private.h
+$IWYU $SRCDIR/gjs/jsapi-dynamic-class.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=$SRCDIR/gjs/jsapi-class.h
+$IWYU $SRCDIR/gjs/jsapi-util.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=$SRCDIR/gjs/jsapi-util-args.h \
+ -Xiwyu --check_also=$SRCDIR/gjs/jsapi-util-root.h
+$IWYU $SRCDIR/gjs/mem.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=$SRCDIR/gjs/mem-private.h
+$IWYU $SRCDIR/gjs/profiler.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=$SRCDIR/gjs/profiler-private.h
+$IWYU $SRCDIR/modules/cairo.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=$SRCDIR/modules/cairo-module.h \
+ -Xiwyu --check_also=$SRCDIR/modules/cairo-private.h
-for FILE in ../gjs/macros.h ../gjs/console.cpp \
- ../installed-tests/minijasmine.cpp
+for FILE in $SRCDIR/gjs/console.cpp $SRCDIR/installed-tests/minijasmine.cpp
do
$IWYU $FILE -- $PUBLIC_MAPPING
done