buildmachine-mac-setup.sh 3.81 KB
Newer Older
Robin Fischer's avatar
Robin Fischer committed
1 2 3 4
#!/bin/sh

# Setup script for build machine. Is intended to be re-runnable withot breaking things

5 6 7 8 9
add_or_set_plist () {
    KEY=$1
    TYPE=$2
    VALUE=$3
    PLIST_PATH=$4
10
    echo "Setting plist ${KEY}:${VALUE} with type: ${TYPE} at path: ${PLIST_PATH}"
11
    PLIST_BUDDY=/usr/libexec/PlistBuddy
Robin Fischer's avatar
Robin Fischer committed
12
    ${PLIST_BUDDY} -x -c "Add :${KEY} ${TYPE} ${VALUE}" ${PLIST_PATH} || ${PLIST_BUDDY} -x -c "Set :${KEY} ${VALUE}" ${PLIST_PATH}
13
}
Robin Fischer's avatar
Robin Fischer committed
14

Robin Fischer's avatar
Robin Fischer committed
15 16
write_to_profile () {
    echo "Write $1=$2 to .bash_profile"
Robin Fischer's avatar
Robin Fischer committed
17
    echo "export $1=$2" >> ~/.bash_profile
Robin Fischer's avatar
Robin Fischer committed
18 19
}

Robin Fischer's avatar
Robin Fischer committed
20
brew tap "homebrew/cask-versions"
21
brew cask install adoptopenjdk8
22 23 24 25
# NDK 16b
#brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/4570652dc6a3a8f7fd2be1053dd43547a2c78e26/Casks/android-ndk.rb
# NDK 19
brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/5e9f77552aef2ffa29efe8a9b916d89686b96c7f/Casks/android-ndk.rb
Robin Fischer's avatar
Robin Fischer committed
26
brew cask install android-sdk
Robin Fischer's avatar
Robin Fischer committed
27
brew cask install xamarin xamarin-android xamarin-ios
28
brew cask install dotnet-sdk
Robin Fischer's avatar
Robin Fischer committed
29
brew cask install mono-mdk-for-visual-studio
30
brew cask install google-cloud-sdk
Robin Fischer's avatar
Robin Fischer committed
31

Robin Fischer's avatar
Robin Fischer committed
32 33
rm ~/.bash_profile

Robin Fischer's avatar
Robin Fischer committed
34 35
write_to_profile JAVA_HOME '/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home'
write_to_profile ANDROID_NDK_HOME '/usr/local/share/android-ndk'
Robin Fischer's avatar
Robin Fischer committed
36
write_to_profile ANDROID_SDK_HOME '/usr/local/share/android-sdk'
37
write_to_profile ANDROID_HOME '/usr/local/share/android-sdk'
Robin Fischer's avatar
Robin Fischer committed
38
write_to_profile UNITY_INSTALLATIONS '/Applications/Unity/Hub/Editor'
Robin Fischer's avatar
Robin Fischer committed
39
write_to_profile UNITY_EXECUTABLE_RELATIVE_PATH 'Unity.app/Contents/MacOS/Unity'
Robin Fischer's avatar
Robin Fischer committed
40
write_to_profile PATH '${HOME}/.gem/ruby/2.3.0/bin:${PATH}'
Robin Fischer's avatar
Robin Fischer committed
41 42 43
write_to_profile PATH '/usr/local/opt/ruby/bin:${PATH}'
write_to_profile LDFLAGS '-L/usr/local/opt/ruby/lib'
write_to_profile CPPFLAGS '-I/usr/local/opt/ruby/include'
44 45
write_to_profile LC_ALL en_US.UTF-8
write_to_profile LANG en_US.UTF-8
Robin Fischer's avatar
Robin Fischer committed
46

Robin Fischer's avatar
Robin Fischer committed
47
# Install all gems into user space
Robin Fischer's avatar
Robin Fischer committed
48
echo "gem: --user-install" > ~/.gemrc
Robin Fischer's avatar
Robin Fischer committed
49 50 51 52 53

# Reload environment
source ~/.bash_profile

# Set Unity Properties
Robin Fischer's avatar
Robin Fischer committed
54
UNITY_PREF_PATH=~/Library/Preferences/com.unity3d.UnityEditor5.x.plist
55 56
#add_or_set_plist AndroidNdkRootR16b string ${ANDROID_NDK_HOME} ${UNITY_PREF_PATH}
add_or_set_plist AndroidNdkRootR19 string ${ANDROID_NDK_HOME} ${UNITY_PREF_PATH}
Robin Fischer's avatar
Robin Fischer committed
57 58 59 60 61
add_or_set_plist AndroidSdkRoot string ${ANDROID_SDK_HOME} ${UNITY_PREF_PATH}
add_or_set_plist JdkPath string ${JAVA_HOME} ${UNITY_PREF_PATH}
add_or_set_plist JdkUseEmbedded integer 0 ${UNITY_PREF_PATH}
add_or_set_plist SdkUseEmbedded integer 0 ${UNITY_PREF_PATH}
add_or_set_plist NdkUseEmbedded integer 0 ${UNITY_PREF_PATH}
Robin Fischer's avatar
Robin Fischer committed
62

63 64 65
# Install LaunchAgents
mkdir -p ~/Library/LaunchAgents
cp -f local.caffeinate.plist ~/Library/LaunchAgents/local.caffeinate.plist
Robin Fischer's avatar
Robin Fischer committed
66

Robin Fischer's avatar
Robin Fischer committed
67 68 69 70
# Setup Android SDK
yes | sdkmanager --licenses
sdkmanager "platform-tools" "platforms;android-28"

Robin Fischer's avatar
Robin Fischer committed
71 72 73
# Setup XCode
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Robin Fischer's avatar
Robin Fischer committed
74
# Install dependencies from Brewfile 
75
brew bundle --verbose
Robin Fischer's avatar
Robin Fischer committed
76

Robin Fischer's avatar
Robin Fischer committed
77 78 79 80 81
# Xamarin JDK (not in brew)
wget https://dl.xamarin.com/OpenJDK/mac/microsoft-dist-openjdk-1.8.0.25.zip
mkdir -p ~/Library/Developer/Xamarin/jdk
unzip microsoft-dist-openjdk-1.8.0.25.zip -d ~/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25

Robin Fischer's avatar
Robin Fischer committed
82
# Gem Setup
Robin Fischer's avatar
Robin Fischer committed
83
gem install bundler
Robin Fischer's avatar
Robin Fischer committed
84
bundle install --gemfile="../Gemfile" --path="~/.gem"
Robin Fischer's avatar
Robin Fischer committed
85

86
# Npm Setup
Robin Fischer's avatar
Robin Fischer committed
87
npm install -g npm
88
npm install -g firebase-tools
Robin Fischer's avatar
Robin Fischer committed
89

Robin Fischer's avatar
Robin Fischer committed
90 91 92
# Python setup
pip3 install requests

93 94 95 96 97 98 99
# Docker setup
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
docker-machine create default --driver xhyve

# Google Services Init
gcloud auth configure-docker
Robin Fischer's avatar
Robin Fischer committed
100
firebase --open-sesame appdistribution
101

102
git lfs install --system
Robin Fischer's avatar
Robin Fischer committed
103

104
echo "If you want set the '[[runners]]/limit' variable in ~/.gitlab-runner/config.toml to '1' if this executer should only have one build running at a time"