-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1914 from DataDog/ganeshnj/chore/fix-spm-build
chore: fix SPM build and add scripts to check locally
- Loading branch information
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/zsh | ||
|
||
# Usage: | ||
# $ ./tools/spm.sh -h | ||
# Builds the SDK only using Package.swift. | ||
|
||
set -eo pipefail | ||
source ./tools/utils/echo_color.sh | ||
source ./tools/utils/argparse.sh | ||
|
||
define_arg "platform" "" "Defines the type of simulator platform for the tests, e.g. 'iOS', 'tvOS, 'visionOS'" "string" "true" | ||
|
||
check_for_help "$@" | ||
parse_args "$@" | ||
|
||
WORKSPACE="Datadog.xcworkspace" | ||
WORKSPACE_RENAMED="Datadog.xcworkspace.old" | ||
SCHEME="Datadog-Package" | ||
|
||
set -x | ||
|
||
rename_workspace() { | ||
if [ ! -d "$WORKSPACE" ]; then | ||
echo_warn "Workspace $WORKSPACE does not exist" | ||
return 0 | ||
fi | ||
|
||
echo_warn "Renaming workspace to $WORKSPACE_RENAMED" | ||
mv "$WORKSPACE" "$WORKSPACE_RENAMED" | ||
} | ||
|
||
restore_workspace() { | ||
if [ ! -d "$WORKSPACE_RENAMED" ]; then | ||
echo_warn "Workspace $WORKSPACE_RENAMED does not exist" | ||
return 0 | ||
fi | ||
|
||
echo_warn "Restoring workspace to $WORKSPACE" | ||
mv "$WORKSPACE_RENAMED" "$WORKSPACE" | ||
} | ||
|
||
rename_workspace | ||
# try to restore the files even if the script fails | ||
trap restore_workspace EXIT INT | ||
|
||
echo "Building SDK for platform $platform" | ||
xcodebuild build -scheme $SCHEME -destination generic/platform="$platform" | xcbeautify |