[macOS] Deprecate stale code, update structure accordingly (#11473)

This commit is contained in:
Erik Bershel
2025-01-27 14:09:51 +01:00
committed by GitHub
parent 19c847488e
commit 620ebdf37b
54 changed files with 105 additions and 3203 deletions

View File

@@ -1,44 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: configure-max-files-limitation.sh
## Desc: Configure max files limitation
################################################################################
Launch_Daemons="/Library/LaunchDaemons"
# EOF in quotes to disable variable expansion
echo "Creating limit.maxfiles.plist"
cat > ${Launch_Daemons}/limit.maxfiles.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>Program</key>
<string>/Users/runner/limit-maxfiles.sh</string>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOF
# Creating script for applying workaround https://developer.apple.com/forums/thread/735798
cat > /Users/runner/limit-maxfiles.sh << EOF
#!/bin/bash
sudo launchctl limit maxfiles 256 unlimited
sudo launchctl limit maxfiles 65536 524288
EOF
echo "limit.maxfiles.sh permissions changing"
chmod +x /Users/runner/limit-maxfiles.sh
echo "limit.maxfiles.plist permissions changing"
chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist"
chmod 0644 ${Launch_Daemons}/limit.maxfiles.plist
echo "Done, limit.maxfiles has been updated"

View File

@@ -1,39 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: configure-network-interface-detection.sh
## Desc: add a Daemon to re-detect the attached network interfaces after vm is booted.
## Maintainer: @timsutton
## script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/add-network-interface-detection.sh
################################################################################
PLIST=/Library/LaunchDaemons/sonoma.detectnewhardware.plist
cat <<EOF > ${PLIST}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>sonoma.detectnewhardware</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/networksetup</string>
<string>-detectnewhardware</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
# These should be already set as follows, but since they're required
# in order to load properly, we set them explicitly.
/bin/chmod 644 ${PLIST}
/usr/sbin/chown root:wheel ${PLIST}
: '
The MIT License (MIT)
Copyright (c) 2013-2017 Timothy Sutton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'

View File

@@ -1,30 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: configure-screensaver.sh
## Desc: Configure screensaver
################################################################################
# set screensaver idleTime to 0, to prevent turning screensaver on
macUUID=$(ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62)
rm -rf /Users/$USERNAME/Library/Preferences/com.apple.screensaver.$macUUID.plist
rm -rf /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist
rm -rf /Users/$USERNAME/Library/Preferences/com.apple.screensaver.plist
rm -rf /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.plist
defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.$macUUID.plist idleTime -string 0
defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.$macUUID.plist CleanExit "YES"
defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist idleTime -string 0
defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist CleanExit "YES"
defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.plist idleTime -string 0
defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.plist CleanExit "YES"
defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.plist idleTime -string 0
defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.plist CleanExit "YES"
chown -R $USERNAME:staff /Users/$USERNAME/Library/Preferences/ByHost/
chown -R $USERNAME:staff /Users/$USERNAME/Library/Preferences/
killall cfprefsd
# Set values to 0, to prevent sleep at all
pmset -a displaysleep 0 sleep 0 disksleep 0

View File

@@ -12,20 +12,13 @@ close_finder_window
# Remove Parallels Desktop
# https://github.com/actions/runner-images/issues/6105
# https://github.com/actions/runner-images/issues/10143
if is_Monterey || is_SonomaX64 || is_VenturaX64; then
if is_SonomaX64 || is_VenturaX64; then
brew uninstall parallels
fi
# Put documentation to $HOME root
cp $HOME/image-generation/output/software-report/systeminfo.* $HOME/
# Put build vm assets (xamarin-selector) scripts to proper directory
if is_Monterey || is_Sonoma || is_Ventura; then
mkdir -p /usr/local/opt/$USER/scripts
mv $HOME/image-generation/assets/* /usr/local/opt/$USER/scripts
find /usr/local/opt/$USER/scripts -type f -name "*\.sh" -exec chmod +x {} \;
fi
# Remove fastlane cached cookie
rm -rf ~/.fastlane

View File

@@ -1,144 +0,0 @@
#!/usr/bin/env ruby
################################################################################
## File: configure-xcode-simulators.rb
## Desc: List all simulators, find duplicate type and delete them.
## Maintainer: @vlas-voloshin
## script was taken from https://gist.github.com/vlas-voloshin/f9982128200345cd3fb7
################################################################################
class SimDevice
attr_accessor :runtime
attr_accessor :name
attr_accessor :identifier
attr_accessor :timestamp
def initialize(runtime, name, identifier, timestamp)
@runtime = runtime
@name = name
@identifier = identifier
@timestamp = timestamp
end
def to_s
return "#{@name} - #{@runtime} (#{@identifier}) [#{@timestamp}]"
end
def equivalent_to_device(device)
return @runtime == device.runtime && @name == device.name
end
end
# Executes a shell command and returns the result from stdout
def execute_simctl_command(command)
return %x[xcrun simctl #{command}]
end
# Retrieves the creation date/time of simulator with specified identifier
def simulator_creation_date(identifier)
directory = Dir.home() + "/Library/Developer/CoreSimulator/Devices/" + identifier
if (Dir.exists?(directory))
if (File::Stat.method_defined?(:birthtime))
return File.stat(directory).birthtime
else
return File.stat(directory).ctime
end
else
# Simulator directory is not yet created - treat it as if it was created right now (happens with new iOS 9 sims)
return Time.now
end
end
# Deletes specified simulator
def delete_device(device)
execute_simctl_command("delete #{device.identifier}")
end
puts("Searching for simulators...")
# Retrieve the list of existing simulators
devices = []
runtime = ""
execute_simctl_command("list devices").lines.each do |line|
case line[0]
when '='
# First header, skip it
when '-'
# Runtime header
runtime = line.scan(/-- (.+?) --/).flatten[0]
else
name_and_identifier = line.scan(/\s+(.+?) \(([\w\d]+-[\w\d]+-[\w\d-]+)\)/)[0]
name = name_and_identifier[0]
identifier = name_and_identifier[1]
timestamp = simulator_creation_date(identifier)
device = SimDevice.new(runtime, name, identifier, timestamp)
devices.push(device)
end
end
# Sort the simulators by their creation timestamp, ascending
devices = devices.sort { |a, b| a.timestamp <=> b.timestamp }
duplicates = {}
# Enumerate all devices except for the last one
for i in 0..devices.count-2
device = devices[i]
# Enumerate all devices *after* this one (created *later*)
for j in i+1..devices.count-1
potential_duplicate = devices[j]
if potential_duplicate.equivalent_to_device(device)
duplicates[potential_duplicate] = device
# Break out of the inner loop if a duplicate is found - if another duplicate exists,
# it will be found when this one is reached in the outer loop
break
end
end
end
if duplicates.count == 0
puts("You don't have duplicate simulators!")
exit()
end
puts("Looks like you have #{duplicates.count} duplicate simulator#{duplicates.count > 1 ? "s" : ""}:")
duplicates.each_pair do |duplicate, original|
puts
puts("#{duplicate}")
puts("--- duplicate of ---")
puts("#{original}")
end
puts
puts("Each duplicate was determined as the one created later than the 'original'.")
puts("Deleting...")
duplicates.each_key do |duplicate|
delete_device(duplicate)
end
puts("Done!")
=begin
MIT License
Copyright (c) 2015-2019 Vlas Voloshin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=end

View File

@@ -1,12 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-apache.sh
## Desc: Install Apache HTTP Server
################################################################################
source ~/utils/utils.sh
brew_smart_install httpd
sudo sed -Ei '' 's/Listen .*/Listen 80/' $(brew --prefix)/etc/httpd/httpd.conf
invoke_tests "WebServers" "Apache"

View File

@@ -6,29 +6,20 @@
source ~/utils/utils.sh
# Monterey needs future review:
# aliyun-cli, gnupg, helm have issues with building from the source code.
# Added gmp for now, because toolcache ruby needs its libs. Remove it when php starts to build from source code.
common_packages=$(get_toolset_value '.brew.common_packages[]')
for package in $common_packages; do
echo "Installing $package..."
if is_Monterey && [[ $package == "xcbeautify" ]]; then
# Pin the version on Monterey as 2.0.x requires Xcode >=15.0 which is not available on OS12
xcbeautify_path=$(download_with_retry "https://raw.githubusercontent.com/Homebrew/homebrew-core/d3653e83f9c029a3fddb828ac804b07ac32f7b3b/Formula/x/xcbeautify.rb")
brew install "$xcbeautify_path"
if [[ $package == "packer" ]]; then
# Packer has been deprecated in Homebrew. Use tap to install Packer.
brew install hashicorp/tap/packer
else
if [[ $package == "packer" ]]; then
# Packer has been deprecated in Homebrew. Use tap to install Packer.
brew install hashicorp/tap/packer
if (is_VenturaX64 || is_SonomaX64) && [[ $package == "tcl-tk@8" ]]; then
brew_smart_install "$package"
# Fix for https://github.com/actions/runner-images/issues/11074
ln -sf $(brew --prefix tcl-tk@8)/lib/libtcl8.6.dylib /usr/local/lib/libtcl8.6.dylib
ln -sf $(brew --prefix tcl-tk@8)/lib/libtk8.6.dylib /usr/local/lib/libtk8.6.dylib
else
if (is_VenturaX64 || is_SonomaX64) && [[ $package == "tcl-tk@8" ]]; then
brew_smart_install "$package"
# Fix for https://github.com/actions/runner-images/issues/11074
ln -sf $(brew --prefix tcl-tk@8)/lib/libtcl8.6.dylib /usr/local/lib/libtcl8.6.dylib
ln -sf $(brew --prefix tcl-tk@8)/lib/libtk8.6.dylib /usr/local/lib/libtk8.6.dylib
else
brew_smart_install "$package"
fi
brew_smart_install "$package"
fi
fi
done
@@ -36,37 +27,26 @@ done
cask_packages=$(get_toolset_value '.brew.cask_packages[]')
for package in $cask_packages; do
echo "Installing $package..."
if is_Monterey && [[ $package == "virtualbox" ]]; then
# Do not update VirtualBox on macOS 12 due to the issue with VMs in gurumediation state which blocks Vagrant on macOS: https://github.com/actions/runner-images/issues/8730
# macOS host: Dropped all kernel extensions. VirtualBox relies fully on the hypervisor and vmnet frameworks provided by Apple now.
virtualbox_cask_path=$(download_with_retry "https://raw.githubusercontent.com/Homebrew/homebrew-cask/aa3c55951fc9d687acce43e5c0338f42c1ddff7b/Casks/virtualbox.rb")
brew install $virtualbox_cask_path
if is_Arm64 && [[ $package == "parallels" ]]; then
echo "Parallels installation is skipped for arm64 architecture"
else
if is_Arm64 && [[ $package == "parallels" ]]; then
echo "Parallels installation is skipped for arm64 architecture"
else
brew install --cask $package
fi
brew install --cask $package
fi
done
# Load "Parallels International GmbH"
if is_Monterey || is_SonomaX64 || is_VenturaX64; then
if is_SonomaX64 || is_VenturaX64; then
sudo kextload /Applications/Parallels\ Desktop.app/Contents/Library/Extensions/10.9/prl_hypervisor.kext || true
fi
# Execute AppleScript to change security preferences for macOS12, macOS13 and macOS14
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
if is_Monterey || is_SonomaX64 || is_VenturaX64; then
if is_SonomaX64 || is_VenturaX64; then
for retry in {4..0}; do
echo "Executing AppleScript to change security preferences. Retries left: $retry"
{
set -e
osascript -e 'tell application "System Events" to get application processes where visible is true'
if is_Monterey; then
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
fi
if is_VenturaX64; then
osascript $HOME/utils/confirm-identified-developers-macos13.scpt $USER_PASSWORD
fi
@@ -87,17 +67,10 @@ if is_Monterey || is_SonomaX64 || is_VenturaX64; then
fi
# Validate "Parallels International GmbH" kext
if is_Monterey || is_SonomaX64 || is_VenturaX64; then
if is_SonomaX64 || is_VenturaX64; then
if is_Monterey; then
echo "Closing System Preferences window if it is still opened"
killall "System Preferences" || true
fi
if is_SonomaX64 || is_VenturaX64; then
echo "Closing System Settings window if it is still opened"
killall "System Settings" || true
fi
echo "Closing System Settings window if it is still opened"
killall "System Settings" || true
echo "Checking parallels kexts"
dbName="/var/db/SystemPolicyConfiguration/KextPolicy"

View File

@@ -1,15 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-compilable-brew-packages.sh
## Desc: Install compilable brew packages
################################################################################
source ~/utils/utils.sh
compilable_packages=$(get_toolset_value '.brew.compilable_packages[]')
for package in $compilable_packages; do
echo "Installing $package..."
brew_smart_install "$package"
done
invoke_tests "Common" "Compiled"

View File

@@ -1,16 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-golang.sh
## Desc: Install Go
################################################################################
source ~/utils/utils.sh
default_go_version=$(get_toolset_value '.go.default')
echo "Installing Go..."
brew_smart_install "go@${default_go_version}"
# Create symlinks to preserve backward compatibility. Symlinks are not created when non-latest go is being installed
ln -sf $(brew --prefix go@${default_go_version})/bin/* /usr/local/bin/
invoke_tests "Common" "Go"

View File

@@ -1,31 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-haskell.sh
## Desc: Install Haskell
################################################################################
source ~/utils/utils.sh
curl --proto '=https' --tlsv1.2 -fsSL https://get-ghcup.haskell.org | bash
export PATH="$HOME/.ghcup/bin:$PATH"
echo 'export PATH="$PATH:$HOME/.ghcup/bin"' >> $HOME/.bashrc
# ghcup output looks like this "ghc 8.6.4 base-4.12.0.0 hls-powered", need to take all the first versions only(8.6.4 in that case) and avoid pre-release ones
availableVersions=$(ghcup list -t ghc -r | grep -v "prerelease" | awk '{print $2}')
# Install 3 latest major versions(For instance 8.6.5, 8.8.4, 8.10.2)
minorMajorVersions=$(echo "$availableVersions" | cut -d"." -f 1,2 | uniq | tail -n3)
for majorMinorVersion in $minorMajorVersions; do
fullVersion=$(echo "$availableVersions" | grep "$majorMinorVersion." | tail -n1)
echo "install ghc version $fullVersion..."
ghcup install $fullVersion
ghcup set $fullVersion
done
echo "install cabal..."
ghcup install-cabal
echo "Updating stack..."
ghcup install stack latest
invoke_tests "Haskell"

View File

@@ -1,24 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-miniconda.sh
## Desc: Install Miniconda
################################################################################
source ~/utils/utils.sh
miniconda_installer_path=$(download_with_retry "https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh")
chmod +x $miniconda_installer_path
sudo $miniconda_installer_path -b -p /usr/local/miniconda
# Chmod with full permissions recursively to avoid permissions restrictions
sudo chmod -R 777 /usr/local/miniconda
sudo ln -s /usr/local/miniconda/bin/conda /usr/local/bin/conda
if [[ -d $HOME/.conda ]]; then
sudo chown -R $USER $HOME/.conda
fi
echo "export CONDA=/usr/local/miniconda" >> $HOME/.bashrc
invoke_tests "Common" "Miniconda"

View File

@@ -1,23 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-mongodb.sh
## Desc: Install MongoDB
################################################################################
source ~/utils/utils.sh
# MongoDB object-value database
# Install latest release version of MongoDB Community Edition
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x
toolsetVersion=$(get_toolset_value '.mongodb.version')
brew tap mongodb/brew
versionToInstall=$(brew search --formulae /mongodb-community@$toolsetVersion/ | awk -F'/' '{print $3}' | tail -1)
echo "Installing mongodb $versionToInstall"
brew_smart_install $versionToInstall
if ! which mongo ; then
brew link $versionToInstall
fi
invoke_tests "Databases" "MongoDB"

View File

@@ -47,5 +47,5 @@ sudo mv $nunit3_console_wrapper "${MONO_VERSIONS_PATH}/${mono_version}/Commands/
echo "Creating short symlink '${mono_version_short}'..."
sudo ln -s ${MONO_VERSIONS_PATH}/${mono_version} ${MONO_VERSIONS_PATH}/${mono_version_short}
# Invoke tests for Xamarin and Mono
invoke_tests "Xamarin" "Mono"
# Invoke tests and Mono
invoke_tests "Mono"

View File

@@ -16,12 +16,4 @@ echo Installing yarn...
yarn_installer_path=$(download_with_retry "https://yarnpkg.com/install.sh")
bash $yarn_installer_path
if is_Monterey; then
npm_global_packages=$(get_toolset_value '.npm.global_packages[].name')
for module in ${npm_global_packages[@]}; do
echo "Install $module"
npm install -g $module
done
fi
invoke_tests "Node" "Node.js"

View File

@@ -1,18 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-pipx-packages.sh
## Desc: Install Pipx Packages
################################################################################
source ~/utils/utils.sh
export PATH="$PATH:/opt/pipx_bin"
pipx_packages=$(get_toolset_value '.pipx[].package')
for package in $pipx_packages; do
echo "Install $package into default python"
pipx install $package
done
invoke_tests "PipxPackages"

View File

@@ -8,30 +8,6 @@ source ~/utils/utils.sh
echo "Installing Python Tooling"
if is_Monterey; then
echo "Install latest Python 2"
python2_pkg=$(download_with_retry "https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg")
python2_pkg_sha256="c570f38b05dd8b112ad21b418cdf51a9816d62f9f44746452739d421be24d50c"
use_checksum_comparison $python2_pkg $python2_pkg_sha256
choice_changes_xml=$(mktemp /tmp/python2_choice_changes.xml.XXXXXX)
sudo installer -showChoiceChangesXML -pkg $python2_pkg -target / | tee $choice_changes_xml > /dev/null
# To avoid symlink conflicts, remove tools installation in /usr/local/bin using installer choices
xmllint --shell $choice_changes_xml <<EOF
cd //array/dict[string[text()='org.python.Python.PythonUnixTools-2.7']]/integer
set 0
save
EOF
sudo installer -applyChoiceChangesXML $choice_changes_xml -pkg $python2_pkg -target /
pip install --upgrade pip
echo "Install Python2 certificates"
bash -c "/Applications/Python\ 2.7/Install\ Certificates.command"
fi
# Close Finder window
close_finder_window

View File

@@ -18,10 +18,6 @@ CARGO_HOME=$HOME/.cargo
echo "Install common tools..."
rustup component add rustfmt clippy
if is_Monterey; then
cargo install bindgen-cli cbindgen cargo-audit cargo-outdated
fi
echo "Cleanup Cargo registry cached data..."
rm -rf $CARGO_HOME/registry/*

View File

@@ -7,15 +7,7 @@
source ~/utils/utils.sh
echo "Installing Swiftlint..."
if is_Monterey; then
# SwiftLint now requires Xcode 15.3 or higher to build https://github.com/realm/SwiftLint/releases/tag/0.55.1
COMMIT=d91dabd087cb0b906c92a825df9e5e5e1a4f59f8
FORMULA_URL="https://raw.githubusercontent.com/Homebrew/homebrew-core/$COMMIT/Formula/s/swiftlint.rb"
curl -fsSL $FORMULA_URL > $(find $(brew --repository) -name swiftlint.rb)
HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_FROM_API=1 brew install swiftlint
else
brew_smart_install "swiftlint"
fi
brew_smart_install "swiftlint"
invoke_tests "Linters" "SwiftLint"

View File

@@ -1,52 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-visualstudio.sh
## Desc: Install Visual Studio
################################################################################
source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh
install_vsmac() {
local vsmac_version=$1
local vsmac_default=$2
if [[ $vsmac_version == "2019" ]]; then
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/stable" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
elif [[ $vsmac_version == "2022" ]]; then
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/stable-2022" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
elif [[ $vsmac_version == "preview" ]]; then
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/preview" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
else
vsmac_download_url=$(buildVSMacDownloadUrl $vsmac_version)
fi
echo "Installing Visual Studio ${vsmac_version} for Mac"
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/visualstudio.XXXX)
mkdir -p "$TMPMOUNT/downloads"
vsmac_installer=$(download_with_retry $vsmac_download_url "$TMPMOUNT/downloads/${vsmac_download_url##*/}")
echo "Mounting Visual Studio..."
hdiutil attach $vsmac_installer -mountpoint $TMPMOUNT
echo "Moving Visual Studio to /Applications/..."
pushd $TMPMOUNT
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
if [[ $vsmac_version != $vsmac_default ]]; then
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio ${vsmac_version}.app"
fi
popd
sudo hdiutil detach $TMPMOUNT
sudo rm -rf $TMPMOUNT
}
vsmac_versions=($(get_toolset_value '.xamarin.vsmac.versions[]'))
default_vsmac_version=$(get_toolset_value '.xamarin.vsmac.default')
for version in ${vsmac_versions[@]}; do
install_vsmac $version $default_vsmac_version
done
invoke_tests "Common" "VSMac"

View File

@@ -1,92 +0,0 @@
#!/bin/bash -e -o pipefail
################################################################################
## File: install-xamarin.sh
## Desc: Install Xamarin
################################################################################
source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh
mono_versions=($(get_toolset_value '.xamarin."mono_versions" | reverse | .[]'))
xamarin_ios_versions=($(get_toolset_value '.xamarin."ios_versions" | reverse | .[]'))
xamarin_mac_versions=($(get_toolset_value '.xamarin."mac_versions" | reverse | .[]'))
xamarin_android_versions=($(get_toolset_value '.xamarin."android_versions" | reverse | .[]'))
latest_sdk_symlink=$(get_toolset_value '.xamarin.bundles[0].symlink')
current_sdk_symlink=$(get_toolset_value '.xamarin."bundle_default"')
default_xcode_version=$(get_toolset_value '.xcode.default')
if [[ $current_sdk_symlink == "latest" ]]; then
current_sdk_symlink=$latest_sdk_symlink
fi
MONO_VERSIONS_PATH="/Library/Frameworks/Mono.framework/Versions"
IOS_VERSIONS_PATH="/Library/Frameworks/Xamarin.iOS.framework/Versions"
ANDROID_VERSIONS_PATH="/Library/Frameworks/Xamarin.Android.framework/Versions"
MAC_VERSIONS_PATH="/Library/Frameworks/Xamarin.Mac.framework/Versions"
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/visualstudio.XXXX)
TMPMOUNT_FRAMEWORKS=$TMPMOUNT/frameworks
createBackupFolders
pushd $TMPMOUNT
# Download NUnit console
downloadNUnitConsole
# Install Mono sdks
for version in ${mono_versions[@]}; do installMono $version; done
sudo mv -v $TMPMOUNT_FRAMEWORKS/mono/* $MONO_VERSIONS_PATH/
# Install Xamarin.iOS sdks
for version in ${xamarin_ios_versions[@]}; do installXamarinIOS $version; done
sudo mv -v $TMPMOUNT_FRAMEWORKS/ios/* $IOS_VERSIONS_PATH/
# Install Xamarin.Mac sdks
for version in ${xamarin_mac_versions[@]}; do installXamarinMac $version; done
sudo mv -v $TMPMOUNT_FRAMEWORKS/mac/* $MAC_VERSIONS_PATH/
# Install Xamarin.Android sdks
for version in ${xamarin_android_versions[@]}; do installXamarinAndroid $version; done
sudo mv -v $TMPMOUNT_FRAMEWORKS/android/* $ANDROID_VERSIONS_PATH/
# Create bundles
bundles_count=$(get_toolset_value '.xamarin.bundles | length')
for ((bundle_index=0; bundle_index<bundles_count; bundle_index++)); do
symlink=$(get_toolset_value ".xamarin.bundles[$bundle_index].symlink")
mono=$(get_toolset_value ".xamarin.bundles[$bundle_index].mono")
ios=$(get_toolset_value ".xamarin.bundles[$bundle_index].ios")
mac=$(get_toolset_value ".xamarin.bundles[$bundle_index].mac")
android=$(get_toolset_value ".xamarin.bundles[$bundle_index].android")
createBundle $symlink $mono $ios $mac $android
done
# Symlinks for the latest Xamarin bundle
createBundleLink $latest_sdk_symlink "Latest"
createBundleLink $current_sdk_symlink "Current"
#
# Fix nuget in some mono versions because of known bugs
#
# Creating UWP Shim to hack UWP build failure
createUWPShim
popd
echo "Clean up packages..."
sudo rm -rf $TMPMOUNT
# Fix Xamarin issue with Xcode symlink: https://github.com/xamarin/xamarin-macios/issues/9960
PREFERENCES_XAMARIN_DIR="${HOME}/Library/Preferences/Xamarin"
mkdir -p $PREFERENCES_XAMARIN_DIR
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${default_xcode_version}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist
# Temporary workaround to recreate nuget.config file with a correct feed https://github.com/actions/runner-images/issues/5768
rm -rf $HOME/.config/NuGet/NuGet.Config
nuget config
# Temporary workaround to point Mono to the proper NUnit console
sudo sed -Ei '' 's/3.6.0/3.6.1/' /Library/Frameworks/Mono.framework/Versions/Current/Commands/nunit3-console
invoke_tests "Xamarin"