-
Notifications
You must be signed in to change notification settings - Fork 54
/
test-swift-packages.sh
executable file
·39 lines (28 loc) · 905 Bytes
/
test-swift-packages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Swift package tests
set -e
export RUSTFLAGS="-D warnings"
# Change to the root directory of the Xcode project
cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P
THIS_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
ROOT_DIR="$THIS_DIR"
cd $ROOT_DIR
# Make a temp directory
TEMP_DIR=$(mktemp -d)
# Delete the temp directory before the shell exits
trap 'rm -rf $TEMP_DIR' EXIT
# Copy directories related to all of the building and test running to the temp directory
for DIR in crates src examples SwiftRustIntegrationTestRunner
do
cp -r $DIR/ $TEMP_DIR/$DIR
done
cp Cargo.toml $TEMP_DIR
cd $TEMP_DIR/SwiftRustIntegrationTestRunner
# Build Rust
mkdir -p swift-package-rust-library-fixture/generated
./swift-package-rust-library-fixture/build.sh
# Create Swift Package
cargo run -p integration-test-create-swift-package
# Test Swift Package
cd swift-package-test-package
swift test