diff --git a/.travis.yml b/.travis.yml index 2e7399bd..46fb903e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ matrix: script: - xcodebuild -configuration Debug - xcodebuild -configuration Release - - xcodebuild analyze -quiet -configuration Debug CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ] - - xcodebuild analyze -quiet -configuration Release CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ] + - xcodebuild analyze -quiet -scheme Lilu -configuration Debug CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ] + - xcodebuild analyze -quiet -scheme Lilu -configuration Release CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ] deploy: provider: releases @@ -26,7 +26,6 @@ matrix: tags: true - os: osx - osx_image: xcode6.4 compiler: clang script: @@ -38,5 +37,6 @@ matrix: name: "acidanthera/Lilu" description: "Lilu" notification_email: $NOTIFICATION_EMAIL + build_command_prepend: "src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/covstrap.sh) && eval \"$src\" || exit 1" build_command: "xcodebuild -configuration Release" branch_pattern: master diff --git a/Lilu/Scripts/cov-cc b/Lilu/Scripts/cov-cc new file mode 100755 index 00000000..1321d1b1 --- /dev/null +++ b/Lilu/Scripts/cov-cc @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# cov-cc +# Lilu +# +# Copyright © 2018 vit9696. All rights reserved. +# + +if [ "${COVERITY_CC}" = "" ]; then + COVERITY_CC="/usr/bin/clang" +fi + +if [ "${COVERITY_RESULTS_DIR}" = "" ]; then + COVERITY_RESULTS_DIR="cov-int" +fi + +if [ "${COVERITY_CC_LOG}" != "" ]; then + touch "${COVERITY_CC_LOG}" + echo "${COVERITY_CC} $@" >> "${COVERITY_CC_LOG}" +fi + +# Make sure compiler code is always returned and do not mess with other tools! +cov-translate --dir "${COVERITY_RESULTS_DIR}" "${COVERITY_CC}" "$@" &>/dev/null +"${COVERITY_CC}" "$@" diff --git a/Lilu/Scripts/cov-csrutil b/Lilu/Scripts/cov-csrutil new file mode 100755 index 00000000..55dad12b --- /dev/null +++ b/Lilu/Scripts/cov-csrutil @@ -0,0 +1,10 @@ +#!/bin/bash + +# +# cov-csrutil +# Lilu +# +# Copyright © 2018 vit9696. All rights reserved. +# + +echo 'System Integrity Protection status: disabled.' diff --git a/Lilu/Scripts/cov-cxx b/Lilu/Scripts/cov-cxx new file mode 100755 index 00000000..c3ad6af2 --- /dev/null +++ b/Lilu/Scripts/cov-cxx @@ -0,0 +1,25 @@ +#!/bin/bash + +# +# cov-cxx +# Lilu +# +# Copyright © 2018 vit9696. All rights reserved. +# + +if [ "${COVERITY_CXX}" = "" ]; then + COVERITY_CXX="/usr/bin/clang++" +fi + +if [ "${COVERITY_RESULTS_DIR}" = "" ]; then + COVERITY_RESULTS_DIR="cov-int" +fi + +if [ "${COVERITY_CXX_LOG}" != "" ]; then + touch "${COVERITY_CXX_LOG}" + echo "${COVERITY_CXX} $@" >> "${COVERITY_CXX_LOG}" +fi + +# Make sure compiler code is always returned and do not mess with other tools! +cov-translate --dir "${COVERITY_RESULTS_DIR}" "${COVERITY_CXX}" "$@" &>/dev/null +"${COVERITY_CXX}" "$@" diff --git a/Lilu/Scripts/covstrap.sh b/Lilu/Scripts/covstrap.sh new file mode 100644 index 00000000..55b3e810 --- /dev/null +++ b/Lilu/Scripts/covstrap.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +# +# covstrap.sh +# Lilu +# +# Copyright © 2018 vit9696. All rights reserved. +# + +# +# This script is supposed to quickly bootstrap Coverity Scan environment for Travis CI +# to be later used with Lilu and plugins. +# +# Latest version available at: +# https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/covstrap.sh +# +# Example usage: +# src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/covstrap.sh) && eval "$src" || exit 1 +# + +PROJECT_PATH="$(pwd)" +if [ $? -ne 0 ] || [ ! -d "${PROJECT_PATH}" ]; then + echo "ERROR: Failed to determine working directory!" + exit 1 +fi + +# Avoid conflicts with PATH overrides. +CHMOD="/bin/chmod" +CURL="/usr/bin/curl" +MKDIR="/bin/mkdir" +RM="/bin/rm" + +TOOLS=( + "${CHMOD}" + "${CURL}" + "${MKDIR}" + "${RM}" +) + +for tool in "${TOOLS[@]}"; do + if [ ! -x "${tool}" ]; then + echo "ERROR: Missing ${tool}!" + exit 1 + fi +done + +# Coverity compatibility tools +COV_TOOLS_URL="https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts" +COV_TOOLS=( + "cov-cc" + "cov-cxx" + "cov-csrutil" +) + +COV_OVERRIDES=( + "clang" + "clang++" + "gcc" + "g++" +) + +COV_OVERRIDES_TARGETS=( + "cov-cc" + "cov-cxx" + "cov-cc" + "cov-cxx" +) + +COV_OVERRIDE_NUM="${#COV_OVERRIDES[@]}" + +# Export override variables +export COVERITY_RESULTS_DIR="${PROJECT_PATH}/cov-int" +export COVERITY_TOOLS_DIR="${PROJECT_PATH}/cov-tools" + +export COVERITY_CSRUTIL_PATH="${COVERITY_TOOLS_DIR}/cov-csrutil" +export CC="${COVERITY_TOOLS_DIR}/cov-cc" +export CXX="${COVERITY_TOOLS_DIR}/cov-cxx" + +# Prepare directory structure +ret=0 +"${RM}" -rf "${COVERITY_TOOLS_DIR}" +"${MKDIR}" "${COVERITY_TOOLS_DIR}" || ret=$? + +if [ $ret -ne 0 ]; then + echo "ERROR: Failed to create cov-tools directory ${COVERITY_TOOLS_DIR} with code ${ret}!" + exit 1 +fi + +# Prepare tools +cd cov-tools || exit 1 + +# Download tools to override +for tool in "${COV_TOOLS[@]}"; do + url="${COV_TOOLS_URL}/${tool}" + "${CURL}" -LfsO "${url}" || ret=$? + if [ $ret -ne 0 ]; then + echo "ERROR: Failed to download ${tool} with code ${ret}!" + exit 1 + fi + "${CHMOD}" a+x "${tool}" || ret=$? + if [ $ret -ne 0 ]; then + echo "ERROR: Failed to chmod ${tool} with code ${ret}!" + exit 1 + fi +done + +# Generate compiler tools PATH overrides +for ((i=0; $i<$COV_OVERRIDE_NUM; i++)); do + tool="${COV_OVERRIDES[$i]}" + target="${COV_OVERRIDES_TARGETS[$i]}" + echo "${target} \"\$@\"" > "${tool}" || ret=$? + if [ $ret -ne 0 ]; then + echo "ERROR: Failed to generate ${tool} override to ${target} with code ${ret}!" + exit 1 + fi + "${CHMOD}" a+x "${tool}" || ret=$? + if [ $ret -ne 0 ]; then + echo "ERROR: Failed to chmod ${tool} with code ${ret}!" + exit 1 + fi +done + +# Done with tools +cd .. || exit 1 + +# Refresh PATH to apply overrides +export PATH="${COVERITY_TOOLS_DIR}:${PATH}"