diff options
author | Philip Chimento <philip@endlessm.com> | 2019-08-27 16:01:38 +0300 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2019-10-12 21:20:56 -0700 |
commit | 868294f324efc6b276ccc5e1c8b1d02439676be9 (patch) | |
tree | 69986f35cf69187ce26361c5341a10bdffc0f3b4 /tools | |
parent | 00a7b5f78a8a9185d4f5f5fee52aa97f04fcc2a0 (diff) | |
download | gjs-868294f324efc6b276ccc5e1c8b1d02439676be9.tar.gz |
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/run_iwyu.sh | 37 | ||||
-rwxr-xr-x | tools/run_iwyu.sh.in | 59 |
2 files changed, 37 insertions, 59 deletions
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 diff --git a/tools/run_iwyu.sh.in b/tools/run_iwyu.sh.in deleted file mode 100755 index 705e09c6..00000000 --- a/tools/run_iwyu.sh.in +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -# run with 'make iwyu | tee iwyu.log' - -if test -z "$BUILDDIR" -o -z "$SRCDIR"; then - echo "SRCDIR and BUILDDIR must be defined. Try running 'make iwyu' instead." - exit 1 -fi - -cd "$SRCDIR" - -PRIVATE_MAPPING="-Xiwyu --mapping_file=tools/gjs-private-iwyu.imp" -PUBLIC_MAPPING="-Xiwyu --mapping_file=tools/gjs-public-iwyu.imp" - -LIBS_INCLUDES=$(pkg-config --cflags \ - "@AX_PACKAGE_REQUIRES@ @AX_PACKAGE_REQUIRES_PRIVATE@") -INCLUDES="-I. -I$BUILDDIR" -DEFINES="-DGJS_COMPILATION -DPKGLIBDIR=\"\" -DINSTTESTDIR=\"\" -DGJS_JS_DIR=\"\"" -CPP_ARGS="$LIBS_INCLUDES @SYSPROF_CAPTURE_CFLAGS@ $INCLUDES $DEFINES" - -LANG_CXX="--language=c++ -std=c++14" -LANG_C="--language=c" -CXX_STDLIB_INCLUDES=$(clang -Wp,-v $LANG_CXX -fsyntax-only /dev/null 2>&1 | \ - grep '^ ' | sed -e 's/^ /-I/') -C_STDLIB_INCLUDES=$(clang -Wp,-v $LANG_C -fsyntax-only /dev/null 2>&1 | \ - grep '^ ' | sed -e 's/^ /-I/') -CXX_ARGS="$LANG_CXX $CXX_STDLIB_INCLUDES $CPP_ARGS" -C_ARGS="$LANG_C $C_STDLIB_INCLUDES $CPP_ARGS" - -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 \ - gjs/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 -do - iwyu $PRIVATE_MAPPING $CXX_ARGS $FILE -done -iwyu $PRIVATE_MAPPING $CXX_ARGS gjs/context.cpp \ - -Xiwyu --check_also=gjs/context-private.h -iwyu $PRIVATE_MAPPING $CXX_ARGS gjs/jsapi-dynamic-class.cpp \ - -Xiwyu --check_also=gjs/jsapi-class.h -iwyu $PRIVATE_MAPPING $CXX_ARGS gjs/mem.cpp \ - -Xiwyu --check_also=gjs/mem-private.h -iwyu $PRIVATE_MAPPING $CXX_ARGS gjs/profiler.cpp \ - -Xiwyu --check_also=gjs/profiler-private.h -iwyu $PRIVATE_MAPPING $CXX_ARGS modules/cairo.cpp \ - -Xiwyu --check_also=modules/cairo-module.h \ - -Xiwyu --check_also=modules/cairo-private.h - -for FILE in gjs/console.cpp installed-tests/minijasmine.cpp; do - iwyu $PUBLIC_MAPPING $CXX_ARGS $FILE -done - -for FILE in libgjs-private/*.c; do - iwyu $PRIVATE_MAPPING $C_ARGS $FILE -done -iwyu $PUBLIC_MAPPING $C_ARGS gjs/macros.h |