view misc/run-clang-tidy.sh @ 2265:d33dff02b39b sandbox-notarize

Work on sandboxing (possibly) and using the hardened runtime for notarization. Supply appropriate bundle ID for helpers as well as main application, and request inherited sandbox entitlements. Currently works with sandboxing (apparently) but not yet with the hardened runtime, where we can't load plugins signed by third parties even with the com.apple.security.cs.disable-library-validation entitlement because their team IDs don't match the host. Possibly that exception is supposed to be requested some other way?
author Chris Cannam
date Thu, 25 Apr 2019 16:46:02 +0100
parents 7c30a7f20c6a
children
line wrap: on
line source
#!/bin/bash

usage() {
    echo
    echo "  $0: run clang-tidy on a build with supplied arguments" 1>&2
    echo
    echo "  Run this from the root of the source tree, on a Linux system." 1>&2
    echo "  Assumes that \"./configure && make clean && make\" will produce a successful" 1>&2
    echo "  build using g++." 1>&2
    echo "  All arguments are passed to clang-tidy." 1>&2
    echo
    exit 2
}

if [ t"$1" = "t" ]; then
    usage
fi

ctargs="$@"

echo "clang-tidy args: $ctargs"

set -eu

tmpdir=$(mktemp -d)
trap "rm -rf \$tmpdir\$" 0

#log="build.log"

log="$tmpdir/make.log"
./configure
make clean
make -j3 2>&1 | tee "$log"

list="$tmpdir/tidy.list"

grep '^g[+][+] ' "$log" | grep ' [-]c ' > "$list"

cat "$list" | while read line ; do

    filename=${line##* }
    remainder=${line% *}
    cc=${remainder%% *}
    ccargs=${remainder#* }

    ccargs=$(echo "$ccargs" | sed 's/-flto //')

    echo
    
    case "$filename" in
        bq*) echo "ignoring $filename" ;;
        o/*) echo "ignoring $filename" ;;
        vamp-*) echo "ignoring $filename" ;;
        dataquay/*) echo "ignoring $filename" ;;
        src/*) echo "ignoring $filename" ;;
        *) echo "not ignoring $filename"
           echo clang-tidy $ctargs "$filename" -- $ccargs ;
           clang-tidy $ctargs "$filename" -- $ccargs ;;
    esac
done