How to suppress all of the warnings from third-party dependencies but not from the main target? A lot of third-party dependencies installed via SPM pollute the build log with warnings, those are not the things I'd like to focus on and get a report, since they never be fixed.
Code I'm using in my build script:
#!/bin/bash -e
SCHEME_NAME="NameOfTheScheme"
WORKSPACE_NAME="NameOfTheWorkspace.xcworkspace"
DERIVED_DATA="./DerivedData"
rm -rf Package.resolved
git clean -dxff
xcodebuild -resolvePackageDependencies -workspace $WORKSPACE_NAME -scheme $SCHEME_NAME -derivedDataPath $DERIVED_DATA OTHER_SWIFT_FLAGS="-Xfrontend -suppress-warnings"
# iOS module build
xcodebuild -workspace $WORKSPACE_NAME -scheme $SCHEME_NAME -sdk iphoneos -destination 'generic/platform=iOS' -derivedDataPath $DERIVED_DATA
xcodebuild -workspace $WORKSPACE_NAME -scheme $SCHEME_NAME -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath $DERIVED_DATA
OTHER_SWIFT_FLAGS="-DSUPPRESS_WARNINGS"
flag works perfectly for xcodebuild
:
#!/bin/bash -e
PACKAGE_SCHEME=$(xcodebuild -list | (awk '/Schemes:/ {p=1; next} p && NF; !p {p=0}' | grep "Package" || xcodebuild -list | awk '/Schemes:/ {p=1; next} p && NF; !p {p=0}' | head -1) | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
xcodebuild \
-scheme "$PACKAGE_SCHEME" \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone" \
-configuration Debug
OTHER_SWIFT_FLAGS="-DSUPPRESS_WARNINGS"