|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -eu |
| 3 | + |
| 4 | +if [ "${1:-}" == "brew" ]; then |
| 5 | + echo "Updating brew..." |
| 6 | + brew update |
| 7 | + brew upgrade |
| 8 | + shift |
| 9 | +fi |
| 10 | + |
| 11 | +# Install dependencies via homebrew, including carthage (see Brewfile) |
| 12 | +brew bundle |
| 13 | + |
| 14 | +# Initialize git submodules |
| 15 | +# macOS does not have realpath and readlink does not have -f option, so do this instead: |
| 16 | +myDir=$( cd "$(dirname "$0")" ; pwd -P ) |
| 17 | +cd "${myDir}" |
| 18 | + |
| 19 | +core_dir="external/objectbox" |
| 20 | + |
| 21 | +if [ ! -d "../objectbox.git" ]; then |
| 22 | + if [ -d "${core_dir}" ]; then |
| 23 | + rm -d "${core_dir}" |
| 24 | + fi |
| 25 | + |
| 26 | + echo "Updating git submodules..." |
| 27 | + git submodule update --init --recursive external/SwiftLint external/objectbox-swift-generator |
| 28 | +else |
| 29 | + echo "Updating git submodules..." |
| 30 | + git submodule update --init --recursive |
| 31 | + |
| 32 | + echo "Core submodule status and version string from ObjectStore.cpp:" |
| 33 | + git submodule status "$core_dir" |
| 34 | + grep 'ObjectStore_VERSION = ' "$core_dir/objectbox/src/main/cpp/ObjectStore.cpp" |
| 35 | +fi |
| 36 | + |
| 37 | +# Install Xcode command line tools (installed by default with newer versions) |
| 38 | +xcode_cli_tools=$(xcode-select 2>&1 --install || true) |
| 39 | +if [[ $xcode_cli_tools != *"already installed"* ]]; then |
| 40 | + echo "Trying to install Xcode command line tools returned this message:" |
| 41 | + echo "$xcode_cli_tools" |
| 42 | + exit 1 |
| 43 | +fi |
| 44 | + |
| 45 | +# Build SwiftLint from source into its `external/SwiftLint/.build` directory. |
| 46 | +make build_swiftlint |
| 47 | + |
| 48 | +# Build the code generator binary (including Sourcery) |
| 49 | +cd ios-framework |
| 50 | +make build_generator |
| 51 | +cd .. |
| 52 | + |
| 53 | +# Print Carthage version |
| 54 | +cartage_version=$(carthage version || true) |
| 55 | +echo "Carthage version: $cartage_version" |
| 56 | + |
| 57 | +# Install gems, including CocoaPods (see Gemfile) |
| 58 | +bundle install |
| 59 | + |
| 60 | +# Update CocoaPods repo |
| 61 | +cocoapods_version=$(pod --version || true) |
| 62 | +echo "Cocoapods version: $cocoapods_version" |
| 63 | +pod repo update |
| 64 | + |
| 65 | +# Print CMake version |
| 66 | +echo "CMake: $(cmake --version)" |
| 67 | + |
| 68 | +echo "Seems like setup was successful. So, what's next? See the Development section of the README." |
0 commit comments