mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 06:34:22 +00:00
Add BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS preprocessor flag. Also, add...
an option to build_and_install.sh for passing extra options to xcodebuild.
This commit is contained in:
parent
2d135838fa
commit
129c21a180
3 changed files with 31 additions and 20 deletions
|
@ -877,6 +877,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS = 1;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
|
@ -918,6 +919,7 @@
|
|||
"CoreAudio_UseSysLog=1",
|
||||
"CoreAudio_StopOnAssert=1",
|
||||
"CoreAudio_ThreadStampMessages=1",
|
||||
"BGM_StopDebuggerOnLoggedExceptions=$(BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS)",
|
||||
);
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
|
@ -984,6 +986,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS = 1;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
|
@ -1025,6 +1028,7 @@
|
|||
"CoreAudio_UseSysLog=1",
|
||||
"CoreAudio_StopOnAssert=1",
|
||||
"CoreAudio_ThreadStampMessages=1",
|
||||
"BGM_StopDebuggerOnLoggedExceptions=$(BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS)",
|
||||
);
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
|
@ -1055,6 +1059,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS = 0;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||
|
@ -1092,9 +1097,8 @@
|
|||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=0",
|
||||
"CoreAudio_Debug=0",
|
||||
"CoreAudio_UseSysLog=0",
|
||||
"CoreAudio_StopOnAssert=0",
|
||||
"CoreAudio_ThreadStampMessages=0",
|
||||
"BGM_StopDebuggerOnLoggedExceptions=$(BGM_STOP_DEBUGGER_ON_LOGGED_EXCEPTIONS)",
|
||||
);
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace BGM_Utils
|
|||
const char* callerName,
|
||||
const char* __nullable message,
|
||||
bool expected,
|
||||
bool failInDebugBuilds,
|
||||
const std::function<void(void)>& function);
|
||||
|
||||
#pragma mark Exception utils
|
||||
|
@ -79,8 +78,7 @@ namespace BGM_Utils
|
|||
const char* callerName,
|
||||
const std::function<void(void)>& function)
|
||||
{
|
||||
return LogAndSwallowExceptions(fileName, lineNumber, callerName, nullptr, true, true,
|
||||
function);
|
||||
return LogAndSwallowExceptions(fileName, lineNumber, callerName, nullptr, true, function);
|
||||
}
|
||||
|
||||
OSStatus LogAndSwallowExceptions(const char* __nullable fileName,
|
||||
|
@ -89,8 +87,7 @@ namespace BGM_Utils
|
|||
const char* __nullable message,
|
||||
const std::function<void(void)>& function)
|
||||
{
|
||||
return LogAndSwallowExceptions(fileName, lineNumber, callerName, message, true, true,
|
||||
function);
|
||||
return LogAndSwallowExceptions(fileName, lineNumber, callerName, message, true, function);
|
||||
}
|
||||
|
||||
void LogException(const char* __nullable fileName,
|
||||
|
@ -135,8 +132,7 @@ namespace BGM_Utils
|
|||
const char* __nullable message,
|
||||
const std::function<void(void)>& function)
|
||||
{
|
||||
return LogAndSwallowExceptions(fileName, lineNumber, callerName, message, false, true,
|
||||
function);
|
||||
return LogAndSwallowExceptions(fileName, lineNumber, callerName, message, false, function);
|
||||
}
|
||||
|
||||
#pragma mark Implementation
|
||||
|
@ -146,7 +142,6 @@ namespace BGM_Utils
|
|||
const char* callerName,
|
||||
const char* __nullable message,
|
||||
bool expected,
|
||||
bool failInDebugBuilds,
|
||||
const std::function<void(void)>& function)
|
||||
{
|
||||
try
|
||||
|
@ -170,8 +165,9 @@ namespace BGM_Utils
|
|||
: "Feel free to report this at"),
|
||||
kBGMIssueTrackerURL);
|
||||
|
||||
BGMAssert(!failInDebugBuilds, "CAException");
|
||||
|
||||
#if BGM_StopDebuggerOnLoggedExceptions
|
||||
BGMAssert(false, "CAException");
|
||||
#endif
|
||||
return e.GetError();
|
||||
}
|
||||
catch(...)
|
||||
|
@ -186,9 +182,10 @@ namespace BGM_Utils
|
|||
(expected ? "If you think this might be a bug:"
|
||||
: "Feel free to report this at"),
|
||||
kBGMIssueTrackerURL);
|
||||
|
||||
BGMAssert(!failInDebugBuilds, "Unknown exception");
|
||||
|
||||
|
||||
#if BGM_StopDebuggerOnLoggedExceptions
|
||||
BGMAssert(false, "Unknown exception");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ CONFIGURATION=Release
|
|||
# information after every build.
|
||||
CLEAN=clean
|
||||
|
||||
XCODEBUILD_OPTIONS=""
|
||||
|
||||
CONTINUE_ON_ERROR=0
|
||||
|
||||
# Update .gitignore if you change this.
|
||||
|
@ -123,10 +125,11 @@ RECOMMENDED_MIN_XCODE_VERSION=7
|
|||
|
||||
usage() {
|
||||
echo "Usage: $0 [options]" >&2
|
||||
echo -e "\t-n\tDon't clean before building/installing." >&2
|
||||
echo -e "\t-d\tDebug build. (Release is the default.)" >&2
|
||||
echo -e "\t-c\tContinue on script errors. Might not be safe." >&2
|
||||
echo -e "\t-h\tPrint this usage statement." >&2
|
||||
echo -e "\t-n Don't clean before building/installing." >&2
|
||||
echo -e "\t-d Debug build. (Release is the default.)" >&2
|
||||
echo -e "\t-x [options] Extra options to pass to xcodebuild." >&2
|
||||
echo -e "\t-c Continue on script errors. Might not be safe." >&2
|
||||
echo -e "\t-h Print this usage statement." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -209,7 +212,7 @@ show_spinner() {
|
|||
}
|
||||
|
||||
parse_options() {
|
||||
while getopts ":ndch" opt; do
|
||||
while getopts ":ndx:ch" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
CLEAN=""
|
||||
|
@ -217,6 +220,9 @@ parse_options() {
|
|||
d)
|
||||
CONFIGURATION="Debug"
|
||||
;;
|
||||
x)
|
||||
XCODEBUILD_OPTIONS="$OPTARG"
|
||||
;;
|
||||
c)
|
||||
CONTINUE_ON_ERROR=1
|
||||
echo "$(tput setaf 11)WARNING$(tput sgr0): Ignoring errors."
|
||||
|
@ -463,6 +469,7 @@ echo "[1/3] Installing the virtual audio device $(bold_face ${DRIVER_DIR}) to" \
|
|||
-target "PublicUtility" \
|
||||
-configuration ${CONFIGURATION} \
|
||||
RUN_CLANG_STATIC_ANALYZER=0 \
|
||||
${XCODEBUILD_OPTIONS} \
|
||||
${CLEAN} build >> ${LOG_FILE} 2>&1) &
|
||||
|
||||
(set +e; trap - ERR
|
||||
|
@ -473,6 +480,7 @@ echo "[1/3] Installing the virtual audio device $(bold_face ${DRIVER_DIR}) to" \
|
|||
-configuration ${CONFIGURATION} \
|
||||
RUN_CLANG_STATIC_ANALYZER=0 \
|
||||
DSTROOT="/" \
|
||||
${XCODEBUILD_OPTIONS} \
|
||||
${CLEAN} install >> ${LOG_FILE} 2>&1) &
|
||||
|
||||
show_spinner "${BUILD_FAILED_ERROR_MSG}"
|
||||
|
@ -489,6 +497,7 @@ echo "[2/3] Installing $(bold_face ${XPC_HELPER_DIR}) to $(bold_face ${XPC_HELPE
|
|||
RUN_CLANG_STATIC_ANALYZER=0 \
|
||||
DSTROOT="/" \
|
||||
INSTALL_PATH="${XPC_HELPER_PATH}" \
|
||||
${XCODEBUILD_OPTIONS} \
|
||||
${CLEAN} install >> ${LOG_FILE} 2>&1) &
|
||||
|
||||
show_spinner "${BUILD_FAILED_ERROR_MSG}"
|
||||
|
@ -504,6 +513,7 @@ echo "[3/3] Installing $(bold_face ${APP_DIR}) to $(bold_face ${APP_PATH})." \
|
|||
-configuration ${CONFIGURATION} \
|
||||
RUN_CLANG_STATIC_ANALYZER=0 \
|
||||
DSTROOT="/" \
|
||||
${XCODEBUILD_OPTIONS} \
|
||||
${CLEAN} install >> ${LOG_FILE} 2>&1) &
|
||||
|
||||
show_spinner "${BUILD_FAILED_ERROR_MSG}"
|
||||
|
|
Loading…
Reference in a new issue