[gjs/iwyu-job] fix
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/iwyu-job] fix
- Date: Wed, 3 Jun 2020 19:25:53 +0000 (UTC)
commit 9a1b3bdd15275df7e3a1d35ed4d2b8ad34865625
Author: Philip Chimento <philip chimento gmail com>
Date: Wed Jun 3 12:01:50 2020 -0700
fix
.gitlab-ci.yml | 2 +-
tools/run_iwyu.sh | 88 +++++++++++++++++++++++++++++++++++++------------------
2 files changed, 61 insertions(+), 29 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 22d228c5..b34b6d97 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -193,7 +193,7 @@ iwyu:
stage: source_check
image: registry.gitlab.gnome.org/ptomato/gjs:fedora.mozjs68-debug
script:
- - ./tools/run_iwyu.sh master
+ - ./tools/run_iwyu.sh origin/master
only:
- branches
- merge_requests
diff --git a/tools/run_iwyu.sh b/tools/run_iwyu.sh
index e718f31d..e57f9f5a 100755
--- a/tools/run_iwyu.sh
+++ b/tools/run_iwyu.sh
@@ -17,8 +17,6 @@ else
files="$(git diff-tree --name-only -r $1..) $(git diff-index --name-only HEAD)"
fi
-echo "files: $files"
-
should_analyze () {
file=$(realpath --relative-to=$SRCDIR $1)
case "$files" in
@@ -37,10 +35,15 @@ if ! meson setup _build; then
fi
cd ${BUILDDIR:-_build}
-IWYU="iwyu_tool -p ."
+git describe $1
+git describe HEAD
+echo "files: $files"
+
+IWYU="python3 $(which iwyu_tool) -p ."
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"
POSTPROCESS="python3 $SRCDIR/tools/process_iwyu.py"
+EXIT=0
for FILE in $SRCDIR/gi/*.cpp $SRCDIR/gjs/atoms.cpp $SRCDIR/gjs/byteArray.cpp \
$SRCDIR/gjs/coverage.cpp $SRCDIR/gjs/debugger.cpp \
@@ -52,40 +55,69 @@ for FILE in $SRCDIR/gi/*.cpp $SRCDIR/gjs/atoms.cpp $SRCDIR/gjs/byteArray.cpp \
$SRCDIR/modules/system.cpp $SRCDIR/test/*.cpp $SRCDIR/util/*.cpp \
$SRCDIR/libgjs-private/*.c
do
- should_analyze $FILE && $IWYU $FILE -- $PRIVATE_MAPPING | $POSTPROCESS
+ if should_analyze $FILE; then
+ if ! $IWYU $FILE -- $PRIVATE_MAPPING | $POSTPROCESS; then
+ EXIT=1
+ fi
+ fi
done
-should_analyze $SRCDIR/gjs/context.cpp && \
-$IWYU $SRCDIR/gjs/context.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/context-private.h | $POSTPROCESS
+if should_analyze $SRCDIR/gjs/context.cpp; then
+ if ! $IWYU $SRCDIR/gjs/context.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/gjs/context-private.h | $POSTPROCESS; then
+ EXIT=1
+ fi
+fi
-( should_analyze $SRCDIR/gjs/jsapi-dynamic-class.cpp || \
- should_analyze $SRCDIR/gjs/jsapi-class.h ) && \
-$IWYU $SRCDIR/gjs/jsapi-dynamic-class.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/jsapi-class.h | $POSTPROCESS
+if ( should_analyze $SRCDIR/gjs/jsapi-dynamic-class.cpp || \
+ should_analyze $SRCDIR/gjs/jsapi-class.h ); then
+ if ! $IWYU $SRCDIR/gjs/jsapi-dynamic-class.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/gjs/jsapi-class.h | $POSTPROCESS; then
+ EXIT=1
+ fi
+fi
-( should_analyze $SRCDIR/gjs/jsapi-util.cpp ||
+if ( should_analyze $SRCDIR/gjs/jsapi-util.cpp ||
should_analyze $SRCDIR/gjs/jsapi-util-args.h || \
- should_analyze $SRCDIR/gjs/jsapi-util-root.h ) && \
-$IWYU $SRCDIR/gjs/jsapi-util.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/jsapi-util-args.h \
- -Xiwyu --check_also=*/gjs/jsapi-util-root.h | $POSTPROCESS
+ should_analyze $SRCDIR/gjs/jsapi-util-root.h ); then
+ if ! $IWYU $SRCDIR/gjs/jsapi-util.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/gjs/jsapi-util-args.h \
+ -Xiwyu --check_also=*/gjs/jsapi-util-root.h | $POSTPROCESS; then
+ EXIT=1
+ fi
+fi
-should_analyze $SRCDIR/gjs/mem.cpp && \
-$IWYU $SRCDIR/gjs/mem.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/mem-private.h | $POSTPROCESS
+if should_analyze $SRCDIR/gjs/mem.cpp; then
+ if ! $IWYU $SRCDIR/gjs/mem.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/gjs/mem-private.h | $POSTPROCESS; then
+ EXIT=1
+ fi
+fi
-should_analyze $SRCDIR/gjs/profiler.cpp && \
-$IWYU $SRCDIR/gjs/profiler.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/gjs/profiler-private.h | $POSTPROCESS
+if should_analyze $SRCDIR/gjs/profiler.cpp; then
+ if ! $IWYU $SRCDIR/gjs/profiler.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/gjs/profiler-private.h | $POSTPROCESS; then
+ EXIT=1
+ fi
+fi
-( should_analyze $SRCDIR/modules/cairo.cpp ||
- should_analyze $SRCDIR/modules/cairo-module.h ) && \
-$IWYU $SRCDIR/modules/cairo.cpp -- $PRIVATE_MAPPING \
- -Xiwyu --check_also=*/modules/cairo-module.h \
- -Xiwyu --check_also=*/modules/cairo-private.h | $POSTPROCESS
+if ( should_analyze $SRCDIR/modules/cairo.cpp ||
+ should_analyze $SRCDIR/modules/cairo-module.h ); then
+ if ! $IWYU $SRCDIR/modules/cairo.cpp -- $PRIVATE_MAPPING \
+ -Xiwyu --check_also=*/modules/cairo-module.h \
+ -Xiwyu --check_also=*/modules/cairo-private.h | $POSTPROCESS; then
+ EXIT=1
+ fi
+fi
for FILE in $SRCDIR/gjs/console.cpp $SRCDIR/installed-tests/minijasmine.cpp
do
- should_analyze $FILE && $IWYU $FILE -- $PUBLIC_MAPPING | $POSTPROCESS
+ if should_analyze $FILE; then
+ if ! $IWYU $FILE -- $PUBLIC_MAPPING | $POSTPROCESS; then
+ EXIT=1
+ fi
+ fi
done
+
+if test $EXIT -eq 0; then echo "No changes needed."; fi
+exit $EXIT
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]