Last active
May 15, 2018 16:21
-
-
Save matsuda/00558ac96ad8cd67a22f to your computer and use it in GitHub Desktop.
Warning script in swift project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://bendodson.com/weblog/2014/10/02/showing-todo-as-warning-in-swift-xcode-project/ | |
TAGS="TODO:|FIXME:|WARNING:" | |
echo "searching ${SRCROOT} for ${TAGS}" | |
# find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" | |
find "${SRCROOT}/${PROJECT_NAME}" \( -name "*.swift" ! -type d \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGETS > Build Phases > New Run Script Phase | |
``` | |
// download xc_build_alert.sh | |
chmod +x xc_build_alert.sh | |
``` | |
``` | |
/bin/sh | |
"${SRCROOT}/xc_build_runners/xc_build_alert.sh" | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################## | |
# | |
# Report errors and warnings | |
# | |
# refs. | |
# http://bendodson.com/weblog/2014/10/02/showing-todo-as-warning-in-swift-xcode-project/ | |
# http://www.mokacoding.com/blog/better-build-phase-scripts/ | |
# | |
# Author: matsuda | |
# | |
########################################## | |
set -e | |
set -o nounset | |
TAGS="TODO:|FIXME:|WARNING:" | |
echo "searching ${SRCROOT} for ${TAGS}" | |
find "${SRCROOT}/${PROJECT_NAME}" \( -name "*.swift" ! -type d \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/ios-os-x-development/highlight-warnings-in-xcode-521125121a75 も見てみる