Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/Docs/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription
let package = Package(
name: "DocsExamples",
dependencies: [
.package(url: "https://github.com/mongodb/mongo-swift-driver", .branch("master"))
.package(url: "https://github.com/mongodb/mongo-swift-driver", .upToNextMajor(from: "0.1.0"))
],
targets: [
.target(name: "DocsExamples", dependencies: ["MongoSwift"])
Expand Down
35 changes: 35 additions & 0 deletions etc/build-examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

exit_code=0

examples=("BugReport" "Docs" "KituraExample" "PerfectExample" "VaporExample")

for example_project in ${examples[@]}; do
echo "Building $example_project"
example_dir="Examples/${example_project}"

# replace version string with master
etc/sed.sh -i 's/swift-driver", .upToNextMajor[^)]*)/swift-driver", .branch("master")/' "${example_dir}/Package.swift"

pushd "${example_dir}"

# don't exit on failure
set +e
swift build
build_success=$?
set -e

rm -rf ./.build
rm Package.resolved
git checkout Package.swift
popd

if [ ${build_success} -eq 0 ]; then
echo "================= Building $example_project succeeded ================="
else
echo "================= Building $example_project failed ================="
exit_code=1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was updated so that the script attempts to build all examples now, even if prior builds failed.

fi
done

exit "${exit_code}"
7 changes: 5 additions & 2 deletions etc/release.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# usage: ./release/release.sh [new version string]
# for example: ./release/release.sh 1.0.0
# usage: ./etc/release.sh [new version string]
# for example: ./etc/release.sh 1.0.0

# exit if any command fails
set -e

# verify that the examples build
./etc/build-examples.sh

# update version string for libmongoc handshake
sourcery --sources Sources/MongoSwift --templates Sources/MongoSwift/MongoSwiftVersion.stencil --output Sources/MongoSwift/MongoSwiftVersion.swift --args versionString=${1}

Expand Down
19 changes: 19 additions & 0 deletions etc/sed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

case "$(uname -s)" in
Darwin)
sed=gsed
;;
*)
sed=sed
;;
esac

if ! hash ${sed} 2>/dev/null; then
echo "You need sed \"${sed}\" to run this script ..."
echo
echo "On macOS: brew install gnu-sed"
exit 43
fi

${sed} "$@"
16 changes: 1 addition & 15 deletions etc/vendor-libmongoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,7 @@ if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
exit 1
fi

case "$(uname -s)" in
Darwin)
sed=gsed
;;
*)
sed=sed
;;
esac

if ! hash ${sed} 2>/dev/null; then
echo "You need sed \"${sed}\" to run this script ..."
echo
echo "On macOS: brew install gnu-sed"
exit 43
fi
sed="$ETC_DIR/sed.sh"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was moved to a separate script so that I could use it in build-examples.sh.


echo "REMOVING any previously vendored libmongoc code"
rm -rf $CLIBMONGOC_INCLUDE_PATH
Expand Down