Move MacOS image-generation code to virtual-environments repository #1573

Move MacOS image-generation code to virtual-environments repository
This commit is contained in:
Maxim Lobanov
2020-09-15 08:39:01 +03:00
committed by GitHub
100 changed files with 6906 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
function Get-CommandResult {
param (
[Parameter(Mandatory=$true)]
[string] $Command,
[switch] $Multiline
)
# Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version")
$stdout = & bash -c "$Command 2>&1"
$exitCode = $LASTEXITCODE
return @{
Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout }
ExitCode = $exitCode
}
}
# Gets path to the tool, analogue of 'which tool'
function Get-WhichTool($tool) {
return (Get-Command $tool).Path
}
# Gets value of environment variable by the name
function Get-EnvironmentVariable($variable) {
return [System.Environment]::GetEnvironmentVariable($variable)
}
# Returns the object with information about current OS
# It can be used for OS-specific tests
function Get-OSVersion {
$osVersion = [Environment]::OSVersion
return [PSCustomObject]@{
Version = $osVersion.Version
Platform = $osVersion.Platform
IsHighSierra = $osVersion.Version.Major -eq 17
IsMojave = $osVersion.Version.Major -eq 18
IsCatalina = $osVersion.Version.Major -eq 19
IsBigSur = $osVersion.Version.Major -eq 20
IsLessThanCatalina = $osVersion.Version.Major -lt 19
IsLessThanBigSur = $osVersion.Version.Major -lt 20
IsHigherThanMojave = $osVersion.Version.Major -gt 18
}
}
function Get-ChildItemWithoutSymlinks {
param (
[Parameter(Mandatory)]
[string] $Path,
[string] $Filter
)
$files = Get-ChildItem -Path $Path -Filter $Filter
$files = $files | Where-Object { !$_.LinkType } # cut symlinks
return $files
}
# Get the value of specific toolset node
# Example, invoke `Get-ToolsetValue "xamarin.bundles"` to get value of `$toolsetJson.xamarin.bundles`
function Get-ToolsetValue {
param (
[Parameter(Mandatory = $true)]
[string] $KeyPath
)
$toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json"
$jsonNode = Get-Content -Raw $toolsetPath | ConvertFrom-Json
$pathParts = $KeyPath.Split(".")
# try to walk through all arguments consequentially to resolve specific json node
$pathParts | ForEach-Object {
$jsonNode = $jsonNode.$_
}
return $jsonNode
}
function Get-ToolcachePackages {
$toolcachePath = Join-Path $env:HOME "image-generation" "toolcache.json"
return Get-Content -Raw $toolcachePath | ConvertFrom-Json
}

View File

@@ -0,0 +1,32 @@
function Run-Command {
param (
[Parameter(Mandatory=$true)]
[string] $Command,
[switch] $SuppressStderr
)
# Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version")
$redirectOutputArguments = If ($SuppressStderr) { "2> /dev/null" } Else { "2>&1" }
$stdout = & bash -c "${Command} ${redirectOutputArguments}"
return $stdout
}
function Take-Part {
param (
[Parameter(ValueFromPipeline)]
[string] $toolOutput,
[string] $Delimiter = " ",
[int[]] $Part
)
$parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
$selectedParts = $parts[$Part]
return [string]::Join($Delimiter, $selectedParts)
}
function New-MDNewLine {
param (
[int] $Count = 1
)
$newLineSymbol = [System.Environment]::NewLine
return $newLineSymbol * $Count
}

View File

@@ -0,0 +1,87 @@
# Invokes command and validate that the exit code is 0
function Validate-ZeroExitCode($command) {
$result = Get-CommandResult $command
$result.ExitCode | Should -Be 0 -Because $result.Output
}
# Validates that tool is installed and in PATH
function Validate-ToolExist($tool) {
Get-Command $tool -ErrorAction SilentlyContinue | Should -BeTrue
}
function Validate-ArrayWithoutDuplicates {
param (
[AllowEmptyCollection()]
[Parameter(Mandatory = $true)]
[array] $Items,
[string] $Because
)
$uniqueList = @()
$Items | ForEach-Object {
$uniqueList | Should -Not -Contain $_ -Because $Because
$uniqueList += $_
}
}
function Validate-Url {
param (
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $Url
)
$result = $true
try {
$requestResult = Invoke-WebRequest $Url -DisableKeepAlive -UseBasicParsing -Method Head
$result = ($requestResult.StatusCode -eq 200)
} catch {
$result = $false
}
$result | Should -BeTrue -Because "'$Url' should be available, but it is not"
}
function Validate-IdenticalFileContent {
param (
[Parameter(Mandatory)]
[string] $File1,
[Parameter(Mandatory)]
[string] $File2
)
$File1 | Should -Exist -Because "The content of '$File1' should be identical with content of '$File2' but '$File1' doesn't exist"
$File2 | Should -Exist -Because "The content of '$File1' should be identical with content of '$File2' but '$File2' doesn't exist"
$content1 = Get-Content -Raw $File1
$content2 = Get-Content -Raw $File2
$content1 | Should -Be $content2 -Because "The content of '$File1' should be identical with content of '$File2' but they are different"
}
function ShouldReturnZeroExitCode {
Param(
[String] $ActualValue,
[switch] $Negate,
[string] $Because # This parameter is unused by we need it to match Pester asserts signature
)
$result = Get-CommandResult $ActualValue
[bool]$succeeded = $result.ExitCode -eq 0
if ($Negate) { $succeeded = -not $succeeded }
if (-not $succeeded)
{
$commandOutputIndent = " " * 4
$commandOutput = ($result.Output | ForEach-Object { "${commandOutputIndent}${_}" }) -join "`n"
$failureMessage = "Command '${ActualValue}' has finished with exit code ${actualExitCode}`n${commandOutput}"
}
return [PSCustomObject] @{
Succeeded = $succeeded
FailureMessage = $failureMessage
}
}
If (Get-Command -Name Add-AssertionOperator -ErrorAction SilentlyContinue) {
Add-AssertionOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode}
}

View File

@@ -0,0 +1,94 @@
function Get-XcodeRootPath {
Param (
[Parameter(Mandatory)]
[string] $Version
)
return "/Applications/Xcode_$Version.app"
}
function Get-DefaultXcodeRootPath {
$defaultXcodePath = "/Applications/Xcode.app"
$defaultXcodeItem = Get-Item -Path $defaultXcodePath
return $defaultXcodeItem.Target
}
function Get-XcodeToolPath {
param (
[Parameter(ParameterSetName = 'Version')]
[string] $Version,
[Parameter(ParameterSetName = 'Path')]
[string] $XcodeRootPath,
[string] $ToolName
)
if ($PSCmdlet.ParameterSetName -eq "Version") {
$XcodeRootPath = Get-XcodeRootPath $Version
}
return Join-Path $XcodeRootPath "Contents/Developer/usr/bin" $ToolName
}
function Switch-Xcode {
param (
[Parameter(ParameterSetName = 'Version')]
[string] $Version,
[Parameter(ParameterSetName = 'Path')]
[string] $XcodeRootPath
)
if ($PSCmdlet.ParameterSetName -eq "Version") {
$XcodeRootPath = Get-XcodeRootPath $Version
}
Write-Verbose "Switching Xcode to '${XcodeRootPath}'"
Invoke-Expression "sudo xcode-select --switch ${XcodeRootPath}"
}
function Get-XcodeSimulatorsInfo {
param(
[string] $Filter
)
[string]$rawSimulatorsInfo = Invoke-Expression "xcrun simctl list --json"
$jsonSimulatorsInfo = $rawSimulatorsInfo | ConvertFrom-Json
if ($Filter) {
return $jsonSimulatorsInfo | Select-Object -ExpandProperty $Filter
}
return $jsonSimulatorsInfo
}
function Get-XcodeDevicesList {
$result = @()
$runtimes = Get-XcodeSimulatorsInfo -Filter "devices"
$runtimes.PSObject.Properties | ForEach-Object {
$runtimeName = $_.Name
$devices = $_.Value
$devices | Where-Object {
$availability = $_.availability
$isAvailable = $_.isAvailable
return (($availability -eq "(available)") -or ($isAvailable -eq "YES") -or ($isAvailable -eq $true))
} | ForEach-Object {
$deviceName = $_.name
$result += "$runtimeName $deviceName"
}
}
return $result
}
function Get-XcodePairsList {
$result = @()
$runtimes = Get-XcodeSimulatorsInfo -Filter "pairs"
$runtimes.PSObject.Properties | Where-Object {
return $_.Value.state -match "active"
} | ForEach-Object {
$watchName = $_.Value.watch.name
$phoneName = $_.Value.phone.name
$result += "$watchName $phoneName"
}
return $result
}

View File

@@ -0,0 +1,18 @@
#!/bin/bash
USERNAME="$1"
OLD_PASSWD="$2"
NEW_PASSWD="$3"
export PATH=/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin
macosver="$(sw_vers | grep ProductVersion | awk {'print $2'})"
if [[ $macosver =~ 10.13.* ]]; then
sudo /usr/bin/dscl . -passwd /Users/$USERNAME "$NEW_PASSWD"
else
sudo /usr/sbin/sysadminctl -resetPasswordFor $USERNAME -newPassword "$NEW_PASSWD" -adminUser $USERNAME -adminPassword "$OLD_PASSWD"
fi
sudo /usr/bin/python /Users/$USERNAME/bootstrap/kcpassword.py "$NEW_PASSWD"
sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
/usr/bin/security set-keychain-password -o "$OLD_PASSWD" -p "$NEW_PASSWD" /Users/$USERNAME/Library/Keychains/login.keychain

View File

@@ -0,0 +1,40 @@
#!/bin/bash
BOOTSTRAP_PATH="$1"
ProvisionerPackageUri="$2"
ProvisionerScriptUri="$3"
ScriptName="$4"
ScriptParam="$5"
Username="$6"
export PATH=/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin
PROVISIONER_ROOT=/usr/local/opt/${Username}
mkdir -p ${PROVISIONER_ROOT}
chown ${Username} ${PROVISIONER_ROOT}
tee -a ${PROVISIONER_ROOT}/runprovisioner.sh > /dev/null <<\EOF
#!/bin/bash
. ${HOME}/.bashrc
/usr/local/opt/$USER/provisioner/provisioner
EOF
chmod +x $PROVISIONER_ROOT/runprovisioner.sh
aria2c \
--enable-color=false \
--file-allocation=none \
-d ${BOOTSTRAP_PATH} "${ProvisionerPackageUri}" >> ${BOOTSTRAP_PATH}/download.log
aria2c \
--enable-color=false \
--file-allocation=none \
-d ${BOOTSTRAP_PATH} "${ProvisionerScriptUri}" >> ${BOOTSTRAP_PATH}/download.log
chmod +x ${BOOTSTRAP_PATH}/${ScriptName}
# Install Provisioner with provided scripts
eval "$BOOTSTRAP_PATH/$ScriptName $BOOTSTRAP_PATH/$ScriptParam $Username" 2>&1 | tee "$BOOTSTRAP_PATH/install.log"
# State File
touch $BOOTSTRAP_PATH/provisionerDone

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python
# Port of Gavin Brock's Perl kcpassword generator to Python, by Tom Taylor
# <tom@tomtaylor.co.uk>.
# Perl version: http://www.brock-family.org/gavin/perl/kcpassword.html
# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/support/set_kcpassword.py
# Distributed by MIT license, license can be found at the bottom of this script
import sys
import os
def kcpassword(passwd):
# The magic 11 bytes - these are just repeated
# 0x7D 0x89 0x52 0x23 0xD2 0xBC 0xDD 0xEA 0xA3 0xB9 0x1F
key = [125,137,82,35,210,188,221,234,163,185,31]
key_len = len(key)
passwd = [ord(x) for x in list(passwd)]
# pad passwd length out to an even multiple of key length
r = len(passwd) % key_len
if (r > 0):
passwd = passwd + [0] * (key_len - r)
for n in range(0, len(passwd), len(key)):
ki = 0
for j in range(n, min(n+len(key), len(passwd))):
passwd[j] = passwd[j] ^ key[ki]
ki += 1
passwd = [chr(x) for x in passwd]
return "".join(passwd)
if __name__ == "__main__":
passwd = kcpassword(sys.argv[1])
fd = os.open('/etc/kcpassword', os.O_WRONLY | os.O_CREAT, 0o600)
file = os.fdopen(fd, 'w')
file.write(passwd)
file.close()
"""
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

@@ -0,0 +1,40 @@
#!/bin/sh
# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/add-network-interface-detection.sh
# Distributed by MIT license, license can be found at the bottom of this script
# This script adds a Mac OS Launch Daemon, which runs every time the
# machine is booted. The daemon will re-detect the attached network
# interfaces. If this is not done, network devices may not work.
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

@@ -0,0 +1,16 @@
# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/autologin.sh
# Distributed by MIT license, license can be found at the bottom of this script
echo "Enabling automatic GUI login for the '$USERNAME' user.."
python $HOME/bootstrap/kcpassword.py "$PASSWORD"
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
: '
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

@@ -0,0 +1,28 @@
#!/bin/bash
# Add script for changing hostname to run on startup to prevent duplicate hostnames across the environment. Hostname and Computername should contain .local in name to avoid name resolution issues
tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF
#!/bin/bash
name="Mac-$(python -c 'from time import time; print int(round(time() * 1000))')"
scutil --set HostName "${name}.local"
scutil --set LocalHostName $name
scutil --set ComputerName "${name}.local"
EOF
chmod +x "/usr/local/bin/change_hostname.sh"
sudo tee -a /Library/LaunchDaemons/change_hostname.plist > /dev/null <<\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>change-hostname</string>
<key>Program</key>
<string>/usr/local/bin/change_hostname.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Enable firewall. SSH and VNC opened. Can't did it at bootstrap step, so placed it here
defaults write /Library/Preferences/com.apple.alf globalstate -int 1
# Setting correct time zone
echo "Configuring system time to GMT..."
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari
# Safaris executable is located at /usr/bin/safaridriver
# Configure Safari to Enable WebDriver Support
sudo safaridriver --enable
# Turn off hibernation and get rid of the sleepimage
sudo pmset hibernatemode 0
sudo rm -f /var/vm/sleepimage
# Change screen resolution to the maximum supported for 4Mb video memory
sudo "/Library/Application Support/VMware Tools/vmware-resolutionSet" 1176 885

View File

@@ -0,0 +1,7 @@
#!/bin/sh
[[ ! -d ~/.ssh ]] && mkdir ~/.ssh 2>/dev/null
chmod 777 ~/.ssh
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
ssh-keyscan -t rsa ssh.dev.azure.com >> ~/.ssh/known_hosts

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# Disabling automatic updates
sudo softwareupdate --schedule off
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 0
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 0
defaults write com.apple.commerce AutoUpdate -bool false
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool false

View File

@@ -0,0 +1 @@
[ -f $HOME/.bashrc ] && source $HOME/.bashrc

View File

@@ -0,0 +1,32 @@
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export ANDROID_HOME=${HOME}/Library/Android/sdk
export ANDROID_NDK_HOME=${ANDROID_HOME}/ndk-bundle
export NUNIT_BASE_PATH=/Library/Developer/nunit
export NUNIT3_PATH=/Library/Developer/nunit/3.6.0
export CONDA=/usr/local/miniconda
export AGENT_TOOLSDIRECTORY=$HOME/hostedtoolcache
export RUNNER_TOOL_CACHE=$HOME/hostedtoolcache
export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME:$PATH
export PATH=/usr/local/go/bin:$PATH
export PATH=/usr/local/bin:/usr/local/sbin:~/bin:~/.yarn/bin:$PATH
export PATH="/usr/local/opt/curl/bin:$PATH"
export PATH="/usr/local/opt/ruby/bin:$PATH"
GEM_PATH=`gem env|awk '/EXECUTABLE DIRECTORY/ {print $4}'`
export PATH="$GEM_PATH:$PATH"
export PATH=$HOME/.cargo/bin:$PATH
export RCT_NO_LAUNCH_PACKAGER=1
export DOTNET_ROOT=$HOME/.dotnet
export DOTNET_MULTILEVEL_LOOKUP=0
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_CASK_OPTS="--no-quarantine"
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Close all finder windows because they can interfere with UI tests
osascript -e 'tell application "Finder" to close windows'
# Ignore available updates to prevent system pop-ups
updateName=$(softwareupdate -l | grep "Title: " | awk -F[:,] '{print $2}' | awk '{$1=$1};1')
if [ ! -z "$updateName" ]; then
sudo softwareupdate --ignore "$updateName"
fi
# Put documentation to $HOME root
cp $HOME/image-generation/output/software-report/systeminfo.txt $HOME/image-generation/output/software-report/systeminfo.md $HOME/
# Clean up npm cache which collected during image-generation
# we have to do that here because `npm install` is run in a few different places during image-generation
npm cache clean --force
# Clean up temporary directories
rm -rf ~/utils ~/image-generation

View File

@@ -0,0 +1,39 @@
#!/bin/bash
set -e
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>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>52428</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOF
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

@@ -0,0 +1,15 @@
#!/bin/bash
echo Additional NTP servers adding into /etc/ntp.conf file...
cat > /etc/ntp.conf << EOF
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
server time.apple.com
server time.windows.com
EOF
# Set the timezone to UTC.
echo The Timezone setting to UTC...
ln -sf /usr/share/zoneinfo/UTC /etc/localtime

View File

@@ -0,0 +1,29 @@
#!/bin/bash
source ~/utils/utils.sh
imagedata_file="$HOME/imagedata.json"
image_version=$(echo $IMAGE_VERSION | cut -d _ -f 2)
os_name=$(sw_vers -productName)
os_version=$(sw_vers -productVersion)
os_build=$(sw_vers -buildVersion)
label_version=$(echo $os_version | cut -d. -f1,2)
image_label="macos-${label_version}"
software_url="https://github.com/actions/virtual-environments/blob/${image_label}/${image_version}/images/macos/${image_label}-Readme.md"
if is_Catalina || is_BigSur; then
cat <<EOF > $imagedata_file
[
{
"group": "Operating System",
"detail": "${os_name}\n${os_version}\n${os_build}"
},
{
"group": "Virtual Environment",
"detail": "Environment: ${image_label}\nVersion: ${image_version}\nIncluded Software: ${software_url}"
}
]
EOF
fi
echo "export ImageVersion=$image_version" >> $HOME/.bashrc
echo "export ImageOS=$IMAGE_OS" >> $HOME/.bashrc

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# 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

@@ -0,0 +1,3 @@
echo "Changing shell to bash"
sudo chsh -s /bin/bash $USERNAME
sudo chsh -s /bin/bash root

View File

@@ -0,0 +1,92 @@
#!/bin/bash -e
source ~/utils/utils.sh
ANDROID_PLATFORM_LIST=($(get_toolset_value '.android."platform-list"[]'))
ANDROID_BUILD_TOOLS=($(get_toolset_value '.android."build-tools"[]'))
ANDROID_EXTRA_LIST=($(get_toolset_value '.android."extra-list"[]'))
ANDROID_ADDON_LIST=($(get_toolset_value '.android."addon-list"[]'))
# Get the latest command line tools from https://developer.android.com/studio/index.html
# Release note: https://developer.android.com/studio/releases/sdk-tools.html
ANDROID_OSX_SDK_LOCATION="https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip"
ANDROID_HOME=$HOME/Library/Android/sdk
ANDROID_OSX_SDK_FILE=tools-macosx.zip
pushd $HOME
# Prevent the warning of sdkmanager
mkdir $HOME/.android
echo "count=0" >> $HOME/.android/repositories.cfg
echo "Downloading android sdk..."
curl -L -o $ANDROID_OSX_SDK_FILE $ANDROID_OSX_SDK_LOCATION
echo "Uncompressing android sdk..."
unzip -q $ANDROID_OSX_SDK_FILE && rm -f $ANDROID_OSX_SDK_FILE
rm -rf $HOME/Library/Android/sdk
mkdir -p $HOME/Library/Android/sdk
echo ANDROID_HOME is $ANDROID_HOME
mv tools $ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
# Mark the different Android licenses as accepted
mkdir -p $ANDROID_HOME/licenses
echo "8933bad161af4178b1185d1a37fbf41ea5269c55
d56f5187479451eabf01fb78af6dfcb131a6481e" >> $ANDROID_HOME/licenses/android-sdk-license
echo "84831b9409646a918e30573bab4c9c91346d8abd" >> $ANDROID_HOME/licenses/android-sdk-preview-license
echo "Installing latest tools & platform tools..."
echo y | $SDKMANAGER "tools" "platform-tools"
echo "Installing latest CMake..."
echo y | $SDKMANAGER "cmake;3.6.4111459"
echo "Installing latest ndk..."
echo y | $SDKMANAGER "ndk-bundle"
for platform_name in "${ANDROID_PLATFORM_LIST[@]}"
do
echo "Installing platform $platform_name ..."
echo y | $SDKMANAGER "platforms;$platform_name"
done
for build_tools_version in "${ANDROID_BUILD_TOOLS[@]}"
do
echo "Installing build tools $build_tools_version ..."
echo y | $SDKMANAGER "build-tools;$build_tools_version"
done
for extra_name in "${ANDROID_EXTRA_LIST[@]}"
do
echo "Installing extra $extra_name ..."
echo y | $SDKMANAGER "extras;$extra_name"
done
# Intel x86 Emulator Accelerator (HAXM installer)
# see Issue 31164 notes
# Command needs to be run under sudo.
chmod +x $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
sudo $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
for addon_name in "${ANDROID_ADDON_LIST[@]}"
do
echo "Installing add-on $addon_name ..."
echo y | $SDKMANAGER "add-ons;$addon_name"
done
popd
echo "Installing ProGuard-5..."
PROGUARD_LOCATION="https://github.com/Guardsquare/proguard/archive/proguard5.3.3.tar.gz"
pushd $ANDROID_HOME
cd tools
mv proguard proguard4
mkdir proguard && cd proguard
curl -L -o proguard5.tgz $PROGUARD_LOCATION
tar xzf proguard5.tgz --strip 1 && rm -f proguard5.tgz
cp ../proguard4/proguard-*.txt . # Copy the Proguard Android definitions from the previous version
popd

View File

@@ -0,0 +1,19 @@
#!/bin/bash
echo "install soundflower"
brew cask install soundflower
echo "install switchaudio-osx"
brew install switchaudio-osx
echo "install sox"
brew install sox
echo "set Soundflower (2ch) as input/output device"
SwitchAudioSource -s "Soundflower (2ch)" -t input
SwitchAudioSource -s "Soundflower (2ch)" -t output
echo "grant microphone permission for simulators"
sudo sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "insert into access values('kTCCServiceMicrophone','com.apple.CoreSimulator.SimulatorTrampoline', 0,1,1,NULL,NULL,NULL,'UNUSED',NULL,NULL,1576347152)"
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "insert into access values('kTCCServiceMicrophone','/usr/local/opt/runner/runprovisioner.sh', 1,1,1,NULL,NULL,NULL,'UNUSED',NULL,NULL,1576661342)"
sudo sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "insert into access values('kTCCServiceMicrophone','/usr/local/opt/runner/runprovisioner.sh', 1,1,1,NULL,NULL,NULL,'UNUSED',NULL,NULL,1576661342)"

View File

@@ -0,0 +1,11 @@
#!/bin/bash
echo Installing aws...
brew install awscli
echo Installing aws sam cli...
brew tap aws/tap
brew install aws-sam-cli
echo "Install aws cli session manager"
brew cask install session-manager-plugin

View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac"
wget -O "$HOME/azcopy.zip" "$AZCOPY_DOWNLOAD_URL"
unzip azcopy.zip -d azcopy
AZCOPY_EXTRACTED=$(echo azcopy/azcopy*)
cp "$AZCOPY_EXTRACTED/azcopy" "/usr/local/bin/azcopy"
chmod +x "/usr/local/bin/azcopy"
echo "Done, cleaning up"
rm -rf azcopy*

View File

@@ -0,0 +1,20 @@
set -e
source ~/utils/utils.sh
# Link the existing Xcodes into the correct location for provisionator.
# These symlinks are necessary for Xamarin team to make sure that xamarin-provisionator can find them.
# Old style provisionator directories. This is maintained for
# backwards compatibility only. Do not add new xcodes here.
ln -sf /Applications/Xcode_8.app /Applications/Xcode8.app
ln -sf /Applications/Xcode_8.1.app /Applications/Xcode81.app
ln -sf /Applications/Xcode_9.app /Applications/Xcode9.app
ln -sf /Applications/Xcode_9.1.app /Applications/Xcode91.app
ln -sf /Applications/Xcode_9.2.app /Applications/Xcode92.app
ln -sf /Applications/Xcode_9.3.app /Applications/Xcode93.app
ln -sf /Applications/Xcode_9.3.app /Applications/Xcode_9.3_beta.app
ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4-beta.app
ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4_beta.app
ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4_beta_2.app

View File

@@ -0,0 +1,11 @@
echo "Installing Chrome..."
brew cask install google-chrome
echo "Installing Chrome Driver"
brew cask install chromedriver
echo "Installing Selenium"
brew install selenium-server-standalone
CHROMEWEBDRIVER_DIR=$(readlink $(which chromedriver) | xargs dirname)
echo "export CHROMEWEBDRIVER=$CHROMEWEBDRIVER_DIR" >> "${HOME}/.bashrc"

View File

@@ -0,0 +1,9 @@
#!/bin/sh
echo "Installing Cocoapods..."
# Setup the Cocoapods master repo
echo Setting up the Cocoapods master repository...
pod setup
# Create a symlink to /usr/local/bin since it was removed due to Homebrew change.
ln -sf $(which pod) /usr/local/bin/pod

View File

@@ -0,0 +1,53 @@
#!/bin/sh
set -e
source ~/utils/utils.sh
# brew install
binst_common_utils=(
carthage
xctool
cmake
bats
parallel
subversion
go
gnupg
llvm
libpq
zstd
packer
helm
aliyun-cli
bazelisk
github/gh/gh
p7zip
ant
yamllint
aria2
)
for package in ${binst_common_utils[@]}; do
echo "Install $package"
brew install $package
done
# brew cask install
bcask_common_utils=(
julia
virtualbox
vagrant
r
)
for package in ${bcask_common_utils[@]}; do
echo "Install $package"
brew cask install $package
done
if ! is_HighSierra; then
brew install swiftlint
fi
# Invoke bazel to download the latest bazel version via bazelisk
bazel

View File

@@ -0,0 +1,155 @@
#!/usr/bin/env ruby
# What is this for?
# This script fixes an issue appeared for some Xcode users where it would show long identifiers
# in the list of simulators instead of usual short names. This is caused by duplicate simulators
# being sometimes created after switching between Xcode versions, with the same
# device type + runtime pair occurring more than once in your list of available simulators.
# Instead of showing the same simulator name twice, Xcode defaults to simulator identifiers.
#
# What it does?
# The script queries Xcode's `simctl` utility for all simulators you have, finds duplicate type + runtime pairs,
# and offers you to delete them. After that, Xcode should return to displaying the list of simulators normally.
# When searching for duplicates, the script sorts simulators by their creation time to make sure it deletes
# the copy that was created more recently.
#
# License
# This script was taken from https://gist.github.com/vlas-voloshin/f9982128200345cd3fb7 and some modifications made
# Distributed by MIT license, license can be found at the bottom of this script
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

@@ -0,0 +1,68 @@
#!/bin/sh
###########################################################################
# The main idea of this script is to automate dotnet installs
# Based on:
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
#
###########################################################################
source ~/utils/utils.sh
export DOTNET_CLI_TELEMETRY_OPTOUT=1
# Download installer from dot.net and keep it locally
DOTNET_INSTALL_SCRIPT="https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh"
curl -o "dotnet-install.sh" "$DOTNET_INSTALL_SCRIPT"
chmod +x ./dotnet-install.sh
ARGS_LIST=()
echo "Parsing dotnet SDK (except rc and preview versions) from .json..."
if is_Less_Catalina; then
DOTNET_CHANNELS=(
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json'
)
else
DOTNET_CHANNELS=(
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json'
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.0/releases.json'
'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json'
)
fi
for DOTNET_CHANNEL in "${DOTNET_CHANNELS[@]}"; do
# Old Mono versions don't support NuGet versions from .Net sdk >=2.1.6**, exclude them explicitly from Mojave and HS images
# https://rider-support.jetbrains.com/hc/en-us/articles/360004180039
if is_Less_Catalina; then
ARGS_LIST+=(
$(curl -s "$DOTNET_CHANNEL" | \
jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*' | grep -v -E '2.1.[6-9]\d*')
)
else
ARGS_LIST+=(
$(curl -s "$DOTNET_CHANNEL" | \
jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*')
)
fi
done
for ARGS in "${ARGS_LIST[@]}"; do
./dotnet-install.sh --version $ARGS -NoPath
done
rm ./dotnet-install.sh
# dotnet installer doesn't create symlink to executable in /user/local/bin
# Moreover at that moment /user/local/bin doesn't exist (though already added to $PATH)
ln -s ~/.dotnet/dotnet /usr/local/bin/dotnet
# Validate installation
if [ $(dotnet --list-sdks | wc -l) -lt "1" ]; then
echo "The .NET Core SDK is not installed"
exit 1
fi
echo 'export PATH="$PATH:$HOME/.dotnet/tools"' >> "$HOME/.bashrc"
echo "Dotnet operations have been completed successfully..."

View File

@@ -0,0 +1,58 @@
source ~/utils/utils.sh
echo "Installing Microsoft Edge..."
brew cask install microsoft-edge
EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
EDGE_VERSION=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)
EDGE_VERSION_MAJOR=$(echo $EDGE_VERSION | cut -d'.' -f 1)
echo "Version of Microsoft Edge: ${EDGE_VERSION}"
echo "Installing Microsoft Edge WebDriver..."
EDGE_DRIVER_VERSION_URL="https://msedgedriver.azureedge.net/LATEST_RELEASE_${EDGE_VERSION_MAJOR}"
EDGE_DRIVER_LATEST_VERSION=$(curl -s "$EDGE_DRIVER_VERSION_URL" | iconv -f utf-16 -t utf-8 | tr -d '\r')
EDGE_DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_DRIVER_LATEST_VERSION}/edgedriver_mac64.zip"
echo "Compatible version of WebDriver: ${EDGE_DRIVER_LATEST_VERSION}"
pushd "/tmp" > /dev/null
download_with_retries $EDGE_DRIVER_URL "." "edgedriver.zip"
# Move webdriver to the separate directory to be consistent with the docs
# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
APPLICATION="/usr/local/bin/msedgedriver"
EDGEDRIVER_DIR="/usr/local/share/edge_driver"
EDGEDRIVER_BIN="$EDGEDRIVER_DIR/msedgedriver"
mkdir -p $EDGEDRIVER_DIR
unzip "edgedriver.zip" -d $EDGEDRIVER_DIR
ln -s "$EDGEDRIVER_BIN" $APPLICATION
echo "export EDGEWEBDRIVER=${EDGEDRIVER_DIR}" >> "${HOME}/.bashrc"
popd > /dev/null
#Delete Microsoft autoupdate service to prevent autoupdates popup
AUTOUPDATE_START="$HOME/Library/Preferences/com.microsoft.autoupdate2.plist"
while [ ! -f "$AUTOUPDATE_START" ]
do
echo "Wait for MS update automatic installation"
sleep 30
done
echo "kill autoupdate process"
ps -ef | grep [M]icrosoft | awk '{print $2}' | sudo xargs kill -9
echo "remove autupdate service"
sudo launchctl remove com.microsoft.autoupdate.helper
echo "delete autoupdate files"
sudo rm -rf "$HOME/Library/Application Support/Microsoft AU Daemon/"
sudo rm -rf "$HOME/Library/Application Support/Microsoft AutoUpdate/"
sudo rm -rf "$HOME/Library/Preferences/com.microsoft.autoupdate2.plist"
sudo rm -rf "$HOME/Library/Preferences/com.microsoft.autoupdate.fba.plist"
sudo rm -rf "$HOME/Library/Caches/com.microsoft.autoupdate2"
sudo rm -rf "/Library/Application Support/Microsoft/MAU2.0/"
sudo rm -rf "/Library/LaunchAgents/com.microsoft.update.agent.plist"
sudo rm -rf "/Library/PrivelegedHelperTools/com.microsoft.autoupdate.helper"

View File

@@ -0,0 +1,8 @@
echo "Installing Firefox..."
brew cask install firefox
echo "Installing Geckodriver..."
brew install geckodriver
echo "Add GECKOWEBDRIVER to bashrc..."
echo "export GECKOWEBDRIVER=$(brew --prefix geckodriver)/bin" >> "${HOME}/.bashrc"

View File

@@ -0,0 +1,7 @@
#!/bin/bash
echo "Installing GCC@8 using homebrew..."
brew install gcc@8
echo "Installing GCC@9 using homebrew..."
brew install gcc@9

View File

@@ -0,0 +1,28 @@
echo Installing Git...
brew install git
echo Installing Git LFS
brew install git-lfs
# Update global git config
git lfs install
# Update system git config
sudo git lfs install --system
echo Installing Hub
brew install hub
echo Disable all the Git help messages...
git config --global advice.pushUpdateRejected false
git config --global advice.pushNonFFCurrent false
git config --global advice.pushNonFFMatching false
git config --global advice.pushAlreadyExists false
git config --global advice.pushFetchFirst false
git config --global advice.pushNeedsForce false
git config --global advice.statusHints false
git config --global advice.statusUoption false
git config --global advice.commitBeforeMerge false
git config --global advice.resolveConflict false
git config --global advice.implicitIdentity false
git config --global advice.detachedHead false
git config --global advice.amWorkDir false
git config --global advice.rmHints false

View File

@@ -0,0 +1,17 @@
#!/bin/bash
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
export PATH="$HOME/.ghcup/bin:$PATH"
echo 'export PATH="$PATH:$HOME/.ghcup/bin"' >> "$HOME/.bashrc"
availableVersions=$(ghcup list | grep -v "prerelease" | grep "ghc " | awk '{print $3}')
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

View File

@@ -0,0 +1,24 @@
#!/bin/sh
echo "Installing Homebrew..."
source ~/utils/utils.sh
echo Installing Homebrew...
HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh"
/bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})"
echo Disabling Homebrew analytics...
brew analytics off
echo Installing the last version of curl
brew install curl
echo Installing wget...
brew install wget
echo Installing jq
brew install jq
# init brew bundle feature
brew tap Homebrew/bundle

View File

@@ -0,0 +1,12 @@
#!/bin/bash
MINICONDA_INSTALLER="/tmp/miniconda.sh"
curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER
chmod +x $MINICONDA_INSTALLER
sudo $MINICONDA_INSTALLER -b -p /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

View File

@@ -0,0 +1,10 @@
#!/bin/sh
# MongoDB object-value database
# installs last version of MongoDB Community Edition
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/v
echo "Installing mongodb..."
brew tap mongodb/brew
brew install mongodb-community

View File

@@ -0,0 +1,45 @@
source ~/utils/utils.sh
node_common_modules=(
node-gyp
mobile-center-cli
)
node_catalina_modules=(
appcenter-cli
newman
)
if is_Less_Catalina; then
echo Installing the latest Node JS 8...
TMP_FILE=/tmp/node-v8.17.0.pkg
NODEURL=https://nodejs.org/dist/latest-v8.x/node-v8.17.0.pkg
curl "${NODEURL}" -o "${TMP_FILE}"
sudo installer -pkg "${TMP_FILE}" -target /
rm -rf "${TMP_FILE}"
sudo chown -R $USER "/usr/local/lib/node_modules"
echo Installing NPM 3.x.x...
npm install -g npm@3
npm config set prefix /usr/local
echo Installing App Center CLI...
npm install -g appcenter-cli@^1.0.0
else
# Install Node.JS 12 for macOS >= 10.15
brew install node@12
brew link node@12 --force
for module in ${node_catalina_modules[@]}; do
echo "Install $module"
npm install -g $module
done
fi
echo Installing yarn...
curl -o- -L https://yarnpkg.com/install.sh | bash
for module in ${node_common_modules[@]}; do
echo "Install $module"
npm install -g $module
done

View File

@@ -0,0 +1,35 @@
#!/bin/sh
###########################################################################
# The script installs node version manager with node versions 6,8,10 and 12
#
###########################################################################
source ~/utils/utils.sh
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
if [ $? -eq 0 ]; then
. ~/.bashrc
nvm --version
nvm install lts/boron # 6.x
nvm install lts/carbon # 8.x
nvm install lts/dubnium # 10.x
nvm install lts/erbium # 12.x
nvm install v13 # 13.x
nvm install v14 # 14.x
nvm alias node6 lts/boron
nvm alias node8 lts/carbon
nvm alias node10 lts/dubnium
nvm alias node12 lts/erbium
nvm alias node13 v13
nvm alias node14 v14
if is_Catalina || is_BigSur; then
# set system node as default
nvm alias default system
fi
else
echo error
fi
echo "Node version manager has been installed successfully"

View File

@@ -0,0 +1,53 @@
#!/bin/sh
set -e
source ~/utils/utils.sh
installAzulJDK() {
local URL=$1
local TMP_FILE=/tmp/openjdk.dmg
local TMP_MOUNT=`/usr/bin/mktemp -d /tmp/zulu.XXXX`
# Download dmg
curl "${URL}" -o "${TMP_FILE}"
# Attach dmg
hdiutil attach "${TMP_FILE}" -mountpoint "${TMP_MOUNT}"
# Install pkg
sudo installer -pkg "${TMP_MOUNT}/"*.pkg -target /
# Detach dmg
hdiutil detach "${TMP_MOUNT}"
# Remove dmg
rm -rf "${TMP_FILE}"
}
createEnvironmentVariable() {
local VARIABLE_NAME=$1
local JAVA_VERSION=$2
if [[ $JAVA_VERSION == "7" || $JAVA_VERSION == "8" ]]; then
JAVA_VERSION="1.${JAVA_VERSION}"
fi
local JAVA_PATH=$(/usr/libexec/java_home -v${JAVA_VERSION})
echo "export ${VARIABLE_NAME}=${JAVA_PATH}" >> "${HOME}/.bashrc"
}
brew tap AdoptOpenJDK/openjdk
JAVA_VERSIONS_LIST=($(get_toolset_value '.java.versions | .[]'))
JAVA_DEFAULT=$(get_toolset_value '.java.default')
for JAVA_VERSION in "${JAVA_VERSIONS_LIST[@]}"
do
if [[ $JAVA_VERSION == "7" ]]; then
installAzulJDK "https://cdn.azul.com/zulu/bin/zulu7.40.0.15-ca-jdk7.0.272-macosx_x64.dmg"
else
brew cask install "adoptopenjdk${JAVA_VERSION}"
fi
createEnvironmentVariable "JAVA_HOME_${JAVA_VERSION}_X64" $JAVA_VERSION
done
createEnvironmentVariable "JAVA_HOME" $JAVA_DEFAULT
echo Installing Maven...
brew install maven
echo Installing Gradle ...
brew install gradle

View File

@@ -0,0 +1,26 @@
#!/bin/sh
echo "Installing OpenSSL..."
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
echo Installing OpenSSL...
/usr/local/bin/brew install openssl
/usr/local/bin/brew link openssl --force
# Install OpenSSL 1.0.2t
# https://www.openssl.org/policies/releasestrat.html - Version 1.0.2 will be supported until 2019-12-31 (LTS)
# To preserve backward compatibility with ruby-toolcache
/usr/local/bin/brew tap-new local/openssl
FORMULA_PATH=$(/usr/local/bin/brew extract openssl local/openssl | grep "Homebrew/Library/Taps")
/usr/local/bin/brew install $FORMULA_PATH
# Set OpenSSL 1.0.2t as default
ln -sf /usr/local/Cellar/openssl@1.0.2t /usr/local/Cellar/openssl
ln -sf /usr/local/Cellar/openssl/1.0.2t/bin/openssl /usr/local/bin/openssl
rm /usr/local/opt/openssl
ln -sf ../Cellar/openssl/1.0.2t /usr/local/opt/openssl
# Resolve dot net core openssl dependency issue for agent
# https://github.com/microsoft/azure-pipelines-agent/blob/master/docs/start/envosx.md
mkdir -p /usr/local/lib/
ln -s /usr/local/opt/openssl@1.0.2t/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl@1.0.2t/lib/libssl.1.0.0.dylib /usr/local/lib/

View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -e
echo Installing PHP
brew install php
echo Installing composer
brew install composer

View File

@@ -0,0 +1,18 @@
#!/bin/bash
#Install latest version of postgresql
brew install postgres
#Service postgresql should be started before use.
brew services start postgresql
#Verify that PostgreSQL is ready for accept incoming connections.
# exit codes:
# ready - 0
# reject - 1
# connection timeout - 2
# incorrect credentials or parameters - 3
pg_isready
#Stop postgresql
brew services stop postgresql

View File

@@ -0,0 +1,34 @@
source ~/utils/utils.sh
echo Installing Azure CLI...
brew install azure-cli
echo Installing PowerShell...
brew cask install powershell
# A dummy call of `az` to initialize ~/.azure directory before the modules are installed
az -v
# Install PowerShell modules
psModules=$(get_toolset_value '.powershellModules[].name')
for module in ${psModules[@]}; do
echo "Installing $module module"
moduleVersions="$(get_toolset_value ".powershellModules[] | select(.name==\"$module\") | .versions[]?")"
if [[ -z "$moduleVersions" ]];then
pwsh -command "& {Install-Module $module -Force -Scope AllUsers}"
else
for version in ${moduleVersions[@]}; do
echo " - $version"
pwsh -command "& {Install-Module $module -RequiredVersion $version -Force -Scope AllUsers}"
done
fi
done
# Enables AzureRm prefix aliases for Az modules
sudo pwsh -command "& {Import-Module Az; Enable-AzureRmAlias -Scope LocalMachine}"
# powershell link was removed in powershell-6.0.0-beta9
sudo ln -s /usr/local/bin/pwsh /usr/local/bin/powershell
# fix ~/.azure directory permissions
sudo chown -R ${USER}: $HOME/.azure

View File

@@ -0,0 +1,84 @@
#!/bin/bash
################################################################################
## File: pypy.sh
## Desc: Installs PyPy
################################################################################
source ~/utils/utils.sh
set -e
function InstallPyPy
{
PACKAGE_URL=$1
PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}')
echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'"
PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME"
wget -q -O $PACKAGE_TAR_TEMP_PATH $PACKAGE_URL
echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder"
tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp
# Get Python version
PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/}
MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1)
PYTHON_MAJOR="python$MAJOR_VERSION"
if [ $MAJOR_VERSION != 2 ]; then
PYPY_MAJOR="pypy$MAJOR_VERSION"
else
PYPY_MAJOR="pypy"
fi
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
# PyPy folder structure
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION
PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64
echo "Check if PyPy hostedtoolcache folder exist..."
if [ ! -d $PYPY_TOOLCACHE_PATH ]; then
mkdir -p $PYPY_TOOLCACHE_PATH
fi
echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder"
mkdir $PYPY_TOOLCACHE_VERSION_PATH
echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder"
mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
ln -s $PYPY_MAJOR $PYTHON_MAJOR
ln -s $PYTHON_MAJOR python
chmod +x ./python ./$PYTHON_MAJOR
echo "Install latest Pip"
./python -m ensurepip
./python -m pip install --ignore-installed pip
echo "Create complete file"
touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete
echo "Remove '$PACKAGE_TAR_TEMP_PATH'"
rm -f $PACKAGE_TAR_TEMP_PATH
}
# PyPy 7.3.1 relies on system libffi.6.dylib, which is not existed in in libffi 3.3 release. As a workaround symlink can be created
ln -s libffi.7.dylib /usr/local/opt/libffi/lib/libffi.6.dylib
uri="https://downloads.python.org/pypy/"
pypyVersions=$(curl -4 -s --compressed $uri | grep 'osx64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')
toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
for toolsetVersion in $toolsetVersions; do
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1)
if [[ -z "$latestMajorPyPyVersion" ]]; then
echo "Failed to get PyPy version '$toolsetVersion'"
exit 1
fi
InstallPyPy $latestMajorPyPyVersion
done

View File

@@ -0,0 +1,10 @@
echo "Installing Python Tooling"
echo "Brew Installing Python 3"
/usr/local/bin/brew install python3
echo "Brew Installing Python 2"
# Create local tap with formula due to python2 formula depreciation
/usr/local/bin/brew tap-new local/python2
FORMULA_PATH=$(/usr/local/bin/brew extract python@2 local/python2 | grep "Homebrew/Library/Taps")
/usr/local/bin/brew install $FORMULA_PATH

View File

@@ -0,0 +1,2 @@
#!/bin/bash
shutdown -r now

View File

@@ -0,0 +1,14 @@
#!/bin/sh
set -e
if [ $(id -u) -eq 0 ]; then
echo "This script can not run as root. Aborting..."
exit 1
fi
# We can't install latest ruby 2.7 as a default version related with bug
# https://github.com/fastlane/fastlane/issues/15397
echo Installing Ruby...
/usr/local/bin/brew install ruby@2.6
ln -sf /usr/local/opt/ruby\@2.6 /usr/local/opt/ruby

View File

@@ -0,0 +1,29 @@
#!/bin/sh
source ~/utils/utils.sh
echo Updating RubyGems...
gem update --system
echo Installing xcode-install utility...
gem install xcode-install --force
echo Installing CocoaPods...
gem install cocoapods
# fix nomad-cli installation
if is_HighSierra; then
brew install libxml2
gem install nokogiri -v 1.6.8.1 -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
fi
echo Installing nomad-cli...
gem install nomad-cli
echo Installing xcpretty...
gem install xcpretty
echo Installing bundler...
gem install bundler --force
echo Installing fastlane tools...
gem install fastlane

View File

@@ -0,0 +1,19 @@
#!/bin/sh
set -e
echo Installing Rustup...
brew install rustup-init
echo Installing Rust language...
rustup-init -y --no-modify-path --default-toolchain=stable --profile=minimal
echo Initialize environment variables...
CARGO_HOME=$HOME/.cargo
source $CARGO_HOME/env
echo Install common tools...
cargo install bindgen cbindgen cargo-audit cargo-outdated
echo Cleanup Cargo registry cached data...
rm -rf $CARGO_HOME/registry/*

View File

@@ -0,0 +1,22 @@
#!/bin/bash
echo "Get the latest Stack version..."
StackRelease=$(curl -s "https://api.github.com/repos/commercialhaskell/stack/releases/latest")
DownloadUrl=$(echo $StackRelease | jq -r '.assets[].browser_download_url | select(contains("osx-x86_64.tar.gz"))' | head -n 1)
StackVersion=$(echo $StackRelease | jq -r '.name' | cut -c2-)
StackArchive="/tmp/stack.tar.gz"
echo "Download stack version $StackVersion..."
wget $DownloadUrl -O $StackArchive
StackToolcachePath="$AGENT_TOOLSDIRECTORY/stack/$StackVersion"
DestinationPath="$StackToolcachePath/x64"
mkdir -p $DestinationPath
echo "Unzip stack archive..."
tar -xzf $StackArchive -C $DestinationPath --strip 1
touch $StackToolcachePath/x64.complete
echo "export PATH="\$PATH":$DestinationPath" >> "$HOME/.bashrc"

View File

@@ -0,0 +1,27 @@
#!/bin/sh
###########################################################################
# The script downloads macos hosted tool cache for several Python versions
# and installs them onto the system
#
###########################################################################
SOURCE_URL="https://vstsagenttools.blob.core.windows.net/tools"
PACKAGES_DIR=/tmp/hostedtoolcache
# Download hosted tool cache with azcopy
azcopy copy $SOURCE_URL $PACKAGES_DIR --include-path "hostedtoolcache/macos-10.13" --recursive
mv $PACKAGES_DIR/tools/hostedtoolcache/macos-10.13/* $PACKAGES_DIR
if [ $? -ne 0 ]; then
echo "An error occured while downloading hostedtoolcache"
exit 1
fi
# Install the tools from the hosted tool cache
packages=$(find $PACKAGES_DIR -name package.json)
for package in $packages; do
pushd $(dirname $package)
npm install
popd
done;

View File

@@ -0,0 +1,38 @@
#!/bin/sh
# Download hosted tool cache with npm
NPM_FEED="npm.pkg.github.com"
TOOLSET_PATH="$HOME/image-generation/toolcache.json"
echo "Installing npm-toolcache..."
PACKAGE_LIST=($(jq -r 'keys | .[]' $TOOLSET_PATH))
# Execute in /tmp folder to avoid node_modules creation in $HOME
pushd /tmp
# GitHub Package Registry doesn't support downloading public packages without auth so we have to authorize
# Put the .npmrc to /tmp directory on the image to make sure that it will deleted after image generation
echo "Configure auth for github package registry"
echo "@actions:registry=https://${NPM_FEED}/" >> ".npmrc"
echo "//${NPM_FEED}/:_authToken=${GITHUB_FEED_TOKEN}" >> ".npmrc"
echo "Install packages..."
for PACKAGE_NAME in ${PACKAGE_LIST[@]}; do
PACKAGE_VERSIONS=($(jq -r ".[\"$PACKAGE_NAME\"] | .[]" $TOOLSET_PATH))
for PACKAGE_VERSION in ${PACKAGE_VERSIONS[@]}; do
echo "Install ${PACKAGE_NAME}@${PACKAGE_VERSION}"
npm install ${PACKAGE_NAME}@${PACKAGE_VERSION}
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} installation failure; Error:${exit_code}"
exit 1
fi
done;
done;
rm -f ".npmrc"
popd

View File

@@ -0,0 +1,58 @@
################################################################################
## File: toolset.ps1
## Team: CI-Build
## Desc: Install toolset
################################################################################
Function Get-ToolcacheFromToolset {
$toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json"
$toolsetJson = Get-Content -Raw $toolsetPath | ConvertFrom-Json
return $toolsetJson.toolcache
}
Function Install-Asset {
param(
[Parameter(Mandatory=$true)]
[object] $ReleaseAsset
)
$assetFolderPath = Join-Path "/tmp" "$($ReleaseAsset.filename)-temp-dir"
New-Item -ItemType Directory -Path $assetFolderPath | Out-Null
$assetArchivePath = Join-Path $assetFolderPath $ReleaseAsset.filename
Write-Host "Download $($ReleaseAsset.filename) archive to the $assetFolderPath folder..."
wget -P $assetFolderPath $ReleaseAsset.download_url --retry-connrefused --retry-on-http-error=429,500,503 --wait=30 --no-verbose
Write-Host "Extract $($ReleaseAsset.filename) content..."
tar -xzf $assetArchivePath -C $assetFolderPath
Write-Host "Invoke installation script..."
Push-Location -Path $assetFolderPath
Invoke-Expression "bash ./setup.sh"
Pop-Location
}
# Get toolcache content from toolset
$toolsToInstall = @("Python", "Node", "Go")
$tools = Get-ToolcacheFromToolset | Where-Object {$ToolsToInstall -contains $_.Name}
foreach ($tool in $tools) {
# Get versions manifest for current tool
$assets = Invoke-RestMethod $tool.url
# Get github release asset for each version
foreach ($version in $tool.versions) {
$asset = $assets | Where-Object version -like $version `
| Select-Object -ExpandProperty files `
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.platform_version -eq $tool.platform_version)} `
| Select-Object -First 1
Write-Host "Installing $($tool.name) $version..."
if ($null -ne $asset) {
Install-Asset -ReleaseAsset $asset
} else {
Write-Host "Asset was not found in versions manifest"
exit 1
}
}
}

View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
source ~/utils/utils.sh
# Set env variable for vcpkg
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
echo "export VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a ~/.bashrc
# Install vcpkg
git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT
$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh
$VCPKG_INSTALLATION_ROOT/vcpkg integrate install
chmod -R 0777 $VCPKG_INSTALLATION_ROOT
ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin

View File

@@ -0,0 +1,27 @@
#!/bin/sh
source ~/utils/utils.sh
source ~/utils/xamarin-utils.sh
VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac')
VSMAC_DOWNLOAD_URL=$(buildVSMacDownloadUrl $VSMAC_VERSION)
TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX`
TMPMOUNT_DOWNLOADS="$TMPMOUNT/downloads"
mkdir $TMPMOUNT_DOWNLOADS
download_with_retries $VSMAC_DOWNLOAD_URL $TMPMOUNT_DOWNLOADS
echo "Mounting Visual studio..."
VISUAL_STUDIO_NAME=${VSMAC_DOWNLOAD_URL##*/}
hdiutil attach "$TMPMOUNT_DOWNLOADS/$VISUAL_STUDIO_NAME" -mountpoint "$TMPMOUNT"
echo "Moving Visual Studio to /Applications/..."
pushd $TMPMOUNT
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
echo "Launching vstools..."
/Applications/Visual\ Studio.app/Contents/MacOS/vstool
popd
sudo hdiutil detach "$TMPMOUNT"
sudo rm -rf "$TMPMOUNT"

View File

@@ -0,0 +1,64 @@
#!/bin/sh
source ~/utils/utils.sh
ANDROID_HOME=$HOME/Library/Android/sdk
ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager
# Android NDK v16 is not compatible with old Xamarin.Android SDK
# and fails builds with BundleAssemblies enabled
ANDROID_NDK_15_HOME=$HOME/Library/Android/sdk/android-ndk-r15c
ANDROID_NDK_PACKAGE="android-ndk-r15c-darwin-x86_64.zip"
ANDROID_NDK_URL="https://dl.google.com/android/repository/${ANDROID_NDK_PACKAGE}"
echo "Install and setup Android NDK v15..."
cd $HOME
download_with_retries $ANDROID_NDK_URL
echo "Unzipping $ANDROID_NDK_URL..."
unzip -q $ANDROID_NDK_PACKAGE -d ${ANDROID_HOME}
echo "Removing $ANDROID_NDK_URL..."
rm -rf "$ANDROID_NDK_PACKAGE"
XAMARIN_ANDROID_NDK_PATH=$HOME/Library/Developer/Xamarin
mkdir -p $XAMARIN_ANDROID_NDK_PATH
echo "Preparing symlink for $ANDROID_NDK_15_HOME ..."
ln -s $ANDROID_NDK_15_HOME $XAMARIN_ANDROID_NDK_PATH/android-ndk
# NDK r17 does not include MIPS/MIPS64 toolchains anymore, NDK r16b still provides this a supplement
echo "Checking NDK installation contains required MIPS toolchains…"
NDK_BUNDLE_TOOLCHAINS=$ANDROID_NDK_HOME/toolchains
ANDROID_NDK_R16B_PATH=$ANDROID_HOME/ndk/16.1.4479499
MIPS64_TOOLCHAIN=$NDK_BUNDLE_TOOLCHAINS/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin
MIPS_TOOLCHAIN=$NDK_BUNDLE_TOOLCHAINS/mipsel-linux-android-4.9/prebuilt/darwin-x86_64/bin
if [ -d $MIPS64_TOOLCHAIN ] && [ -d $MIPS_TOOLCHAIN ]; then
echo "MIPS64 and MIPS toolchain already installed for NDK bundle - not reinstalling."
else
pushd $ANDROID_HOME
echo "Installing ndk r16b..."
echo y | $SDKMANAGER "ndk;16.1.4479499"
echo "Cleaning potential pre-existing MIPS toolchain directories"
rm -rf ndk-bundle/toolchains/mips*
echo "Moving MIPS toolchains to $ANDROID_NDK_HOME/toolchains"
mv $ANDROID_NDK_R16B_PATH/toolchains/mips** ndk-bundle/toolchains/
echo "Delete ndk r16b..."
rm -rf $ANDROID_NDK_R16B_PATH
if [ ! -d $MIPS64_TOOLCHAIN ] || [ ! -d $MIPS_TOOLCHAIN ]; then
echo "MIPS toolchains not installed correctly! Check whether $ANDROID_NDK_HOME/toolchains/mips* does not exist."
fi
popd
fi
# Latest versions of NDK doesn't include GCC, NDK r18 does
echo "Installing ndk r18B..."
echo y | $SDKMANAGER "ndk;18.1.5063045"
echo "export ANDROID_NDK_18R_PATH=${ANDROID_HOME}/ndk/18.1.5063045" >> "${HOME}/.bashrc"

View File

@@ -0,0 +1,81 @@
#!/bin/sh
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"')
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
#
# Fix Mono issue with default nuget: https://github.com/mono/mono/issues/17637
installNuget "6.4.0" "5.3.1"
if is_Less_Catalina; then
installNuget "4.8.1" "4.3.0"
installNuget "5.0.1" "4.3.0"
installNuget "5.2.0" "4.3.0"
fi
# Creating UWP Shim to hack UWP build failure
createUWPShim
popd
echo "Clean up packages..."
sudo rm -rf "$TMPMOUNT"

View File

@@ -0,0 +1,19 @@
#!/bin/bash
# Homebrew doesn't support installation of command line tools on MacOS 11.0
# https://github.com/Homebrew/install/blob/master/install.sh#L191
# Copy-paste script from brew installation process
# https://github.com/Homebrew/install/blob/master/install.sh#L530
# This temporary file prompts the 'softwareupdate' utility to list the Command Line Tools
clt_placeholder="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
touch $clt_placeholder
clt_label=`/usr/sbin/softwareupdate -l |
grep -B 1 -E 'Command Line Tools' |
awk -F'*' '/^ *\\*/ {print \$2}' |
sed -e 's/^ *Label: //' -e 's/^ *//' |
sort -V |
tail -n1`
/usr/sbin/softwareupdate -i "$clt_label"
rm -f $clt_placeholder
sudo xcode-select --switch "/Library/Developer/CommandLineTools/"

View File

@@ -0,0 +1,30 @@
#!/bin/bash
source ~/utils/utils.sh
XCODE_LIST=($(get_xcode_list_from_toolset))
DEFAULT_XCODE_VERSION=$(get_default_xcode_from_toolset)
# https://github.com/microsoft/appcenter/issues/847
# Assets.xcassets : error : CoreData: error: (6922) I/O error for database
# at $HOME/Library/Developer/Xcode/UserData/IB Support/Simulator Devices/{GUID}
echo "Erase a device's contents and settings:"
for XCODE_VERSION in "${XCODE_LIST[@]}"
do
echo " Xcode Version: ${XCODE_VERSION}"
launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true
#add sleep to let CoreSimulatorService to exit
sleep 3
# Select xcode version by default
sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer"
# Erase a device's contents and settings
xcrun simctl erase all
#add sleep due to sometimes "xcrun simctl list" takes more than a few moments and script fails when trying to remove CoreSimulatorSerivce
sleep 10
done
# Select xcode version by default
echo "Setting Xcode ${DEFAULT_XCODE_VERSION} as default"
sudo xcode-select -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app/Contents/Developer"

View File

@@ -0,0 +1,25 @@
#!/bin/sh
source ~/utils/utils.sh
# Downloading and installing simulators
SIMS_TO_INSTALL=(
"8.4"
"9.0"
"9.1"
"9.2"
"9.3"
"10.0"
"10.1"
"10.2"
"10.3"
)
for SIM_VERSION in ${SIMS_TO_INSTALL[@]}
do
echo "Installing iOS $SIM_VERSION ..."
sudo xcversion simulators --install="iOS ${SIM_VERSION}"
echo "Successfuly installed iOS $SIM_VERSION ..."
done
echo "Done installing simulator runtimes."

View File

@@ -0,0 +1,99 @@
#!/bin/sh
# The script currently requires 2 external variables to be set: XCODE_INSTALL_USER
# and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center
set -e
source ~/utils/utils.sh
source ~/utils/xcode-utils.sh
if [ -z $XCODE_INSTALL_USER ] || [ -z $XCODE_INSTALL_PASSWORD ]; then
echo "Required environment variables XCODE_INSTALL_USER and XCODE_INSTALL_PASSWORD are not set"
exit 1
fi
XCODE_LIST=($(get_xcode_list_from_toolset))
LATEST_XCODE_VERSION=$(get_latest_xcode_from_toolset)
DEFAULT_XCODE_VERSION=$(get_default_xcode_from_toolset)
WORK_DIR="${HOME}/Library/Caches/XcodeInstall"
# Update the list of available versions
xcversion update
for XCODE_VERSION in "${XCODE_LIST[@]}"
do
VERSION_TO_INSTALL="$(getXcodeVersionToInstall "$XCODE_VERSION")"
if [[ -z "$VERSION_TO_INSTALL" ]]; then
echo "No versions were found matching $XCODE_VERSION"
exit 1
fi
echo "Downloading Xcode $VERSION_TO_INSTALL ..."
xcversion install "$VERSION_TO_INSTALL" --no-install
echo "Extracting Xcode.app ($VERSION_TO_INSTALL) to ${WORK_DIR} ..."
extractXcodeXip $WORK_DIR "$VERSION_TO_INSTALL"
# Remove "beta" postfix from version
XCODE_VERSION=$(echo $XCODE_VERSION | cut -d"_" -f 1)
echo "Checking if unpacked Xcode ${XCODE_VERSION} is valid"
validateXcodeIntegrity "$WORK_DIR"
# Move Xcode to /Applications
mv -f "${WORK_DIR}/Xcode.app" "/Applications/Xcode_${XCODE_VERSION}.app"
echo "Accepting license for Xcode ${XCODE_VERSION}..."
approveLicense $XCODE_VERSION
# Creating a symlink for all Xcode 10* and Xcode 9.3, 9.4 to stay backwards compatible with consumers of the Xcode beta version
createBetaSymlink $XCODE_VERSION
if [ ! $(echo $XCODE_VERSION | grep "beta") ]; then
createXamarinProvisionatorSymlink "$XCODE_VERSION"
fi
find $WORK_DIR -mindepth 1 -delete
done
echo "Configuring 'runFirstLaunch' for all Xcode versions"
if is_Less_Catalina; then
echo "Install additional packages for Xcode ${LATEST_XCODE_VERSION}"
installAdditionalPackages $LATEST_XCODE_VERSION
fi
for XCODE_VERSION in "${XCODE_LIST[@]}"
do
if [[ $XCODE_VERSION == 8* || $XCODE_VERSION == 9* ]]; then
continue
fi
echo "Running 'runFirstLaunch' for Xcode ${XCODE_VERSION}..."
runFirstLaunch $XCODE_VERSION
done
echo "Running 'runFirstLaunch' for default Xcode ${DEFAULT_XCODE_VERSION}..."
runFirstLaunch $DEFAULT_XCODE_VERSION
# Create symlinks for Xcode on Catalina: 11.3 -> 11.3.1, 11.2 -> 11.2.1
if is_Catalina; then
ln -sf /Applications/Xcode_11.2.1.app /Applications/Xcode_11.2.app
ln -sf /Applications/Xcode_11.3.1.app /Applications/Xcode_11.3.app
fi
echo "Setting Xcode ${DEFAULT_XCODE_VERSION} as default"
sudo xcode-select -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app/Contents/Developer"
echo "Adding symlink '/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app' -> '/Applications/Xcode.app'"
ln -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app" "/Applications/Xcode.app"
echo "Enabling developer mode"
sudo /usr/sbin/DevToolsSecurity --enable
echo "Setting environment variables 'XCODE_<VERSION>_DEVELOPER_DIR'"
setXcodeDeveloperDirVariables
# Cleanup
echo "Doing cleanup. Emptying ${WORK_DIR}..."
rm -rf "$WORK_DIR"

View File

@@ -0,0 +1,94 @@
download_with_retries() {
# Due to restrictions of bash functions, positional arguments are used here.
# In case if you using latest argument NAME, you should also set value to all previous parameters.
# Example: download_with_retries $ANDROID_SDK_URL "." "android_sdk.zip"
local URL="$1"
local DEST="${2:-.}"
local NAME="${3:-${URL##*/}}"
echo "Downloading $URL..."
wget $URL --output-document="$DEST/$NAME" \
--tries=30 \
--wait 30 \
--retry-connrefused \
--retry-on-host-error \
--retry-on-http-error=429,500,502,503 \
--no-verbose
if [ $? != 0 ]; then
echo "Could not download $URL; Exiting build!"
exit 1
fi
return 0
}
is_BigSur() {
if [ "$OSTYPE" = "darwin20" ]; then
true
else
false
fi
}
is_Catalina() {
if [ "$OSTYPE" = "darwin19" ]; then
true
else
false
fi
}
is_Mojave() {
if [ "$OSTYPE" = "darwin18" ]; then
true
else
false
fi
}
is_HighSierra() {
if [ "$OSTYPE" = "darwin17" ]; then
true
else
false
fi
}
is_Less_Catalina() {
if is_HighSierra || is_Mojave; then
true
else
false
fi
}
is_Less_BigSur() {
if is_HighSierra || is_Mojave || is_Catalina; then
true
else
false
fi
}
get_toolset_path() {
echo "$HOME/image-generation/toolset.json"
}
get_toolset_value() {
local toolset_path=$(get_toolset_path)
local query=$1
echo "$(jq -r "$query" $toolset_path)"
}
get_xcode_list_from_toolset() {
echo $(get_toolset_value '.xcode.versions | reverse | .[]')
}
get_latest_xcode_from_toolset() {
echo $(get_toolset_value '.xcode.versions[0]')
}
get_default_xcode_from_toolset() {
echo $(get_toolset_value '.xcode.default')
}

View File

@@ -0,0 +1,233 @@
#!/bin/sh
# Xamarin can clean their SDKs while updating to newer versions,
# so we should be able to detect it during image generation
downloadAndInstallPKG() {
local PKG_URL=$1
local PKG_NAME=${PKG_URL##*/}
download_with_retries $PKG_URL
echo "Installing $PKG_NAME..."
sudo installer -pkg "$TMPMOUNT/$PKG_NAME" -target /
}
buildVSMacDownloadUrl() {
echo "https://dl.xamarin.com/VsMac/VisualStudioForMac-${1}.dmg"
}
buildMonoDownloadUrl() {
echo "https://dl.xamarin.com/MonoFrameworkMDK/Macx86/MonoFramework-MDK-${1}.macos10.xamarin.universal.pkg"
}
buildXamariniIOSDownloadUrl() {
echo "https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-${1}.pkg"
}
buildXamarinMacDownloadUrl() {
echo "https://dl.xamarin.com/XamarinforMac/Mac/xamarin.mac-${1}.pkg"
}
buildXamarinAndroidDownloadUrl() {
echo "https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-${1}.pkg"
}
installMono() {
local VERSION=$1
echo "Installing Mono ${VERSION}..."
local MONO_FOLDER_NAME=$(echo $VERSION | cut -d. -f 1,2,3)
local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2)
local PKG_URL=$(buildMonoDownloadUrl $VERSION)
downloadAndInstallPKG $PKG_URL
echo "Installing nunit3-console for Mono "$VERSION
installNunitConsole $MONO_FOLDER_NAME
echo "Creating short symlink '${SHORT_VERSION}'"
sudo ln -s ${MONO_VERSIONS_PATH}/${MONO_FOLDER_NAME} ${MONO_VERSIONS_PATH}/${SHORT_VERSION}
echo "Move to backup folder"
sudo mv -v $MONO_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/mono/
}
installXamarinIOS() {
local VERSION=$1
echo "Installing Xamarin.iOS ${VERSION}..."
local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2)
local PKG_URL=$(buildXamariniIOSDownloadUrl $VERSION)
downloadAndInstallPKG $PKG_URL
echo "Creating short symlink '${SHORT_VERSION}'"
sudo ln -s ${IOS_VERSIONS_PATH}/${VERSION} ${IOS_VERSIONS_PATH}/${SHORT_VERSION}
echo "Move to backup folder"
sudo mv -v $IOS_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/ios/
}
installXamarinMac() {
local VERSION=$1
echo "Installing Xamarin.Mac ${VERSION}..."
local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2)
local PKG_URL=$(buildXamarinMacDownloadUrl $VERSION)
downloadAndInstallPKG $PKG_URL
echo "Creating short symlink '${SHORT_VERSION}'"
sudo ln -s ${MAC_VERSIONS_PATH}/${VERSION} ${MAC_VERSIONS_PATH}/${SHORT_VERSION}
echo "Move to backup folder"
sudo mv -v $MAC_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/mac/
}
installXamarinAndroid() {
local VERSION=$1
echo "Installing Xamarin.Android ${VERSION}..."
local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2)
local PKG_URL=$(buildXamarinAndroidDownloadUrl $VERSION)
downloadAndInstallPKG $PKG_URL
if [ "$VERSION" == "9.4.1.0" ]; then
# Fix symlinks for broken Xamarin.Android
fixXamarinAndroidSymlinksInLibDir $VERSION
fi
echo "Creating short symlink '${SHORT_VERSION}'"
sudo ln -s ${ANDROID_VERSIONS_PATH}/${VERSION} ${ANDROID_VERSIONS_PATH}/${SHORT_VERSION}
echo "Move to backup folder"
sudo mv -v $ANDROID_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/android/
}
createBundle() {
local SYMLINK=$1
local MONO_SDK=$2
local IOS_SDK=$3
local MAC_SDK=$4
local ANDROID_SDK=$5
echo "Creating bundle '$SYMLINK' (Mono $MONO_SDK; iOS $IOS_SDK; Mac $MAC_SDK; Android $ANDROID_SDK"
deleteSymlink ${SYMLINK}
sudo ln -s ${MONO_VERSIONS_PATH}/${MONO_SDK} ${MONO_VERSIONS_PATH}/${SYMLINK}
sudo ln -s ${IOS_VERSIONS_PATH}/${IOS_SDK} ${IOS_VERSIONS_PATH}/${SYMLINK}
sudo ln -s ${MAC_VERSIONS_PATH}/${MAC_SDK} ${MAC_VERSIONS_PATH}/${SYMLINK}
sudo ln -s ${ANDROID_VERSIONS_PATH}/${ANDROID_SDK} ${ANDROID_VERSIONS_PATH}/${SYMLINK}
}
createBundleLink() {
local SOURCE=$1
local TARGET=$2
echo "Creating bundle symlink '$SOURCE' -> '$TARGET'"
deleteSymlink ${TARGET}
sudo ln -s ${MONO_VERSIONS_PATH}/$SOURCE ${MONO_VERSIONS_PATH}/$TARGET
sudo ln -s ${IOS_VERSIONS_PATH}/$SOURCE ${IOS_VERSIONS_PATH}/$TARGET
sudo ln -s ${MAC_VERSIONS_PATH}/$SOURCE ${MAC_VERSIONS_PATH}/$TARGET
sudo ln -s ${ANDROID_VERSIONS_PATH}/$SOURCE ${ANDROID_VERSIONS_PATH}/$TARGET
}
# https://github.com/xamarin/xamarin-android/issues/3457
# Recreate missing symlinks in lib for new Xamarin.Android package
# Symlink path /Library/Frameworks/Xamarin.Android.framework/Libraries
# xbuild -> xamarin.android/xbuild
# xbuild-frameworks -> xamarin.android/xbuild-frameworks
fixXamarinAndroidSymlinksInLibDir() {
local XAMARIN_ANDROID_VERSION=$1
local XAMARIN_ANDROID_LIB_PATH="${ANDROID_VERSIONS_PATH}/${XAMARIN_ANDROID_VERSION}/lib"
if [ -d "${XAMARIN_ANDROID_LIB_PATH}" ]; then
pushd "${XAMARIN_ANDROID_LIB_PATH}" > /dev/null
local XAMARIN_ANDROID_XBUILD_DIR="${XAMARIN_ANDROID_LIB_PATH}/xbuild"
if [ ! -d "${XAMARIN_ANDROID_XBUILD_DIR}" ]; then
echo "${XAMARIN_ANDROID_XBUILD_DIR}"
sudo ln -sf xamarin.android/xbuild xbuild
fi
local XAMARIN_ANDROID_XBUILD_FRAMEWORKS_DIR="${XAMARIN_ANDROID_LIB_PATH}/xbuild-frameworks"
if [ ! -d "${XAMARIN_ANDROID_XBUILD_FRAMEWORKS_DIR}" ]; then
echo "${XAMARIN_ANDROID_XBUILD_FRAMEWORKS_DIR}"
sudo ln -sf xamarin.android/xbuild-frameworks xbuild-frameworks
fi
popd > /dev/null
fi
}
installNunitConsole() {
local MONO_VERSION=$1
cat <<EOF > ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN}
#!/bin/sh
exec /Library/Frameworks/Mono.framework/Versions/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT3_PATH/nunit3-console.exe "\$@"
EOF
sudo chmod +x ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN}
sudo mv ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} ${MONO_VERSIONS_PATH}/${MONO_VERSION}/Commands/${NUNIT3_CONSOLE_BIN}
}
downloadNUnitConsole() {
echo "Downloading NUnit 3..."
local NUNIT3_LOCATION='https://github.com/nunit/nunit-console/releases/download/3.6.1/NUnit.Console-3.6.1.zip'
local NUNIT_PATH="/Library/Developer/nunit"
NUNIT3_PATH="$NUNIT_PATH/3.6.1"
pushd $TMPMOUNT
sudo mkdir -p $NUNIT3_PATH
sudo curl -L -o nunit3.zip $NUNIT3_LOCATION
echo "Installing NUnit 3..."
sudo unzip nunit3.zip -d $NUNIT3_PATH
NUNIT3_CONSOLE_BIN=nunit3-console
popd
}
installNuget() {
local MONO_VERSION=$1
local NUGET_VERSION=$2
local NUGET_URL="https://dist.nuget.org/win-x86-commandline/v${NUGET_VERSION}/nuget.exe"
echo "Installing nuget $NUGET_VERSION for Mono $MONO_VERSION"
cd ${MONO_VERSIONS_PATH}/${MONO_VERSION}/lib/mono/nuget
sudo mv nuget.exe nuget_old.exe
sudo curl -L -o nuget.exe $NUGET_URL
sudo chmod a+x nuget.exe
}
createUWPShim() {
echo "Creating UWP Shim to hack UWP build failure..."
cat <<EOF > ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name = "Build"/>
<Target Name = "Rebuild"/>
</Project>
EOF
local UWPTARGET_PATH=/Library/Frameworks/Mono.framework/External/xbuild/Microsoft/WindowsXaml
sudo mkdir -p $UWPTARGET_PATH/v11.0/
sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v11.0/
sudo mkdir -p $UWPTARGET_PATH/v12.0/
sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v12.0/
sudo mkdir -p $UWPTARGET_PATH/v14.0/
sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v14.0/
sudo mkdir -p $UWPTARGET_PATH/v15.0/
sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v15.0/
sudo mkdir -p $UWPTARGET_PATH/v16.0/
sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v16.0/
}
createBackupFolders() {
mkdir -p $TMPMOUNT_FRAMEWORKS/mono
mkdir -p $TMPMOUNT_FRAMEWORKS/ios
mkdir -p $TMPMOUNT_FRAMEWORKS/mac
mkdir -p $TMPMOUNT_FRAMEWORKS/android
}
deleteSymlink() {
sudo rm -f ${MONO_VERSIONS_PATH}/${1}
sudo rm -f ${IOS_VERSIONS_PATH}/${1}
sudo rm -f ${MAC_VERSIONS_PATH}/${1}
sudo rm -f ${ANDROID_VERSIONS_PATH}/${1}
}

View File

@@ -0,0 +1,81 @@
createXamarinProvisionatorSymlink() {
local XCODE_VERSION="$1"
local FULL_VERSION=$(echo "${XCODE_VERSION}.0.0" | cut -d'.' -f 1,2,3)
if [ $FULL_VERSION != $XCODE_VERSION ]; then
ln -sf "/Applications/Xcode_${XCODE_VERSION}.app" "/Applications/Xcode_${FULL_VERSION}.app"
fi
}
getXcodeVersionToInstall() {
local XCODE_VERSION="$1"
if [[ ! $XCODE_VERSION =~ "_beta" ]]; then
echo "$XCODE_VERSION"
else
local XCODE_BETA="${XCODE_VERSION/_/ }"
echo "$(xcversion list | sort -r | grep -m 1 "$XCODE_BETA")"
fi
}
validateXcodeIntegrity() {
local WORKING_DIR="$1"
local XCODE_VERSION="$2"
if echo $XCODE_VERSION | grep "beta"; then
return 0
fi
spctl --assess --raw "${WORKING_DIR}/Xcode.app"
}
approveLicense() {
local XCODE_VERSION="$1"
sudo "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer/usr/bin/xcodebuild" -license accept
}
installAdditionalPackages() {
# should be called only for old High Sierra and Mojave
local XCODE_VERSION="$1"
find /Applications/Xcode_${XCODE_VERSION}.app/Contents/Resources/Packages/ -name '*.pkg' | xargs -I '{}' sudo installer -pkg '{}' -target / -allowUntrusted
}
runFirstLaunch() {
local XCODE_VERSION="$1"
sudo "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer/usr/bin/xcodebuild" -runFirstLaunch
}
setXcodeDeveloperDirVariables() {
stable_xcode_versions=$(get_xcode_list_from_toolset | tr " " "\n" | grep -v "beta")
major_versions=($(echo ${stable_xcode_versions[@]} | tr " " "\n" | cut -d '.' -f 1 | uniq))
for MAJOR_VERSION in "${major_versions[@]}"
do
LATEST_STABLE_VERSION=$(echo "${stable_xcode_versions[*]}" | grep "${MAJOR_VERSION}" | tail -n 1)
echo "export XCODE_${MAJOR_VERSION}_DEVELOPER_DIR=/Applications/Xcode_${LATEST_STABLE_VERSION}.app/Contents/Developer" >> "$HOME/.bashrc"
done
}
extractXcodeXip() {
local WORKING_DIR="$1"
local XCODE_VERSION="$2"
XCODE_XIP="${WORKING_DIR}/Xcode_${XCODE_VERSION// /_}.xip"
echo "XCODE_XIP = $XCODE_XIP"
open -W $XCODE_XIP
if [[ -d "${WORKING_DIR}/Xcode-beta.app" ]]; then
mv -f "${WORKING_DIR}/Xcode-beta.app" "${WORKING_DIR}/Xcode.app"
fi
if [[ ! -d "${WORKING_DIR}/Xcode.app" ]]; then
echo "'Xcode.app' doesn't exist after Xcode XIP extraction"
exit 1
fi
}
createBetaSymlink() {
local XCODE_VERSION=$1
if [[ $XCODE_VERSION =~ 1[01].* ]] || [[ $XCODE_VERSION == "12" ]] || [[ $XCODE_VERSION == "12_beta" ]]; then
ln -sf "/Applications/Xcode_${XCODE_VERSION}.app" "/Applications/Xcode_${XCODE_VERSION}_beta.app"
fi
}

View File

@@ -0,0 +1,166 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion
function Split-TableRowByColumns {
param(
[string] $Row
)
return $Row.Split("|") | ForEach-Object { $_.trim() }
}
function Build-AndroidTableObject {
param(
[string] $PackageName,
[string] $Description
)
return [PSCustomObject] @{
"Package Name" = $PackageName
"Description" = $Description
}
}
function Get-AndroidSDKRoot {
return Join-Path $env:HOME "Library" "Android" "sdk"
}
function Get-AndroidSDKManagerPath {
$androidSDKDir = Get-AndroidSDKRoot
return Join-Path $androidSDKDir "tools" "bin" "sdkmanager"
}
function Get-AndroidInstalledPackages {
$androidSDKManagerPath = Get-AndroidSDKManagerPath
$androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list --include_obsolete"
$androidInstalledPackages = @()
foreach($packageInfo in $androidSDKManagerList) {
if($packageInfo -Match "Available Packages:") {
break
}
$androidInstalledPackages += $packageInfo
}
return $androidInstalledPackages
}
function Build-AndroidSDKToolsTable {
param (
[Parameter(Mandatory)]
[object] $packageInfo
)
return $packageInfo | ForEach-Object {
$packageInfoParts = Split-TableRowByColumns $_
$packageName = $packageInfoParts[0]
$packageDescription = $packageInfoParts[2] + ", Revision " + $packageInfoParts[1]
return Build-AndroidTableObject -PackageName $packageName -Description $packageDescription
}
}
function Build-AndroidSDKPlatformTable {
param (
[Parameter(Mandatory)]
[object] $packageInfo
)
return $packageInfo | ForEach-Object {
$packageInfoParts = Split-TableRowByColumns $_
$packageName = $packageInfoParts[0].split(";")[1]
$packageDescription = $packageInfoParts[2] + ", Revision " + $packageInfoParts[1]
return Build-AndroidTableObject -PackageName $packageName -Description $packageDescription
}
}
function Build-AndroidSDKBuildToolsTable {
param (
[Parameter(Mandatory)]
[object] $packageInfo
)
return $packageInfo | ForEach-Object {
$packageInfoParts = Split-TableRowByColumns $_
$packageName = $packageInfoParts[0].replace(";", "-")
$packageDescription = "Android SDK Build-Tools, Revision " + $packageInfoParts[1]
return Build-AndroidTableObject -PackageName $packageName -Description $packageDescription
}
}
function Build-AndroidNDKTable {
param (
[Parameter(Mandatory)][AllowEmptyString()]
[string[]] $installedPackages
)
$ndkInfo = @()
if ($os.IsLessThanBigSur) {
$ndkInfo += [PSCustomObject] @{
# Hardcode NDK 15 as a separate case since it is installed manually without sdk-manager (to none default location)
"Version" = "15.2.4203891"
"Path" = Join-Path (Get-AndroidSDKRoot) "android-ndk-r15c"
}
$ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk"
$ndkInfo += Get-ChildItem -Path $ndkFolderPath | ForEach-Object {
return [PSCustomObject] @{
"Version" = $_.Name
"Path" = $_.FullName
}
}
}
$ndkBundleInfo = $installedPackages | Where-Object { $_ -Match "ndk-bundle" } | Select-Object -First 1
$ndkBundleVersion = (Split-TableRowByColumns $ndkBundleInfo)[1]
$ndkInfo += [PSCustomObject] @{
"Version" = $ndkBundleVersion
"Path" = Join-Path (Get-AndroidSDKRoot) "ndk-bundle"
}
$ndkInfo | ForEach-Object {
$_.Path = $_.Path.Replace($env:HOME, '$HOME')
}
return $ndkInfo
}
function Build-AndroidUtilsTable {
param (
[Parameter(Mandatory)][AllowEmptyString()]
[string[]] $installedPackages
)
$utilsList = @("cmake", "Android Emulator")
return $utilsList | ForEach-Object {
$packageName = $_
$packageInfo = $installedPackages | Where-Object { $_ -Match $packageName } | Select-Object -First 1
$packageInfoParts = Split-TableRowByColumns $packageInfo
return [PSCustomObject] @{
"Package Name" = $packageName
"Version" = $packageInfoParts[1]
}
}
}
function Build-AndroidExtraPackagesTable {
param (
[Parameter(Mandatory)][AllowEmptyString()]
[string[]] $installedPackages
)
$extraPackages = @(
"Android Support Repository",
"Google Play services",
"Google Repository",
"Hardware_Accelerated_Execution_Manager"
)
return $extraPackages | ForEach-Object {
$packageId = $_
$packageInfo = $installedPackages | Where-Object { $_ -Like "*${packageId}*" } | Select-Object -First 1
$packageInfoParts = Split-TableRowByColumns $packageInfo
return [PSCustomObject] @{
"Package Name" = $packageInfoParts[2]
"Version" = $packageInfoParts[1]
}
}
}

View File

@@ -0,0 +1,52 @@
function Get-BrowserSection {
return New-MDList -Style Unordered -Lines @(
(Get-SafariVersion),
(Get-SafariDriverVersion),
(Get-ChromeVersion),
(Get-ChromeDriverVersion),
(Get-EdgeVersion),
(Get-EdgeDriverVersion),
(Get-FirefoxVersion),
(Get-GeckodriverVersion)
)
}
function Get-SafariVersion {
$version = Run-Command "defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString"
$build = Run-Command "defaults read /Applications/Safari.app/Contents/Info CFBundleVersion"
"Safari $version ($build)"
}
function Get-SafariDriverVersion {
$version = Run-Command "safaridriver --version" | Take-Part -Part 3,4
"SafariDriver $version"
}
function Get-ChromeVersion {
$chromePath = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
return Run-Command "'${chromePath}' --version"
}
function Get-ChromeDriverVersion {
$rawOutput = Run-Command "chromedriver --version"
$version = $rawOutput | Take-Part -Part 1
return "ChromeDriver ${version}"
}
function Get-EdgeVersion {
$edgePath = "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
return Run-Command "'${edgePath}' --version"
}
function Get-EdgeDriverVersion {
return Run-Command "msedgedriver --version" | Take-Part -Part 0,1
}
function Get-FirefoxVersion {
$firefoxPath = "/Applications/Firefox.app/Contents/MacOS/firefox"
return Run-Command "'${firefoxPath}' --version"
}
function Get-GeckodriverVersion {
return Run-Command "geckodriver --version" | Select-Object -First 1
}

View File

@@ -0,0 +1,117 @@
Import-Module "$PSScriptRoot/../helpers/SoftwareReport.Helpers.psm1" -DisableNameChecking
function Get-DotnetVersionList {
$sdkRawList = Run-Command "dotnet --list-sdks"
$sdkVersionList = $sdkRawList | ForEach-Object { Take-Part $_ -Part 0 }
return ".NET SDK " + [string]::Join(" ", $sdkVersionList)
}
function Get-GoVersion {
$goOutput = Run-Command "go version" | Take-Part -Part 2
if ($goOutput.StartsWith("go")) {
$goOutput = $goOutput.Substring(2)
}
return $goOutput
}
function Get-RVersion {
$rVersion = Run-Command "R --version | grep 'R version'" | Take-Part -Part 2
return "R $rVersion"
}
function Get-RustVersion {
$rustVersion = Run-Command "rustc --version" | Take-Part -Part 1
return "${rustVersion}"
}
function Get-Bindgen {
$bindgenVersion = Run-Command "bindgen --version" | Take-Part -Part 1
return "Bindgen $bindgenVersion"
}
function Get-Cbindgen {
$cbindgenVersion = Run-Command "cbindgen --version" | Take-Part -Part 1
return "Cbindgen $cbindgenVersion"
}
function Get-Cargooutdated {
$cargoOutdatedVersion = Run-Command "cargo outdated --version" | Take-Part -Part 1
return "Cargo-outdated $cargoOutdatedVersion"
}
function Get-Cargoaudit {
$cargoAuditVersion = Run-Command "cargo audit --version" | Take-Part -Part 1
return "Cargo-audit $cargoAuditVersion"
}
function Get-RustupVersion {
$rustupVersion = Run-Command "rustup --version" | Take-Part -Part 1
return "Rustup ${rustupVersion}"
}
function Get-VcpkgVersion {
$vcpkgVersion = Run-Command "vcpkg version" | Select-Object -First 1 | Take-Part -Part 5 | Take-Part -Part 0 -Delimiter "-"
return "Vcpkg ${vcpkgVersion}"
}
function Get-GccVersion {
$versionList = @("8", "9")
$versionList | Foreach-Object {
$version = Run-Command "gcc-${_} --version" | Select-Object -First 1
"$version — available by ``gcc-${_}`` alias"
}
}
function Get-FortranVersion {
$versionList = @("8", "9")
$versionList | Foreach-Object {
$version = Run-Command "gfortran-${_} --version" | Select-Object -First 1
"$version — available by ``gfortran-${_}`` alias"
}
}
function Get-ClangLLVMVersion {
$clangLLVMVersion = Run-Command "$(brew --prefix llvm)/bin/clang --version" | Select-Object -First 1 | Take-Part -Part 2
"Clang/LLVM $clangLLVMVersion"
}
function Get-NVMVersion {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"
$nodejsVersion = Run-Command "${nvmInitCommand} && nvm --version"
return $nodejsVersion
}
function Get-PipVersion {
param (
[Parameter(Mandatory)][ValidateRange(2, 3)]
[int] $Version
)
$command = If ($Version -eq 2) { "pip --version" } Else { "pip3 --version" }
$commandOutput = Run-Command $command
$versionPart1 = $commandOutput | Take-Part -Part 1
$versionPart2 = $commandOutput | Take-Part -Part 4
$versionPart3 = $commandOutput | Take-Part -Part 5
return "${versionPart1} ${versionPart2} ${versionPart3}"
}
function Get-NVMNodeVersionList {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"
$nodejsVersionsRaw = Run-Command "${nvmInitCommand} && nvm ls"
$nodeVersions = $nodejsVersionsRaw | ForEach-Object { $_.TrimStart(" ").TrimEnd(" *") } | Where-Object { $_.StartsWith("v") }
return [string]::Join(" ", $nodeVersions)
}
function Build-OSInfoSection {
$fieldsToInclude = @("System Version:", "Kernel Version:")
$rawSystemInfo = Invoke-Expression "system_profiler SPSoftwareDataType"
$parsedSystemInfo = $rawSystemInfo | Where-Object { -not ($_ | Select-String -NotMatch $fieldsToInclude) } | ForEach-Object { $_.Trim() }
$output = ""
$parsedSystemInfo[0] -match "System Version: macOS (?<version>\d+\.\d+)" | Out-Null
$version = $Matches.Version
$output += New-MDHeader "macOS $version info" -Level 1
$output += New-MDList -Style Unordered -Lines $parsedSystemInfo -NoNewLine
return $output
}

View File

@@ -0,0 +1,361 @@
param (
[Parameter(Mandatory)][string]
$OutputDirectory,
$ImageName
)
Import-Module MarkdownPS
Import-Module "$PSScriptRoot/SoftwareReport.Common.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/SoftwareReport.Xcode.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/SoftwareReport.Android.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/SoftwareReport.Java.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/SoftwareReport.Xamarin.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/SoftwareReport.Toolcache.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/SoftwareReport.Browsers.psm1" -DisableNameChecking
Import-Module "$PSScriptRoot/../helpers/SoftwareReport.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1"
# Operating System info
$os = Get-OSVersion
# Language and Runtime
$nodejsVersion = Run-Command "node --version"
$nvmVersion = Get-NVMVersion
$nvmCachedVersions = Get-NVMNodeVersionList
$pythonVersion = Run-Command "python --version"
$python3Version = Run-Command "python3 --version"
$rubyVersion = Run-Command "ruby --version" | Take-Part -Part 1
$goVersion = Get-GoVersion
$phpVersion = Run-Command "php --version" | Select-Object -First 1 | Take-Part -Part 0,1
$juliaVersion = Run-Command "julia --version" | Take-Part -Part 0,2
$markdown = ""
# Get announcements
if ($env:ANNOUNCEMENTS) {
$markdown += $env:ANNOUNCEMENTS
$markdown += New-MDNewLine
$markdown += "***"
$markdown += New-MDNewLine
}
# OS info
$markdown += Build-OSInfoSection
$markdown += New-MDList -Style Unordered -Lines ("Image Version: {0}" -f $ImageName.Split('_')[1])
# Software report
$markdown += New-MDHeader "Installed Software" -Level 2
$markdown += New-MDHeader "Language and Runtime" -Level 3
if ( -not $os.IsHighSierra) {
$clangLLVMVersion = Get-ClangLLVMVersion
$gccVersion = Get-GccVersion
$gfortranVersion = Get-FortranVersion
$lines = @($clangLLVMVersion, $gccVersion, $gfortranVersion) | ForEach-Object {$_}
$markdown += New-MDList -Style Unordered -NoNewLine -Lines $lines
}
$markdown += New-MDList -Style Unordered -Lines @(
"Node.js ${nodejsVersion}"
"NVM ${nvmVersion}"
"NVM - Cached node versions: ${nvmCachedVersions}"
$pythonVersion,
$python3Version,
"Ruby ${rubyVersion}",
(Get-DotnetVersionList),
(Get-RVersion),
"Go ${goVersion}",
"$phpVersion",
"$juliaVersion"
)
# Package Management
$bundlerVersion = Run-Command "bundle --version"
$carthageVersion = Run-Command "carthage version" -SuppressStderr
$cocoaPodsVersion = Run-Command "pod --version"
$homebrewVersion = Run-Command "brew --version" | Select-Object -First 1
$npmVersion = Run-Command "npm --version"
$yarnVersion = Run-Command "yarn --version"
$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2
$pipVersion = Get-PipVersion -Version 2
$pip3Version = Get-PipVersion -Version 3
$condaVersion = Invoke-Expression "conda --version"
$rubyGemsVersion = Run-Command "gem --version"
$composerVersion = Run-Command "composer --version" | Take-Part -Part 2
$markdown += New-MDHeader "Package Management" -Level 3
if ($os.IsHigherThanMojave) {
$vcpkgVersion = Get-VcpkgVersion
$markdown += New-MDList -Lines $vcpkgVersion -Style Unordered -NoNewLine
}
$markdown += New-MDList -Style Unordered -Lines @(
$bundlerVersion,
"Carthage ${carthageVersion}",
"CocoaPods ${cocoaPodsVersion}",
$homebrewVersion,
"NPM ${npmVersion}",
"Yarn ${yarnVersion}",
"NuGet ${nugetVersion}",
"Pip ${pipVersion}",
"Pip ${pip3Version}",
"Mini${condaVersion}",
"RubyGems ${rubyGemsVersion}",
"Composer ${composerVersion}"
)
# Project Management
$mavenVersion = Run-Command "mvn -version" | Select-Object -First 1 | Take-Part -Part 2
#gradle output differs on the first launch a welcome message, that we don't need is rendered. The solution is to take the last "Gradle" occurrence from the output
$gradleVersion = (Run-Command "gradle --version" | Select-String "Gradle")[-1]
$apacheAnt = Run-Command "ant -version" | Take-Part -Part 0,1,3
$markdown += New-MDHeader "Project Management" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
"Apache Maven ${mavenVersion}",
$gradleVersion,
$apacheAnt
)
# Utilities
$curlVersion = Run-Command "curl --version" | Select-Object -First 1 | Take-Part -Part 1
$gitVersion = Run-Command "git --version" | Take-Part -Part 2
$ghVersion = Run-Command "gh --version" | Select-String "gh version" | Select-Object -First 1 | Take-Part -Part 2
$gitLFSVersion = Run-Command "git-lfs version" | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/"
$hubVersion = Run-Command "hub version | grep 'hub version'" | Take-Part -Part 2
$wgetVersion = Run-Command "wget --version" | Select-String "GNU Wget" | Take-Part -Part 2
$svnVersion = Run-Command "svn --version --quiet"
$parallelVersion = Run-Command "parallel --version" | Select-String "GNU parallel" | Select-Object -First 1
$jqVersion = Run-Command "jq --version" | Take-Part -Part 1 -Delimiter "-"
$opensslVersion = Get-Item /usr/local/opt/openssl | ForEach-Object {"{0} ``({1} -> {2})``" -f (Run-Command "openssl version"), $_.FullName, $_.Target}
$gpgVersion = Run-Command "gpg --version" | Select-String 'gpg (GnuPG)' -SimpleMatch
$postgresClientVersion = Run-Command "psql --version"
$postgresServerVersion = Run-Command "pg_config --version"
$aria2Version = Run-Command "aria2c --version" | Select-Object -First 1 | Take-Part -Part 2
$azcopyVersion = Run-Command "azcopy --version" | Take-Part -Part 2
$zstdVersion = Run-Command "zstd --version" | Take-Part -Part 1 -Delimiter "v" | Take-Part -Part 0 -Delimiter ","
$bazelVersion = Run-Command "bazel --version" | Take-Part -Part 0 -Delimiter "-"
$bazeliskVersion = Run-Command "bazelisk version" | Select-String "Bazelisk version:" | Take-Part -Part 1 -Delimiter ":"
$packerVersion = Run-Command "packer --version"
$helmVersion = Run-Command "helm version --short"
$vbox = Run-Command "vboxmanage -v"
$vagrant = Run-Command "vagrant -v"
$mongo = Run-Command "mongo --version" | Select-String "MongoDB shell version" | Take-Part -Part 3
$mongod = Run-Command "mongod --version" | Select-String "db version " | Take-Part -Part 2
$p7zip = Run-Command "7z i" | Select-String "7-Zip" | Take-Part -Part 0,2
$markdown += New-MDHeader "Utilities" -Level 3
$markdown += New-MDList -Style Unordered -NoNewLine -Lines @(
"Curl ${curlVersion}",
"Git: ${gitVersion}",
"Git LFS: ${gitLFSVersion}",
"GitHub CLI: ${ghVersion}",
"Hub CLI: ${hubVersion}",
"GNU Wget ${wgetVersion}",
"Subversion (SVN) ${svnVersion}",
"Packer $packerVersion",
$parallelVersion,
$opensslVersion,
"jq ${jqVersion}",
$gpgVersion,
$postgresClientVersion,
$postgresServerVersion,
"aria2 $aria2Version",
"azcopy $azcopyVersion",
"zstd $zstdVersion",
$bazelVersion,
"bazelisk $($bazeliskVersion.Trim())",
"helm $helmVersion",
"virtualbox $vbox",
"mongo $mongo",
"mongod $mongod",
"$vagrant",
$p7zip
)
if ($os.IsHigherThanMojave) {
$newmanVersion = Run-Command "newman --version"
$markdown += New-MDList -Lines "Newman $newmanVersion" -Style Unordered
}
$markdown += New-MDNewLine
# Tools
$fastlaneVersion = Run-Command "fastlane --version" | Select-String "^fastlane [0-9]" | Take-Part -Part 1
$cmakeVersion = Run-Command "cmake --version" | Select-Object -First 1 | Take-Part -Part 2
$appcenterCLIVersion = Run-Command "appcenter --version" | Take-Part -Part 2
$azureCLIVersion = Run-Command "az -v" | Select-String "^azure-cli" | Take-Part -Part 1
$awsVersion = Run-Command "aws --version" | Take-Part -Part 0 | Take-Part -Delimiter "/" -Part 1
$aliyunVersion = Run-Command "aliyun --version" | Select-String "Alibaba Cloud Command Line Interface Version " | Take-Part -Part 6
$awsSamVersion = Run-Command "sam --version" | Take-Part -Part 3
$awsSessionManagerVersion = Run-Command "session-manager-plugin --version"
$ghcUpVersion = Run-Command "ghcup --version" | Take-Part -Part 5
$ghcVersion = Run-Command "ghc --version" | Take-Part -Part 7
$cabalVersion = Run-Command "cabal --version" | Take-Part -Part 3
$stackVersion = Run-Command "stack --version" | Take-Part -Part 1 | ForEach-Object {$_.replace(",","")}
$markdown += New-MDHeader "Tools" -Level 3
$markdown += New-MDList -Style Unordered -NoNewLine -Lines @(
"Fastlane ${fastlaneVersion}",
"Cmake ${cmakeVersion}",
"App Center CLI ${appcenterCLIVersion}",
"Azure CLI ${azureCLIVersion}",
"AWS CLI ${awsVersion}",
"AWS SAM CLI ${awsSamVersion}",
"AWS Session Manager CLI ${awsSessionManagerVersion}",
"Aliyun CLI ${aliyunVersion}"
)
if( -not $os.IsHighSierra) {
$markdown += New-MDList -Style Unordered -Lines @(
"GHCup ${ghcUpVersion}",
"GHC ${ghcVersion}",
"Cabal ${cabalVersion}",
"Stack ${stackVersion}"
)
}
# Linters
$markdown += New-MDHeader "Linters" -Level 3
$yamllintVersion = Run-Command "yamllint --version"
$markdown += New-MDList -Style Unordered -NoNewLine -Lines @(
$yamllintVersion
)
if ( -not $os.IsHighSierra) {
$swiftlintVersion = Run-Command "swiftlint version"
$markdown += New-MDList -Style Unordered -Lines @(
"SwiftLint ${swiftlintVersion}"
)
}
$markdown += New-MDHeader "Browsers" -Level 3
$markdown += Get-BrowserSection
$markdown += New-MDHeader "Java" -Level 3
$markdown += Get-JavaVersions | New-MDTable
# Toolcache
$markdown += Build-ToolcacheSection
if ( -not $os.IsHighSierra) {
$rustVersion = Get-RustVersion
$markdown += New-MDHeader "Rust Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
"Rust $rustVersion",
(Get-RustupVersion)
)
$markdown += New-MDHeader "Packages" -Level 4
$markdown += New-MDList -Style Unordered -Lines @(
(Get-Bindgen),
(Get-Cbindgen),
(Get-Cargooutdated),
(Get-Cargoaudit)
)
}
$markdown += New-MDHeader "PowerShell Tools" -Level 3
$powershellVersion = Run-Command "powershell --version"
$markdown += New-MDList -Lines $powershellVersion -Style Unordered
$markdown += New-MDHeader "PowerShell Modules" -Level 4
$markdown += Get-PowerShellModules | New-MDTable
$markdown += New-MDNewLine
# Xamarin section
$markdown += New-MDHeader "Xamarin" -Level 3
$markdown += New-MDHeader "Visual Studio for Mac" -Level 4
$markdown += New-MDList -Lines @(Get-VSMacVersion) -Style Unordered
$markdown += New-MDHeader "Mono" -Level 4
$markdown += New-MDList -Lines (Build-MonoList) -Style Unordered
$markdown += New-MDHeader "Xamarin.iOS" -Level 4
$markdown += New-MDList -Lines (Build-XamarinIOSList) -Style Unordered
$markdown += New-MDHeader "Xamarin.Mac" -Level 4
$markdown += New-MDList -Lines (Build-XamarinMacList) -Style Unordered
$markdown += New-MDHeader "Xamarin.Android" -Level 4
$markdown += New-MDList -Lines (Build-XamarinAndroidList) -Style Unordered
$markdown += New-MDHeader "Unit Test Framework" -Level 4
$markdown += New-MDList -Lines @(Get-NUnitVersion) -Style Unordered
# Xcode section
$xcodeInfo = Get-XcodeInfoList
$markdown += New-MDHeader "Xcode" -Level 3
$markdown += Build-XcodeTable $xcodeInfo | New-MDTable
$markdown += New-MDNewLine
$markdown += Build-XcodeSupportToolsSection
$markdown += New-MDHeader "Installed SDKs" -Level 4
$markdown += Build-XcodeSDKTable $xcodeInfo | New-MDTable
$markdown += New-MDNewLine
# Disable simulators table on 11.0 beta for now since "simctl" tool doesn't work properly
if (-not $os.IsBigSur) {
$markdown += New-MDHeader "Installed Simulators" -Level 4
$markdown += Build-XcodeSimulatorsTable $xcodeInfo | New-MDTable
$markdown += New-MDNewLine
}
# Android section
$markdown += New-MDHeader "Android" -Level 3
$androidInstalledPackages = Get-AndroidInstalledPackages
$markdown += New-MDHeader "Android SDK Tools" -Level 4
$androidSDKTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Tools" }
$markdown += Build-AndroidSDKToolsTable $androidSDKTools | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Android SDK Platform-Tools" -Level 4
$androidSDKPlatformTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Platform-Tools" }
$markdown += Build-AndroidSDKToolsTable $androidSDKPlatformTools | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Android SDK Platforms" -Level 4
$androidSDKPlatforms = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Platform " }
$markdown += Build-AndroidSDKPlatformTable $androidSDKPlatforms | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Android SDK Build-Tools" -Level 4
$androidSDKBuildTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Build-Tools" }
$markdown += Build-AndroidSDKBuildtoolsTable $androidSDKBuildTools | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Android NDKs" -Level 4
$markdown += Build-AndroidNDKTable $androidInstalledPackages | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Android Utils" -Level 4
$markdown += Build-AndroidUtilsTable $androidInstalledPackages | New-MDTable
$markdown += New-MDNewLine
$androidGoogleAPIsTable = $androidInstalledPackages | Where-Object { $_ -Match "Google APIs" }
if ($androidGoogleAPIsTable.Count -gt 0) {
$markdown += New-MDHeader "Android Google APIs" -Level 4
$markdown += Build-AndroidSDKPlatformTable $androidGoogleAPIsTable | New-MDTable
$markdown += New-MDNewLine
}
$markdown += New-MDHeader "Extra Packages" -Level 4
$markdown += Build-AndroidExtraPackagesTable $androidInstalledPackages | New-MDTable
$markdown += New-MDNewLine
#
# Generate systeminfo.txt with information about image (for debug purpose)
#
$dateTime = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
$systemInfo = [string]::Join([System.Environment]::NewLine, @(
"Date: ${dateTime}",
"Image name: ${ImageName}"
))
if (-not (Test-Path $OutputDirectory)) { New-Item -Path $OutputDirectory -ItemType Directory | Out-Null }
#
# Write final reports
#
Write-Host $markdownExtended
$systemInfo | Out-File -FilePath "${OutputDirectory}/systeminfo.txt" -Encoding UTF8NoBOM
$markdown | Out-File -FilePath "${OutputDirectory}/systeminfo.md" -Encoding UTF8NoBOM

View File

@@ -0,0 +1,30 @@
function Get-JavaFullVersion {
param($JavaRootPath)
$javaBinPath = Join-Path $javaRootPath "/bin/java"
$javaVersionOutput = (Get-CommandResult "$javaBinPath -version").Output
$matchResult = $javaVersionOutput | Select-String '^openjdk version \"([\d\._]+)\"'
return $matchResult.Matches.Groups[1].Value
}
function Get-JavaVersions {
$defaultJavaPath = Get-Item env:JAVA_HOME
$javaVersions = Get-Item env:JAVA_HOME_*_X64
$sortRules = @{
Expression = { [Int32]$_.Name.Split("_")[2] }
Descending = $false
}
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
$javaPath = $_.Value
$version = Get-JavaFullVersion $javaPath
$vendor = $version.StartsWith("1.7") ? "Zulu" : "AdoptOpenJDK"
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
[PSCustomObject] @{
"Version" = $version + $defaultPostfix
"Vendor" = $vendor
"Environment Variable" = $_.Name
}
}
}

View File

@@ -0,0 +1,72 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion
function Get-ToolcacheRubyVersions {
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Ruby"
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Get-ToolcachePythonVersions {
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Python"
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Get-ToolcachePyPyVersions {
$toolcachePath = Join-Path $env:HOME "hostedtoolcache/PyPy/*/x64"
Get-ChildItem -Path $toolcachePath | Sort-Object { [Version] $_.Parent.Name } | ForEach-Object {
$foundVersionPath = $_.FullName
$foundVersionName = (Get-Item ($foundVersionPath -replace "x64") | Sort-Object -Property {[version]$_.name} -Descending | Select-Object -First 1).name
$arrPyPyVersion = ((& "$foundVersionPath/bin/python" -c "import sys;print(sys.version.split('\n')[1])") -split " ")
$pypyVersion = "$($arrPyPyVersion[0]) $($arrPyPyVersion[1])"
return "{0} {1}]" -f $foundVersionName, $pypyVersion
}
}
function Get-ToolcacheNodeVersions {
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Node"
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Get-ToolcacheGoVersions {
$toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Go"
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Build-ToolcacheSection {
$output = ""
$output += New-MDHeader "Cached Tools" -Level 3
$output += New-MDHeader "Ruby" -Level 4
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered
$output += New-MDHeader "Python" -Level 4
$output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered
if ($os.IsLessThanBigSur) {
$output += New-MDHeader "PyPy" -Level 4
$output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered
}
if( -not $os.IsHighSierra) {
$output += New-MDHeader "Node.js" -Level 4
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered
$output += New-MDHeader "Go" -Level 4
$output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered
}
return $output
}
function Get-PowerShellModules {
$modules = (Get-ToolsetValue powershellModules).name
$psModules = Get-Module -Name $modules -ListAvailable | Sort-Object Name | Group-Object Name
$psModules | ForEach-Object {
$moduleName = $_.Name
$moduleVersions = ($_.group.Version | Sort-Object -Unique) -join '<br>'
[PSCustomObject]@{
Module = $moduleName
Version = $moduleVersions
}
}
}

View File

@@ -0,0 +1,78 @@
$sortRulesByVersion = @{
Expression = { [System.Version]::Parse($_) }
Descending = $true
}
function Get-VSMacVersion {
$plistPath = "/Applications/Visual Studio.app/Contents/Info.plist"
return Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'"
}
function Get-NUnitVersion {
$version = Run-Command "nunit3-console --version" | Select-Object -First 1 | Take-Part -Part 3
return "NUnit ${version}"
}
function Build-MonoList {
$monoVersionsPath = "/Library/Frameworks/Mono.framework/Versions"
$monoFolders = Get-ChildItemWithoutSymlinks $monoVersionsPath
$monoVersionList = $monoFolders | ForEach-Object {
$versionFilePath = Join-Path $_.FullName "Version"
if (Test-Path $versionFilePath) {
return Get-Content -Raw $versionFilePath
}
return $_.Name
} | ForEach-Object { $_.Trim() }
return $monoVersionList | Sort-Object -Property $sortRulesByVersion
}
function Build-XamarinIOSList {
$sdkVersionsPath = "/Library/Frameworks/Xamarin.iOS.framework/Versions"
$sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath
$sdkVersionList = $sdkFolders | ForEach-Object {
$versionFilePath = Join-Path $_.FullName "Version"
if (Test-Path $versionFilePath) {
return Get-Content -Raw $versionFilePath
}
return $_.Name
} | ForEach-Object { $_.Trim() }
return $sdkVersionList | Sort-Object -Property $sortRulesByVersion
}
function Build-XamarinMacList {
$sdkVersionsPath = "/Library/Frameworks/Xamarin.Mac.framework/Versions"
$sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath
$sdkVersionList = $sdkFolders | ForEach-Object {
$versionFilePath = Join-Path $_.FullName "Version"
if (Test-Path $versionFilePath) {
return Get-Content -Raw $versionFilePath
}
return $_.Name
} | ForEach-Object { $_.Trim() }
return $sdkVersionList | Sort-Object -Property $sortRulesByVersion
}
function Build-XamarinAndroidList {
$sdkVersionsPath = "/Library/Frameworks/Xamarin.Android.framework/Versions"
$sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath
$sdkVersionList = $sdkFolders | ForEach-Object {
$versionFilePath = Join-Path $_.FullName "Version"
if (Test-Path $versionFilePath) {
return Get-Content -Raw $versionFilePath
}
return $_.Name
} | ForEach-Object { $_.Trim() }
return $sdkVersionList | Sort-Object -Property $sortRulesByVersion
}

View File

@@ -0,0 +1,236 @@
function Get-XcodePaths {
$xcodePaths = Get-ChildItemWithoutSymlinks "/Applications" -Filter "Xcode_*.app"
return $xcodePaths | Select-Object -ExpandProperty Fullname
}
function Get-XcodeVersionInfo {
[string]$output = Invoke-Expression "xcodebuild -version"
$versionOutputParts = $output.Split(" ")
return @{
Version = [System.Version]::Parse($versionOutputParts[1])
Build = $versionOutputParts[4]
}
}
function Get-XcodeSDKList {
$versionInfo = Get-XcodeVersionInfo
if ($versionInfo.Version -le [System.Version]::Parse("9.4.1")) {
$output = Invoke-Expression "xcodebuild -showsdks"
$sdkList = $output | Where-Object { $_ -Match "-sdk" }
return $sdkList | ForEach-Object {
$displayName, $canonicalName = $_.Split("-sdk")
return @{
canonicalName = $canonicalName.Trim()
displayName = $displayName.Trim()
}
}
}
[string]$output = Invoke-Expression "xcodebuild -showsdks -json"
return $output | ConvertFrom-Json
}
function Get-XcodeInfoList {
$defaultXcodeRootPath = Get-DefaultXcodeRootPath
$xcodeInfo = @{}
Get-XcodePaths | ForEach-Object {
$xcodeRootPath = $_
Switch-Xcode -XcodeRootPath $xcodeRootPath
$versionInfo = Get-XcodeVersionInfo
$versionInfo.Path = $xcodeRootPath
$versionInfo.IsDefault = ($xcodeRootPath -eq $defaultXcodeRootPath)
$xcodeInfo.Add($versionInfo.Version.ToString(), [PSCustomObject] @{
VersionInfo = $versionInfo
SDKInfo = Get-XcodeSDKList
SimulatorsInfo = Get-XcodeSimulatorsInfo
})
}
Switch-Xcode -XcodeRootPath $defaultXcodeRootPath
return $xcodeInfo
}
function Get-XcodePlatformOrder {
param (
[Parameter(Mandatory)]
[string] $PlatformName
)
Switch ($PlatformName) {
"macOS" { 1 }
"iOS" { 2 }
"Simulator - iOS" { 3 }
"tvOS" { 4 }
"Simulator - tvOS" { 5 }
"watchOS" { 6 }
"Simulator - watchOS" { 7 }
Default { 100 }
}
}
function Build-XcodeTable {
param (
[Parameter(Mandatory)]
[hashtable] $xcodeInfo
)
$sortRules = @{
Expression = { $_.Version }
Descending = $true
}
$xcodeList = $xcodeInfo.Values | ForEach-Object { $_.VersionInfo } | Sort-Object $sortRules
return $xcodeList | ForEach-Object {
$defaultPostfix = If ($_.IsDefault) { " (default)" } else { "" }
return [PSCustomObject] @{
"Version" = $_.Version.ToString() + $betaPostfix + $defaultPostfix
"Build" = $_.Build
"Path" = $_.Path
}
}
}
function Get-XcodeDevicesList {
param (
[Parameter(Mandatory)][object] $XcodeInfo,
[Parameter(Mandatory)][object] $Runtime
)
$runtimeId = $Runtime.identifier
$runtimeName = $Runtime.name
$output = $XcodeInfo.SimulatorsInfo.devices.$runtimeId
if ($null -eq $output) {
$output = $XcodeInfo.SimulatorsInfo.devices.$runtimeName
}
return $output
}
function Build-XcodeSDKTable {
param (
[Parameter(Mandatory)]
[hashtable] $xcodeInfo
)
$sdkNames = @()
$xcodeInfo.Values | ForEach-Object {
$_.SDKInfo | ForEach-Object {
$sdkNames += $_.canonicalName
}
}
$sdkNames = $sdkNames | Select-Object -Unique
return $sdkNames | ForEach-Object {
$sdkName = $_
$sdkDisplayName = ""
$xcodeList = @()
$xcodeInfo.Values | ForEach-Object {
$sdk = $_.SDKInfo | Where-Object { $_.canonicalName -eq $sdkName } | Select-Object -First 1
if ($sdk) {
$sdkDisplayName = $sdk.displayName
$xcodeList += $_.VersionInfo.Version
}
}
$xcodeList = $xcodeList | Sort-Object
return [PSCustomObject] @{
"SDK" = $sdkDisplayName
"SDK Name" = $sdkName
"Xcode Version" = [String]::Join(", ", $xcodeList)
}
} | Sort-Object {
# Sort rule 1
$sdkNameParts = $_."SDK".Split(" ")
$platformName = [String]::Join(" ", $sdkNameParts[0..($sdkNameParts.Length - 2)])
return Get-XcodePlatformOrder $platformName
}, {
# Sort rule 2
$sdkNameParts = $_."SDK".Split(" ")
return [System.Version]::Parse($sdkNameParts[-1])
}
}
function Format-XcodeSimulatorName {
param([Parameter(Mandatory)][string] $Device)
return $Device.Replace("ʀ", "R")
}
function Build-XcodeSimulatorsTable {
param (
[Parameter(Mandatory)]
[hashtable] $xcodeInfo
)
$runtimes = @()
$xcodeInfo.Values | ForEach-Object {
$_.SimulatorsInfo.runtimes | ForEach-Object {
$runtimes += $_
}
}
$runtimes = $runtimes | Sort-Object @{ Expression = { $_.identifier } } -Unique
return $runtimes | ForEach-Object {
$runtime = $_
$runtimeDevices = @()
$xcodeList = @()
$xcodeInfo.Values | ForEach-Object {
$runtimeFound = $_.SimulatorsInfo.runtimes | Where-Object { $_.identifier -eq $runtime.identifier } | Select-Object -First 1
if ($runtimeFound) {
$devicesToAdd = Get-XcodeDevicesList -XcodeInfo $_ -Runtime $runtimeFound
$runtimeDevices += $devicesToAdd | Select-Object -ExpandProperty name
$xcodeList += $_.VersionInfo.Version
}
}
$xcodeList = $xcodeList | Sort-Object
$runtimeDevices = $runtimeDevices | ForEach-Object { Format-XcodeSimulatorName $_ } | Select-Object -Unique
$sortedRuntimeDevices = $runtimeDevices | Sort-Object @{
Expression = { $_.Split(" ")[0] };
Descending = $true;
}, {
$_.Split(" ") | Select-Object -Skip 1 | Join-String -Separator " "
}
return [PSCustomObject] @{
"OS" = $runtime.name
"Xcode Version" = [String]::Join("<br>", $xcodeList)
"Simulators" = [String]::Join("<br>", $sortedRuntimeDevices)
}
} | Sort-Object {
# Sort rule 1
$sdkNameParts = $_."OS".Split(" ")
$platformName = [String]::Join(" ", $sdkNameParts[0..($sdkNameParts.Length - 2)])
return Get-XcodePlatformOrder $platformName
}, {
# Sort rule 2
$sdkNameParts = $_."OS".Split(" ")
return [System.Version]::Parse($sdkNameParts[-1])
}
}
function Build-XcodeSupportToolsSection {
$nomadCLI = Run-Command "gem -v nomad-cli"
$nomadIPA = Run-Command "ipa -version"
$xcpretty = Run-Command "xcpretty --version"
$xctool = Run-Command "xctool --version"
$xcversion = Run-Command "xcversion --version" | Select-String "^[0-9]"
$output = ""
$output += New-MDHeader "Xcode Support Tools" -Level 4
$output += New-MDList -Style Unordered -Lines @(
"Nomad CLI $nomadCLI",
"Nomad CLI IPA $nomadIPA",
"xcpretty $xcpretty",
"xctool $xctool",
"xcversion $xcversion"
)
return $output
}

View File

@@ -0,0 +1,211 @@
{
"variables": {
"vcenter_server": null,
"vcenter_username": null,
"vcenter_password": null,
"vcenter_datacenter": null,
"cluster_or_esxi_host": null,
"esxi_datastore": null,
"build_id": null,
"baseimage_name": null,
"output_folder": null,
"vm_username": null,
"vm_password": null,
"github_feed_token": null,
"xcode_install_user": null,
"xcode_install_password": null,
"image_os": "macos1013",
"announcements": "{{env `ANNOUNCEMENTS`}}"
},
"builders": [
{
"type": "vsphere-clone",
"vcenter_server": "{{user `vcenter_server`}}",
"username": "{{user `vcenter_username`}}",
"password": "{{user `vcenter_password`}}",
"insecure_connection": true,
"datacenter": "{{ user `vcenter_datacenter` }}",
"template": "{{ user `baseimage_name` }}",
"folder": "{{user `output_folder` }}",
"host": "{{user `cluster_or_esxi_host`}}",
"datastore": "{{user `esxi_datastore`}}",
"vm_name": "{{user `build_id`}}",
"ssh_username": "{{user `vm_username`}}",
"ssh_password": "{{user `vm_password`}}",
"CPUs": "10",
"RAM": "24576",
"NestedHV": "true",
"shutdown_timeout": "15m"
}
],
"provisioners": [
{
"type": "shell",
"inline": "mkdir ~/image-generation"
},
{
"type": "file",
"source": "./tests",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./software-report",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./helpers",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashrc",
"destination": "~/.bashrc"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashprofile",
"destination": "~/.bash_profile"
},
{
"type": "file",
"source": "./provision/utils",
"destination": "~/"
},
{
"type": "file",
"source": "./provision/bootstrap-provisioner",
"destination": "~/bootstrap"
},
{
"type": "file",
"source": "./toolsets/toolset-10.13.json",
"destination": "~/image-generation/toolset.json"
},
{
"type": "file",
"source": "./toolsets/toolcache-10.13.json",
"destination": "~/image-generation/toolcache.json"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/add-network-interface-detection.sh",
"./provision/configuration/autologin.sh",
"./provision/configuration/disable-auto-updates.sh",
"./provision/configuration/screensaver-off.sh",
"./provision/configuration/ntpconf.sh",
"./provision/configuration/max-files.sh"
],
"environment_vars": [
"PASSWORD={{user `vm_password`}}",
"USERNAME={{user `vm_username`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/preimagedata.sh",
"./provision/configuration/configure-ssh.sh",
"./provision/configuration/configure-machine.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `build_id`}}",
"IMAGE_OS={{user `image_os`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"pause_before": "30s",
"scripts": [
"./provision/core/homebrew.sh",
"./provision/core/dotnet.sh",
"./provision/core/python.sh",
"./provision/core/azcopy.sh",
"./provision/core/openssl.sh",
"./provision/core/ruby.sh",
"./provision/core/rubygem.sh",
"./provision/core/powershell.sh",
"./provision/core/git.sh",
"./provision/core/node.sh"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/core/xcode-tools.sh",
"./provision/core/xcode-sims.sh",
"./provision/core/build-xcode-symlinks.sh"
],
"environment_vars": [
"XCODE_INSTALL_USER={{user `xcode_install_user`}}",
"XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/core/commonutils.sh",
"./provision/core/openjdk.sh",
"./provision/core/php.sh",
"./provision/core/aws.sh",
"./provision/core/cocoapods.sh",
"./provision/core/android-toolsets.sh",
"./provision/core/xamarin.sh",
"./provision/core/xamarin-android-ndk.sh",
"./provision/core/vsmac.sh",
"./provision/core/nvm.sh",
"./provision/core/postgresql.sh",
"./provision/core/mongodb.sh",
"./provision/core/miniconda.sh",
"./provision/core/chrome.sh",
"./provision/core/edge.sh",
"./provision/core/firefox.sh",
"./provision/core/toolcache-high-sierra.sh",
"./provision/core/pypy.sh"
]
},
{
"type": "shell",
"inline": [
"pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}",
"pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\""
],
"environment_vars": [
"ANNOUNCEMENTS={{user `announcements`}}"
]
},
{
"type": "file",
"direction": "download",
"source": "~/image-generation/output/*",
"destination": "../image-output/"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/configure-hostname.sh",
"./provision/configuration/finalize-vm.sh"
]
}
]
}

View File

@@ -0,0 +1,231 @@
{
"variables": {
"vcenter_server": null,
"vcenter_username": null,
"vcenter_password": null,
"vcenter_datacenter": null,
"cluster_or_esxi_host": null,
"esxi_datastore": null,
"build_id": null,
"baseimage_name": null,
"output_folder": null,
"vm_username": null,
"vm_password": null,
"github_feed_token": null,
"xcode_install_user": null,
"xcode_install_password": null,
"image_os": "macos1014",
"announcements": "{{env `ANNOUNCEMENTS`}}"
},
"builders": [
{
"type": "vsphere-clone",
"vcenter_server": "{{user `vcenter_server`}}",
"username": "{{user `vcenter_username`}}",
"password": "{{user `vcenter_password`}}",
"insecure_connection": true,
"datacenter": "{{ user `vcenter_datacenter` }}",
"template": "{{ user `baseimage_name` }}",
"folder": "{{user `output_folder` }}",
"host": "{{user `cluster_or_esxi_host`}}",
"datastore": "{{user `esxi_datastore`}}",
"vm_name": "{{user `build_id`}}",
"ssh_username": "{{user `vm_username`}}",
"ssh_password": "{{user `vm_password`}}",
"CPUs": "4",
"RAM": "12288",
"NestedHV": "true",
"shutdown_timeout": "15m"
}
],
"provisioners": [
{
"type": "shell",
"inline": "mkdir ~/image-generation"
},
{
"type": "file",
"source": "./tests",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./software-report",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./helpers",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashrc",
"destination": "~/.bashrc"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashprofile",
"destination": "~/.bash_profile"
},
{
"type": "file",
"source": "./provision/utils",
"destination": "~/"
},
{
"type": "file",
"source": "./provision/bootstrap-provisioner",
"destination": "~/bootstrap"
},
{
"type": "file",
"source": "./toolsets/toolset-10.14.json",
"destination": "~/image-generation/toolset.json"
},
{
"type": "file",
"source": "./toolsets/toolcache-10.14.json",
"destination": "~/image-generation/toolcache.json"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/add-network-interface-detection.sh",
"./provision/configuration/autologin.sh",
"./provision/configuration/disable-auto-updates.sh",
"./provision/configuration/screensaver-off.sh",
"./provision/configuration/ntpconf.sh",
"./provision/configuration/max-files.sh"
],
"environment_vars": [
"PASSWORD={{user `vm_password`}}",
"USERNAME={{user `vm_username`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/preimagedata.sh",
"./provision/configuration/configure-ssh.sh",
"./provision/configuration/configure-machine.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `build_id`}}",
"IMAGE_OS={{user `image_os`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"pause_before": "30s",
"scripts": [
"./provision/core/homebrew.sh",
"./provision/core/dotnet.sh",
"./provision/core/python.sh",
"./provision/core/azcopy.sh",
"./provision/core/openssl.sh",
"./provision/core/ruby.sh",
"./provision/core/rubygem.sh",
"./provision/core/powershell.sh",
"./provision/core/git.sh",
"./provision/core/node.sh"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/core/xcode-tools.sh",
"./provision/core/xcode-sims.sh"
],
"environment_vars": [
"XCODE_INSTALL_USER={{user `xcode_install_user`}}",
"XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/core/commonutils.sh",
"./provision/core/openjdk.sh",
"./provision/core/php.sh",
"./provision/core/aws.sh",
"./provision/core/rust.sh",
"./provision/core/gcc.sh",
"./provision/core/haskell.sh",
"./provision/core/stack.sh",
"./provision/core/cocoapods.sh",
"./provision/core/android-toolsets.sh",
"./provision/core/xamarin.sh",
"./provision/core/xamarin-android-ndk.sh",
"./provision/core/vsmac.sh",
"./provision/core/nvm.sh",
"./provision/core/postgresql.sh",
"./provision/core/mongodb.sh",
"./provision/core/audiodevice.sh",
"./provision/core/chrome.sh",
"./provision/core/edge.sh",
"./provision/core/firefox.sh",
"./provision/core/miniconda.sh",
"./provision/core/xcode-postbuild.sh",
"./provision/core/toolcache.sh",
"./provision/core/pypy.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}",
"scripts": "./provision/core/toolset.ps1"
},
{
"type": "shell",
"execute_command": "ruby {{ .Path }}",
"scripts": [
"./provision/core/delete-duplicate-sims.rb"
]
},
{
"type": "shell",
"inline": [
"pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}",
"pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\""
],
"environment_vars": [
"ANNOUNCEMENTS={{user `announcements`}}"
]
},
{
"type": "file",
"direction": "download",
"source": "~/image-generation/output/*",
"destination": "../image-output/"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/configure-hostname.sh",
"./provision/configuration/finalize-vm.sh"
]
}
]
}

View File

@@ -0,0 +1,230 @@
{
"variables": {
"vcenter_server": null,
"vcenter_username": null,
"vcenter_password": null,
"vcenter_datacenter": null,
"cluster_or_esxi_host": null,
"esxi_datastore": null,
"build_id": null,
"baseimage_name": null,
"output_folder": null,
"vm_username": null,
"vm_password": null,
"github_feed_token": null,
"xcode_install_user": null,
"xcode_install_password": null,
"image_os": "macos1015",
"announcements": "{{env `ANNOUNCEMENTS`}}"
},
"builders": [
{
"type": "vsphere-clone",
"vcenter_server": "{{user `vcenter_server`}}",
"username": "{{user `vcenter_username`}}",
"password": "{{user `vcenter_password`}}",
"insecure_connection": true,
"datacenter": "{{ user `vcenter_datacenter` }}",
"template": "{{ user `baseimage_name` }}",
"folder": "{{user `output_folder` }}",
"host": "{{user `cluster_or_esxi_host`}}",
"datastore": "{{user `esxi_datastore`}}",
"vm_name": "{{user `build_id`}}",
"ssh_username": "{{user `vm_username`}}",
"ssh_password": "{{user `vm_password`}}",
"CPUs": "4",
"RAM": "12288",
"NestedHV": "true",
"shutdown_timeout": "15m"
}
],
"provisioners": [
{
"type": "shell",
"inline": "mkdir ~/image-generation"
},
{
"type": "file",
"source": "./tests",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./software-report",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./helpers",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashrc",
"destination": "~/.bashrc"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashprofile",
"destination": "~/.bash_profile"
},
{
"type": "file",
"source": "./provision/utils",
"destination": "~/"
},
{
"type": "file",
"source": "./provision/bootstrap-provisioner",
"destination": "~/bootstrap"
},
{
"type": "file",
"source": "./toolsets/toolset-10.15.json",
"destination": "~/image-generation/toolset.json"
},
{
"type": "file",
"source": "./toolsets/toolcache-10.14.json",
"destination": "~/image-generation/toolcache.json"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/add-network-interface-detection.sh",
"./provision/configuration/autologin.sh",
"./provision/configuration/disable-auto-updates.sh",
"./provision/configuration/screensaver-off.sh",
"./provision/configuration/ntpconf.sh",
"./provision/configuration/max-files.sh",
"./provision/configuration/shell-change.sh"
],
"environment_vars": [
"PASSWORD={{user `vm_password`}}",
"USERNAME={{user `vm_username`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/preimagedata.sh",
"./provision/configuration/configure-ssh.sh",
"./provision/configuration/configure-machine.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `build_id`}}",
"IMAGE_OS={{user `image_os`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"pause_before": "30s",
"scripts": [
"./provision/core/homebrew.sh",
"./provision/core/dotnet.sh",
"./provision/core/python.sh",
"./provision/core/azcopy.sh",
"./provision/core/openssl.sh",
"./provision/core/ruby.sh",
"./provision/core/rubygem.sh",
"./provision/core/powershell.sh",
"./provision/core/git.sh",
"./provision/core/node.sh"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"script": "./provision/core/xcode-tools.sh",
"environment_vars": [
"XCODE_INSTALL_USER={{user `xcode_install_user`}}",
"XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/core/commonutils.sh",
"./provision/core/openjdk.sh",
"./provision/core/php.sh",
"./provision/core/aws.sh",
"./provision/core/rust.sh",
"./provision/core/gcc.sh",
"./provision/core/haskell.sh",
"./provision/core/stack.sh",
"./provision/core/cocoapods.sh",
"./provision/core/android-toolsets.sh",
"./provision/core/xamarin.sh",
"./provision/core/xamarin-android-ndk.sh",
"./provision/core/vsmac.sh",
"./provision/core/nvm.sh",
"./provision/core/postgresql.sh",
"./provision/core/mongodb.sh",
"./provision/core/audiodevice.sh",
"./provision/core/vcpkg.sh",
"./provision/core/miniconda.sh",
"./provision/core/chrome.sh",
"./provision/core/edge.sh",
"./provision/core/firefox.sh",
"./provision/core/xcode-postbuild.sh",
"./provision/core/toolcache.sh",
"./provision/core/pypy.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}",
"scripts": "./provision/core/toolset.ps1"
},
{
"type": "shell",
"execute_command": "ruby {{ .Path }}",
"scripts": [
"./provision/core/delete-duplicate-sims.rb"
]
},
{
"type": "shell",
"inline": [
"pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}",
"pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\""
],
"environment_vars": [
"ANNOUNCEMENTS={{user `announcements`}}"
]
},
{
"type": "file",
"direction": "download",
"source": "~/image-generation/output/*",
"destination": "../image-output/"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/configure-hostname.sh",
"./provision/configuration/finalize-vm.sh"
]
}
]
}

View File

@@ -0,0 +1,226 @@
{
"variables": {
"vcenter_server": null,
"vcenter_username": null,
"vcenter_password": null,
"vcenter_datacenter": null,
"cluster_or_esxi_host": null,
"esxi_datastore": null,
"build_id": null,
"baseimage_name": null,
"output_folder": null,
"vm_username": null,
"vm_password": null,
"github_feed_token": null,
"xcode_install_user": null,
"xcode_install_password": null,
"image_os": "macos11",
"announcements": "{{env `ANNOUNCEMENTS`}}"
},
"builders": [
{
"type": "vsphere-clone",
"vcenter_server": "{{user `vcenter_server`}}",
"username": "{{user `vcenter_username`}}",
"password": "{{user `vcenter_password`}}",
"insecure_connection": true,
"datacenter": "{{ user `vcenter_datacenter` }}",
"template": "{{ user `baseimage_name` }}",
"folder": "{{user `output_folder` }}",
"host": "{{user `cluster_or_esxi_host`}}",
"datastore": "{{user `esxi_datastore`}}",
"vm_name": "{{user `build_id`}}",
"ssh_username": "{{user `vm_username`}}",
"ssh_password": "{{user `vm_password`}}",
"CPUs": "4",
"RAM": "12288",
"NestedHV": "true",
"shutdown_timeout": "15m"
}
],
"provisioners": [
{
"type": "shell",
"inline": "mkdir ~/image-generation"
},
{
"type": "file",
"source": "./tests",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./software-report",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./helpers",
"destination": "~/image-generation/"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashrc",
"destination": "~/.bashrc"
},
{
"type": "file",
"source": "./provision/configuration/environment/bashprofile",
"destination": "~/.bash_profile"
},
{
"type": "file",
"source": "./provision/utils",
"destination": "~/"
},
{
"type": "file",
"source": "./provision/bootstrap-provisioner",
"destination": "~/bootstrap"
},
{
"type": "file",
"source": "./toolsets/toolset-11.0.json",
"destination": "~/image-generation/toolset.json"
},
{
"type": "file",
"source": "./toolsets/toolcache-11.0.json",
"destination": "~/image-generation/toolcache.json"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/add-network-interface-detection.sh",
"./provision/configuration/autologin.sh",
"./provision/configuration/disable-auto-updates.sh",
"./provision/configuration/screensaver-off.sh",
"./provision/configuration/ntpconf.sh",
"./provision/configuration/max-files.sh",
"./provision/configuration/shell-change.sh"
],
"environment_vars": [
"PASSWORD={{user `vm_password`}}",
"USERNAME={{user `vm_username`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/preimagedata.sh",
"./provision/configuration/configure-ssh.sh",
"./provision/configuration/configure-machine.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `build_id`}}",
"IMAGE_OS={{user `image_os`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"pause_before": "30s",
"scripts": [
"./provision/core/homebrew.sh",
"./provision/core/dotnet.sh",
"./provision/core/python.sh",
"./provision/core/azcopy.sh",
"./provision/core/openssl.sh",
"./provision/core/ruby.sh",
"./provision/core/rubygem.sh",
"./provision/core/powershell.sh",
"./provision/core/git.sh",
"./provision/core/node.sh"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"script": "./provision/core/xcode-tools.sh",
"environment_vars": [
"XCODE_INSTALL_USER={{user `xcode_install_user`}}",
"XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}",
"script": "./provision/core/reboot.sh",
"expect_disconnect": true
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/core/commonutils.sh",
"./provision/core/openjdk.sh",
"./provision/core/php.sh",
"./provision/core/aws.sh",
"./provision/core/rust.sh",
"./provision/core/gcc.sh",
"./provision/core/haskell.sh",
"./provision/core/stack.sh",
"./provision/core/cocoapods.sh",
"./provision/core/android-toolsets.sh",
"./provision/core/xamarin.sh",
"./provision/core/vsmac.sh",
"./provision/core/nvm.sh",
"./provision/core/postgresql.sh",
"./provision/core/mongodb.sh",
"./provision/core/vcpkg.sh",
"./provision/core/miniconda.sh",
"./provision/core/chrome.sh",
"./provision/core/edge.sh",
"./provision/core/firefox.sh",
"./provision/core/toolcache.sh"
],
"environment_vars": [
"GITHUB_FEED_TOKEN={{user `github_feed_token`}}"
]
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}",
"scripts": "./provision/core/toolset.ps1"
},
{
"type": "shell",
"execute_command": "ruby {{ .Path }}",
"scripts": [
"./provision/core/delete-duplicate-sims.rb"
]
},
{
"type": "shell",
"inline": [
"pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}",
"pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\""
],
"environment_vars": [
"ANNOUNCEMENTS={{user `announcements`}}"
]
},
{
"type": "file",
"direction": "download",
"source": "~/image-generation/output/*",
"destination": "../image-output/"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
"scripts": [
"./provision/configuration/configure-hostname.sh",
"./provision/configuration/finalize-vm.sh"
]
}
]
}

View File

@@ -0,0 +1,91 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$os = Get-OSVersion
Describe "Android" {
$androidNdkToolchains = @("mips64el-linux-android-4.9", "mipsel-linux-android-4.9")
$androidPackages = @(
"tools",
"platform-tools",
"tools/proguard",
"ndk-bundle",
"cmake",
(Get-ToolsetValue "android.platform-list" | ForEach-Object { "platforms/${_}" }),
(Get-ToolsetValue "android.build-tools" | ForEach-Object { "build-tools/${_}" }),
(Get-ToolsetValue "android.extra-list" | ForEach-Object { "extras/${_}" }),
(Get-ToolsetValue "android.addon-list" | ForEach-Object { "add-ons/${_}" })
) | ForEach-Object { $_ }
BeforeAll {
$ANDROID_SDK_DIR = Join-Path $env:HOME "Library" "Android" "sdk"
function Validate-AndroidPackage {
param (
[Parameter(Mandatory=$true)]
[string]$PackageName
)
# Convert 'm2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1' ->
# 'm2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-beta1'
$PackageName = $PackageName.Replace(";", "/")
$targetPath = Join-Path $ANDROID_SDK_DIR $PackageName
$targetPath | Should -Exist
}
}
Context "Packages" {
$testCases = $androidPackages | ForEach-Object { @{ PackageName = $_ } }
It "<PackageName>" -TestCases $testCases {
param ([string] $PackageName)
Validate-AndroidPackage $PackageName
}
}
Context "NDK toolchains" -Skip:($os.IsBigSur) {
$testCases = $androidNdkToolchains | ForEach-Object { @{AndroidNdkToolchain = $_} }
It "<AndroidNdkToolchain>" -TestCases $testCases {
param ([string] $AndroidNdkToolchain)
$toolchainPath = Join-Path $ANDROID_SDK_DIR "ndk-bundle" "toolchains" $AndroidNdkToolchain
$toolchainPath | Should -Exist
}
}
Context "Legacy NDK versions" -Skip:($os.IsBigSur) {
It "Android NDK version is 21" {
$ndkBundlePath = Join-Path $ANDROID_SDK_DIR "ndk-bundle" "source.properties"
$rawContent = Get-Content $ndkBundlePath -Raw
$rawContent | Should -BeLikeExactly "*Revision = 21.*"
}
It "Android NDK version r18b is installed" {
$ndk18BundlePath = Join-Path $ANDROID_SDK_DIR "ndk" "18.1.5063045" "source.properties"
$rawContent = Get-Content $ndk18BundlePath -Raw
$rawContent | Should -BeLikeExactly "*Revision = 18.*"
}
}
It "HAXM is installed" {
$haxmPath = Join-Path $ANDROID_SDK_DIR "extras" "intel" "Hardware_Accelerated_Execution_Manager" "silent_install.sh"
"$haxmPath -v" | Should -ReturnZeroExitCode
}
}
Describe "Gradle" {
It "Gradle is installed" {
"gradle --version" | Should -ReturnZeroExitCode
}
It "Gradle is installed to /usr/local/bin" {
(Get-Command "gradle").Path | Should -BeExactly "/usr/local/bin/gradle"
}
It "Gradle is compatible with init.d plugins" {
"cd /tmp && gradle tasks" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,372 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$os = Get-OSVersion
Describe "Disk free space" {
It "Image has more than 10GB free space" {
# we should have at least 10 GB of free space on macOS images
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#capabilities-and-limitations
$freeSpace = (Get-PSDrive "/").Free
$freeSpace | Should -BeGreaterOrEqual 10GB
}
}
Describe "Git" {
It "git is installed" {
"git --version" | Should -ReturnZeroExitCode
}
It "git lfs is installed" {
"git lfs version" | Should -ReturnZeroExitCode
}
It "hub CLI is installed" {
"hub --version" | Should -ReturnZeroExitCode
}
}
Describe "Audio device" -Skip:($os.IsHighSierra -or $os.IsBigSur) {
It "Sox is installed" {
"sox --version" | Should -ReturnZeroExitCode
}
It "SwitchAudioSource is installed" {
"SwitchAudioSource -c" | Should -ReturnZeroExitCode
}
It "Audio channel Soundflower (2ch)" {
SwitchAudioSource -c | Should -BeLikeExactly "Soundflower (2ch)"
}
}
Describe "Common utilities" {
It "Homebrew" {
"brew --version" | Should -ReturnZeroExitCode
}
It "DotNet" {
"dotnet --version" | Should -ReturnZeroExitCode
}
It "Go" {
"go version" | Should -ReturnZeroExitCode
}
It "Bundler" {
"bundler --version" | Should -ReturnZeroExitCode
}
It "Maven" {
"mvn --version" | Should -ReturnZeroExitCode
}
It "CocoaPods" {
"pod --version" | Should -ReturnZeroExitCode
}
It "Carthage" {
"carthage version" | Should -ReturnZeroExitCode
}
It "App Center CLI" {
"appcenter --version" | Should -ReturnZeroExitCode
}
It "Azure CLI" {
"az -v" | Should -ReturnZeroExitCode
}
Describe "AWS" {
It "AWS CLI" {
"aws --version" | Should -ReturnZeroExitCode
}
It "AWS SAM CLI" {
"sam --version" | Should -ReturnZeroExitCode
}
It "AWS Session Manager CLI" {
"session-manager-plugin --version" | Should -ReturnZeroExitCode
}
}
It "Aliyun CLI" {
"aliyun --version" | Should -ReturnZeroExitCode
}
It "Mobile Center CLI" {
"mobile-center --version" | Should -ReturnZeroExitCode
}
It "Nomad CLI" {
$result = Get-CommandResult "gem list"
$result.Output | Should -BeLike "*nomad-cli*"
}
It "Nomad CLI IPA" {
"ipa --version" | Should -ReturnZeroExitCode
}
It "Conda" {
Get-EnvironmentVariable "CONDA" | Should -Not -BeNullOrEmpty
$condaBinPath = Join-Path $env:CONDA "bin" "conda"
"$condaBinPath --version" | Should -ReturnZeroExitCode
}
It "Fastlane" {
"fastlane --version" | Should -ReturnZeroExitCode
}
It "Subversion" {
"svn --version" | Should -ReturnZeroExitCode
}
It "cmake" {
"cmake --version" | Should -ReturnZeroExitCode
}
It "curl" {
"curl --version" | Should -ReturnZeroExitCode
}
It "xctool" {
"xctool --version" | Should -ReturnZeroExitCode
}
It "xcpretty" {
"xcpretty --version" | Should -ReturnZeroExitCode
}
It "wget" {
"wget --version" | Should -ReturnZeroExitCode
}
It "mongodb" {
"mongo --version" | Should -ReturnZeroExitCode
"mongod --version"| Should -ReturnZeroExitCode
}
It "jq" {
"jq --version" | Should -ReturnZeroExitCode
}
It "OpenSSL" {
"openssl version" | Should -ReturnZeroExitCode
}
It "GnuPG" {
"gpg --version" | Should -ReturnZeroExitCode
}
It "PostgreSQL-Client" {
"psql --version" | Should -ReturnZeroExitCode
}
It "PostgreSQL-Server" {
"pg_config --version" | Should -ReturnZeroExitCode
}
It "Aria2" {
"aria2c --version" | Should -ReturnZeroExitCode
}
It "Azcopy" {
"azcopy --version" | Should -ReturnZeroExitCode
}
It "PHP" {
Get-WhichTool "php" | Should -Not -BeLike "/usr/bin/php*"
"php --version" | Should -ReturnZeroExitCode
}
It "Composer" {
"composer --version" | Should -ReturnZeroExitCode
}
It "R" -Skip:($os.IsBigSur) {
"R --version" | Should -ReturnZeroExitCode
}
It "zstd" {
"zstd --version" | Should -ReturnZeroExitCode
}
It "bazel" {
"bazel --version" | Should -ReturnZeroExitCode
}
It "bazelisk" {
"bazelisk version" | Should -ReturnZeroExitCode
}
It "Julia" {
"julia --version" | Should -ReturnZeroExitCode
}
It "Packer" {
"packer --version" | Should -ReturnZeroExitCode
}
It "Helm" {
"helm version --short" | Should -ReturnZeroExitCode
}
It "virtualbox" {
"vboxmanage -v" | Should -ReturnZeroExitCode
}
It "vagrant" {
"vagrant --version" | Should -ReturnZeroExitCode
}
It "GitHub CLI" {
"gh --version" | Should -ReturnZeroExitCode
}
It "7-Zip" {
"7z i" | Should -ReturnZeroExitCode
}
It "Apache Ant" {
"ant -version" | Should -ReturnZeroExitCode
}
}
Describe "Browsers" {
It "Chrome" {
$chromeLocation = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
$chromeLocation | Should -Exist
"'$chromeLocation' --version" | Should -ReturnZeroExitCode
}
It "Chrome Driver" {
"chromedriver --version" | Should -ReturnZeroExitCode
}
It "Microsoft Edge" {
$edgeLocation = "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
$edgeLocation | Should -Exist
"'$edgeLocation' --version" | Should -ReturnZeroExitCode
}
It "Microsoft Edge Driver" {
"msedgedriver --version" | Should -ReturnZeroExitCode
}
It "Firefox" {
$firefoxLocation = "/Applications/Firefox.app/Contents/MacOS/firefox"
$firefoxLocation | Should -Exist
"'$firefoxLocation' --version" | Should -ReturnZeroExitCode
}
It "Geckodriver" {
"geckodriver --version" | Should -ReturnZeroExitCode
}
}
Describe "Rust" -Skip:($os.IsHighSierra) {
It "Rustup is installed" {
"rustup --version" | Should -ReturnZeroExitCode
}
It "Rustc is installed" {
"rustc --version" | Should -ReturnZeroExitCode
}
It "Cargo is installed" {
"cargo --version" | Should -ReturnZeroExitCode
}
Context "Cargo dependencies" {
It "bindgen" {
"bindgen --version" | Should -ReturnZeroExitCode
}
It "cbindgen" {
"cbindgen --version" | Should -ReturnZeroExitCode
}
It "Cargo audit" {
"cargo audit --version" | Should -ReturnZeroExitCode
}
It "Cargo outdated" {
"cargo outdated --version" | Should -ReturnZeroExitCode
}
}
}
Describe "Haskell" -Skip:($os.IsHighSierra) {
It "GHCup" {
"ghcup --version" | Should -ReturnZeroExitCode
}
It "GHC" {
"ghc --version" | Should -ReturnZeroExitCode
}
It "Cabal" {
"cabal --version" | Should -ReturnZeroExitCode
}
It "Stack" {
"stack --version" | Should -ReturnZeroExitCode
}
}
Describe "Clang/LLVM" -Skip:($os.IsHighSierra) {
It "Clang/LLVM is installed" {
"$(brew --prefix llvm)/bin/clang --version" | Should -ReturnZeroExitCode
}
}
Describe "Gcc" -Skip:($os.IsHighSierra) {
$testCases = @("8", "9") | ForEach-Object { @{GccVersion = $_} }
It "Gcc <GccVersion>" -TestCases $testCases {
param (
[string] $GccVersion
)
"gcc-$GccVersion --version" | Should -ReturnZeroExitCode
}
}
Describe "Gfortran" -Skip:($os.IsHighSierra) {
$testCases = @("8", "9") | ForEach-Object { @{GfortranVersion = $_} }
It "Gfortran <GfortranVersion>" -TestCases $testCases {
param (
[string] $GfortranVersion
)
"gfortran-$GfortranVersion --version" | Should -ReturnZeroExitCode
}
}
Describe "Screen Resolution" -Skip:($os.IsHighSierra) {
It "Screen Resolution" {
system_profiler SPDisplaysDataType | Select-String "Resolution" | Should -Match "1176 x 885"
}
}
Describe "vcpkg" -Skip:($os.IsHighSierra -or $os.IsMojave) {
It "vcpkg" {
"vcpkg version" | Should -ReturnZeroExitCode
}
}
Describe "Newman" -Skip:($os.IsHighSierra -or $os.IsMojave) {
It "Newman" {
"newman --version" | Should -ReturnZeroExitCode
}
}
Describe "Visual Studio For Mac" {
It "VS4Mac is installed" {
$vsPath = "/Applications/Visual Studio.app"
$vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool"
$vsPath | Should -Exist
$vstoolPath | Should -Exist
}
}

View File

@@ -0,0 +1,61 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
#Java tests are disabled because Java is not working properly on macOS 11.0 yet.
$os = Get-OSVersion
function Get-NativeVersionFormat {
param($Version)
if ($Version -in "7", "8") {
return "1.${Version}"
}
return $Version
}
Describe "Java" -Skip:($os.IsBigSur) {
BeforeAll {
function Validate-JavaVersion {
param($JavaCommand, $ExpectedVersion)
$commandResult = Get-CommandResult $JavaCommand
$commandResult.ExitCode | Should -Be 0
$matchResult = $commandResult.Output | Select-String '^openjdk version \"([\d\._]+)\"'
$matchResult.Matches.Success | Should -BeTrue
$version = $matchResult.Matches.Groups[1].Value
$version | Should -BeLike "${ExpectedVersion}*"
}
}
$versionsList = Get-ToolsetValue "java.versions"
$defaultJava = Get-ToolsetValue "java.default"
$testCases = $versionsList | ForEach-Object { @{ Title = $_; Version = (Get-NativeVersionFormat $_); EnvVariable = "JAVA_HOME_${_}_X64" } }
$testCases += @{ Title = "Default"; Version = (Get-NativeVersionFormat $defaultJava); EnvVariable = "JAVA_HOME" }
$testCases | ForEach-Object {
Context $_.Title {
It "Version is found by 'java_home'" -TestCases $_ {
"/usr/libexec/java_home -v${Version}" | Should -ReturnZeroExitCode
}
It "Version is valid" -TestCases $_ {
$javaRootPath = (Get-CommandResult "/usr/libexec/java_home -v${Version}").Output
$javaBinPath = Join-Path $javaRootPath "/bin/java"
Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version
}
It "<EnvVariable>" -TestCases $_ {
$envVariablePath = Get-EnvironmentVariable $EnvVariable
$commandResult = Get-CommandResult "/usr/libexec/java_home -v${Version}"
$commandResult.ExitCode | Should -Be 0
$commandResult.Output | Should -Not -BeNullOrEmpty
$commandResult.Output | Should -Be $envVariablePath
}
if ($_.Title -eq "Default") {
It "Version is default" -TestCases $_ {
Validate-JavaVersion -JavaCommand "java -version" -ExpectedVersion $Version
}
}
}
}
}

View File

@@ -0,0 +1,13 @@
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$os = Get-OSVersion
Describe "Linters" {
It "yamllint" {
"yamllint --version" | Should -ReturnZeroExitCode
}
It "SwiftLint" -Skip:($os.IsHighSierra) {
"swiftlint version" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,50 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
Describe "Node.JS" {
BeforeAll {
$os = Get-OSVersion
$expectedNodeVersion = if ($os.IsHigherThanMojave) { "v12.*" } else { "v8.*" }
}
It "Node.JS is installed" {
"node --version" | Should -ReturnZeroExitCode
}
It "Node.JS $expectedNodeVersion is default" {
(Get-CommandResult "node --version").Output | Should -BeLike $expectedNodeVersion
}
It "NPM is installed" {
"npm --version" | Should -ReturnZeroExitCode
}
It "Yarn is installed" {
"yarn --version" | Should -ReturnZeroExitCode
}
}
Describe "NVM" {
BeforeAll {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true"
}
It "Nvm is installed" {
$nvmPath | Should -Exist
"$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode
}
Context "Nvm versions" {
$NVM_VERSIONS = @(6, 8, 10, 12)
$testCases = $NVM_VERSIONS | ForEach-Object { @{NvmVersion = $_} }
It "<NvmVersion>" -TestCases $testCases {
param (
[string] $NvmVersion
)
"$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode
}
}
}

View File

@@ -0,0 +1,41 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
Describe "Powershell" {
It "Powershell is installed" {
"pwsh -v" | Should -ReturnZeroExitCode
}
Context "Powershell Modules" {
$modules = Get-ToolsetValue powershellModules
$withoutVersionsModules = $modules | Where-Object {-not $_.versions} | ForEach-Object {
@{moduleName = $_.name}
}
$withVersionsModules = $modules | Where-Object {$_.versions} | ForEach-Object {
$moduleName = $_.name
$_.versions | ForEach-Object {
@{moduleName = $moduleName; expectedVersion = $_}
}
}
It "<moduleName> is installed" -TestCases $withoutVersionsModules {
param (
[string] $moduleName
)
Get-Module -Name $moduleName -ListAvailable | Should -BeTrue
}
if ($withVersionsModules) {
It "<moduleName> with <expectedVersion> is installed" -TestCases $withVersionsModules {
param (
[string] $moduleName,
[string] $expectedVersion
)
(Get-Module -Name $moduleName -ListAvailable).Version -contains $expectedVersion | Should -BeTrue
}
}
}
}

View File

@@ -0,0 +1,32 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
Describe "Python" {
It "Python 2 is available" {
"python --version" | Should -ReturnZeroExitCode
}
It "Python 2 is real 2.x" {
(Get-CommandResult "python --version").Output | Should -BeLike "Python 2.*"
}
It "Python 2 is installed under /usr/local/bin" {
Get-WhichTool "python" | Should -BeLike "/usr/local/bin*"
}
It "Python 3 is available" {
"python3 --version" | Should -ReturnZeroExitCode
}
It "Python 3 is installed under /usr/local/bin" {
Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*"
}
It "Pip 2 is available" {
"pip --version" | Should -ReturnZeroExitCode
}
It "Pip 3 is available" {
"pip3 --version" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,24 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
Describe "Ruby" {
It "Ruby is available" {
"ruby --version" | Should -ReturnZeroExitCode
}
It "Ruby is installed via HomeBrew" {
Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*"
}
It "Ruby tools are consistent" {
$expectedPrefix = "/usr/local"
Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*"
Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*"
Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*"
}
It "Ruby gems permissions are valid" {
"gem install bundle" | Should -ReturnZeroExitCode
"gem uninstall bundle" | Should -ReturnZeroExitCode
}
}

View File

@@ -0,0 +1,25 @@
param (
[Parameter(Mandatory=$true)]
$WorkingDirectory,
[Parameter(Mandatory=$true)]
$OutputFile
)
$ErrorActionPreference = "Stop"
Import-Module Pester
Set-Location -Path $WorkingDirectory
$parentDirectory = Split-Path $OutputFile -Parent
if (-not (Test-Path $parentDirectory)) { New-Item -Path $parentDirectory -ItemType Directory | Out-Null }
$configuration = [PesterConfiguration] @{
Output = @{ Verbosity = "Detailed" }
TestResult = @{
Enabled = $true
OutputPath = $OutputFile;
OutputFormat = "NUnitXML"
}
}
Invoke-Pester -Configuration $configuration

View File

@@ -0,0 +1,240 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$os = Get-OSVersion
Describe "Toolcache" {
$toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache"
$packages = (Get-ToolcachePackages).PSObject.Properties | ForEach-Object {
$packageNameParts = $_.Name.Split("-")
return [PSCustomObject] @{
ToolName = $packageNameParts[1]
Arch = $packageNameParts[4]
Versions = $_.Value
}
}
[array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object {
return [PSCustomObject] @{
ToolName = ($_.name).ToLower()
Arch = $_.arch
Versions = $_.versions | ForEach-Object { $_.Replace(".*", "") }
}
}
Context "Python" {
$pythonDirectory = Join-Path $toolcacheDirectory "Python"
$pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1
$testCase = @{ PythonDirectory = $pythonDirectory }
It "Toolcache directory exists" -TestCases $testCase {
param ( [string] $PythonDirectory )
$PythonDirectory | Should -Exist
}
It "Toolcache directory contains at least one version of Python" -TestCases $testCase {
param ( [string] $PythonDirectory )
(Get-ChildItem -Path $PythonDirectory -Directory).Count | Should -BeGreaterThan 0
}
$pythonPackage.Versions | Where-Object { $_ } | ForEach-Object {
Context "$_" {
$versionDirectory = Get-ChildItem -Path $pythonDirectory -Directory -Filter "$_*" | Select-Object -First 1
$pythonBinPath = Join-Path $versionDirectory.FullName $pythonPackage.Arch "python"
$testCase = @{ PythonVersion = $_; PythonBinPath = $pythonBinPath }
It "Version" -TestCases $testCase {
param (
[string] $PythonVersion,
[string] $PythonBinPath
)
$result = Get-CommandResult "$PythonBinPath --version"
$result.Output | Should -BeLike "*$PythonVersion*"
$result.ExitCode | Should -Be 0
}
It "Run test script" -TestCases $testCase {
param ( [string] $PythonBinPath )
"$PythonBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode
}
}
}
}
Context "Ruby" {
$rubyDirectory = Join-Path $toolcacheDirectory "Ruby"
$rubyPackage = $packages | Where-Object { $_.ToolName -eq "ruby" } | Select-Object -First 1
$testCase = @{ RubyDirectory = $rubyDirectory }
It "Toolcache directory exists" -TestCases $testCase {
param ( [string] $RubyDirectory )
$RubyDirectory | Should -Exist
}
It "Toolcache directory contains at least one version of Ruby" -TestCases $testCase {
param ( [string] $RubyDirectory )
(Get-ChildItem -Path $RubyDirectory -Directory).Count | Should -BeGreaterThan 0
}
$rubyPackage.Versions | Where-Object { $_ } | ForEach-Object {
Context "$_" {
$versionDirectory = Get-ChildItem -Path $rubyDirectory -Directory -Filter "$_*" | Select-Object -First 1
$rubyBinPath = Join-Path $versionDirectory.FullName $rubyPackage.Arch "bin" "ruby"
$testCase = @{ RubyVersion = $_; RubyBinPath = $rubyBinPath }
It "Version" -TestCases $testCase {
param (
[string] $RubyVersion,
[string] $RubyBinPath
)
$result = Get-CommandResult "$RubyBinPath --version"
$result.Output | Should -BeLike "*$RubyVersion*"
$result.ExitCode | Should -Be 0
}
It "Run test script" -TestCases $testCase {
param ( [string] $RubyBinPath )
"$RubyBinPath -e 'puts RUBY_VERSION'" | Should -ReturnZeroExitCode
}
}
}
}
Context "PyPy" -Skip:($os.IsBigSur) {
$pypyDirectory = Join-Path $toolcacheDirectory "PyPy"
$pypyPackage = $packages | Where-Object { $_.ToolName -eq "pypy" } | Select-Object -First 1
$testCase = @{ PypyDirectory = $pypyDirectory }
It "Toolcache directory exists" -TestCases $testCase {
param ( [string] $PypyDirectory )
$PypyDirectory | Should -Exist
}
It "Toolcache directory contains at least one version of PyPy" -TestCases $testCase {
param ( [string] $PypyDirectory )
(Get-ChildItem -Path $PypyDirectory -Directory).Count | Should -BeGreaterThan 0
}
$pypyPackage.Versions | Where-Object { $_ } | ForEach-Object {
Context "$_" {
$versionDirectory = Get-ChildItem -Path $pypyDirectory -Directory -Filter "$_*" | Select-Object -First 1
$binFilename = If ($_.StartsWith("3")) { "pypy3" } else { "pypy" }
$pypyBinPath = Join-Path $versionDirectory.FullName $pypyPackage.Arch "bin" $binFilename
$testCase = @{ PypyVersion = $_; PypyBinPath = $pypyBinPath }
It "Version" -TestCases $testCase {
param (
[string] $PypyVersion,
[string] $PypyBinPath
)
$result = Get-CommandResult "$PypyBinPath --version"
$result.Output | Should -BeLike "*$PypyVersion*"
$result.ExitCode | Should -Be 0
}
It "Run test script" -TestCases $testCase {
param ( [string] $PypyBinPath )
"$PypyBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode
}
}
}
}
Context "Node" -Skip:($os.IsHighSierra) {
$nodeDirectory = Join-Path $toolcacheDirectory "node"
$nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1
$testCase = @{ NodeDirectory = $nodeDirectory }
It "Toolcache directory exists" -TestCases $testCase {
param ( [string] $NodeDirectory )
$NodeDirectory | Should -Exist
}
It "Toolcache directory contains at least one version of Node" -TestCases $testCase {
param ( [string] $NodeDirectory )
(Get-ChildItem -Path $NodeDirectory -Directory).Count | Should -BeGreaterThan 0
}
$nodePackage.Versions | Where-Object { $_ } | ForEach-Object {
Context "$_" {
$versionDirectory = Get-ChildItem -Path $nodeDirectory -Directory -Filter "$_*" | Select-Object -First 1
$nodeBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "node"
$npmBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "npm"
$testCase = @{ NodeVersion = $_; NodeBinPath = $nodeBinPath; NpmBinPath = $npmBinPath }
It "Version Node" -TestCases $testCase {
param (
[string] $NodeVersion,
[string] $NodeBinPath
)
$result = Get-CommandResult "$NodeBinPath --version"
$result.Output | Should -BeLike "*$NodeVersion*"
$result.ExitCode | Should -Be 0
}
It "Version Npm" -TestCases $testCase {
param ( [string] $NpmBinPath )
"$NpmBinPath --version" | Should -ReturnZeroExitCode
}
It "Run test script" -TestCases $testCase {
param ( [string] $NodeBinPath )
"$NodeBinPath -e 'console.log(process.version)'" | Should -ReturnZeroExitCode
}
}
}
}
Context "Go" -Skip:($os.IsHighSierra) {
$goDirectory = Join-Path $toolcacheDirectory "go"
$goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1
$testCase = @{ GoDirectory = $goDirectory }
It "Toolcache directory exists" -TestCases $testCase {
param ( [string] $GoDirectory )
$GoDirectory | Should -Exist
}
It "Toolcache directory contains at least one version of Go" -TestCases $testCase {
param ( [string] $GoDirectory )
(Get-ChildItem -Path $GoDirectory -Directory).Count | Should -BeGreaterThan 0
}
$goPackage.Versions | Where-Object { $_ } | ForEach-Object {
Context "$_" {
$versionDirectory = Get-ChildItem -Path $goDirectory -Directory -Filter "$_*" | Select-Object -First 1
$goBinPath = Join-Path $versionDirectory.FullName $goPackage.Arch "bin" "go"
$testCase = @{ GoVersion = $_; GoBinPath = $goBinPath }
It "Version Go" -TestCases $testCase {
param (
[string] $GoVersion,
[string] $GoBinPath
)
$result = Get-CommandResult "$GoBinPath version"
$result.Output | Should -BeLike "*$GoVersion*"
$result.ExitCode | Should -Be 0
}
}
}
}
}

View File

@@ -0,0 +1,289 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$MONO_VERSIONS = Get-ToolsetValue "xamarin.mono-versions"
$XAMARIN_IOS_VERSIONS = Get-ToolsetValue "xamarin.ios-versions"
$XAMARIN_MAC_VERSIONS = Get-ToolsetValue "xamarin.mac-versions"
$XAMARIN_ANDROID_VERSIONS = Get-ToolsetValue "xamarin.android-versions"
BeforeAll {
function Get-ShortSymlink {
param (
[string] $Version
)
$versionParts = $Version.Split(".")
return [String]::Join(".", $versionParts[0..1])
}
}
Describe "Mono" {
$MONO_VERSIONS | ForEach-Object {
Context "$_" {
$MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions"
$versionFolderPath = Join-Path $MONO_VERSIONS_PATH ([System.Version]::Parse($_).ToString(3))
$testCase = @{ MonoVersion = $_; VersionFolderPath = $versionFolderPath; MonoVersionsPath = $MONO_VERSIONS_PATH }
It "is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$monoBinPath = Join-Path $VersionFolderPath "bin" "mono"
$VersionFolderPath | Should -Exist
$monoBinPath | Should -Exist
}
It "is available via short link" -TestCases $testCase {
param (
[string] $MonoVersion,
[string] $MonoVersionsPath,
[string] $VersionFolderPath
)
$shortSymlink = Get-ShortSymlink $MonoVersion # only 'major.minor'
$shortSymlinkFolderPath = Join-Path $MonoVersionsPath $shortSymlink
if ($shortSymlink -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
It "NUnit console is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$nunitPath = Join-Path $VersionFolderPath "Commands" "nunit3-console"
$nunitPath | Should -Exist
}
It "Nuget is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$nugetBinaryPath = Join-Path $VersionFolderPath "lib" "mono" "nuget" "nuget.exe"
$nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget"
$nugetCommandPath = Join-Path $VersionFolderPath "Commands" "nuget"
$nugetBinaryPath | Should -Exist
$nugetCommandPath | Should -Exist
$nugetBinaryWrapperPath | Should -Exist
}
It "Nuget is valid" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget"
"$nugetBinaryWrapperPath" | Should -ReturnZeroExitCode
}
}
}
}
Describe "Xamarin.iOS" {
$XAMARIN_IOS_VERSIONS | ForEach-Object {
Context "$_" {
$XAMARIN_IOS_VERSIONS_PATH = "/Library/Frameworks/Xamarin.iOS.framework/Versions"
$versionFolderPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $_
$testCase = @{ XamarinIosVersion = $_; VersionFolderPath = $versionFolderPath; IosVersionsPath = $XAMARIN_IOS_VERSIONS_PATH }
It "is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$xamarinBinPath = Join-Path $VersionFolderPath "bin"
$VersionFolderPath | Should -Exist
$xamarinBinPath | Should -Exist
}
It "is available via short link" -TestCases $testCase {
param (
[string] $XamarinIosVersion,
[string] $IosVersionsPath,
[string] $VersionFolderPath
)
$shortSymlink = Get-ShortSymlink $XamarinIosVersion # only 'major.minor'
$shortSymlinkFolderPath = Join-Path $IosVersionsPath $shortSymlink
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
}
}
}
Describe "Xamarin.Mac" {
$XAMARIN_MAC_VERSIONS | ForEach-Object {
Context "$_" {
$XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions"
$versionFolderPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $_
$testCase = @{ XamarinMacVersion = $_; VersionFolderPath = $versionFolderPath; MacVersionsPath = $XAMARIN_MAC_VERSIONS_PATH }
It "is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$xamarinBinPath = Join-Path $VersionFolderPath "bin"
$VersionFolderPath | Should -Exist
$xamarinBinPath | Should -Exist
}
It "is available via short link" -TestCases $testCase {
param (
[string] $XamarinMacVersion,
[string] $MacVersionsPath,
[string] $VersionFolderPath
)
$shortSymlink = Get-ShortSymlink $XamarinMacVersion # only 'major.minor'
$shortSymlinkFolderPath = Join-Path $MacVersionsPath $shortSymlink
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
}
}
}
Describe "Xamarin.Android" {
$XAMARIN_ANDROID_VERSIONS | ForEach-Object {
Context "$_" {
$XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions"
$versionFolderPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $_
$testCase = @{ XamarinAndroidVersion = $_; VersionFolderPath = $versionFolderPath; AndroidVersionsPath = $XAMARIN_ANDROID_VERSIONS_PATH }
It "is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$xamarinLibPath = Join-Path $VersionFolderPath "lib"
$xamarinLibPath | Should -Exist
}
It "is available via short link" -TestCases $testCase {
param (
[string] $XamarinAndroidVersion,
[string] $AndroidVersionsPath,
[string] $VersionFolderPath
)
$shortSymlink = Get-ShortSymlink $XamarinAndroidVersion # only 'major.minor'
$shortSymlinkFolderPath = Join-Path $AndroidVersionsPath $shortSymlink
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
}
It "has correct symlinks" -TestCases $testCase {
param ( [string] $VersionFolderPath )
$xamarinLibPath = Join-Path $VersionFolderPath "lib"
Join-Path $xamarinLibPath "xbuild" | Should -Exist
Join-Path $xamarinLibPath "xbuild-frameworks" | Should -Exist
}
}
}
}
Describe "Xamarin Bundles" {
BeforeAll {
$MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions"
$XAMARIN_IOS_VERSIONS_PATH = "/Library/Frameworks/Xamarin.iOS.framework/Versions"
$XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions"
$XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions"
}
$XAMARIN_BUNDLES = Get-ToolsetValue "xamarin.bundles"
$XAMARIN_DEFAULT_BUNDLE = Get-ToolsetValue "xamarin.bundle-default"
If ($XAMARIN_DEFAULT_BUNDLE -eq "latest") { $XAMARIN_DEFAULT_BUNDLE = $XAMARIN_BUNDLES[0].symlink }
$currentBundle = [PSCustomObject] @{
symlink = "Current"
mono = $XAMARIN_DEFAULT_BUNDLE
ios = $XAMARIN_DEFAULT_BUNDLE
mac = $XAMARIN_DEFAULT_BUNDLE
android = $XAMARIN_DEFAULT_BUNDLE
}
$latestBundle = [PSCustomObject] @{
symlink = "Latest"
mono = $XAMARIN_BUNDLES[0].mono
ios = $XAMARIN_BUNDLES[0].ios
mac = $XAMARIN_BUNDLES[0].mac
android = $XAMARIN_BUNDLES[0].android
}
$bundles = $XAMARIN_BUNDLES + $currentBundle + $latestBundle
$allBundles = $bundles | ForEach-Object { @{BundleSymlink = $_.symlink; BundleMono = $_.mono; BundleIos = $_.ios; BundleMac = $_.mac; BundleAndroid = $_.android} }
It "Mono symlink <BundleSymlink> exists" -TestCases $allBundles {
param ( [string] $BundleSymlink )
(Join-Path $MONO_VERSIONS_PATH $BundleSymlink) | Should -Exist
}
It "Mono symlink <BundleSymlink> points to the correct version" -TestCases $allBundles {
param (
[string] $BundleSymlink,
[string] $BundleMono
)
if ($BundleMono -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file
$sourceVersionPath = Join-Path $MONO_VERSIONS_PATH $BundleMono "VERSION"
$targetVersionPath = Join-Path $MONO_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
It "iOS symlink <BundleSymlink> exists" -TestCases $allBundles {
param ( [string] $BundleSymlink )
(Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink) | Should -Exist
}
It "iOS symlink <BundleSymlink> points to the correct version" -TestCases $allBundles {
param (
[string] $BundleSymlink,
[string] $BundleIos
)
$sourceVersionPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleIos "VERSION"
$targetVersionPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
It "Mac symlink <BundleSymlink> exists" -TestCases $allBundles {
param ( [string] $BundleSymlink )
(Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink) | Should -Exist
}
It "Mac symlink <BundleSymlink> points to the correct version" -TestCases $allBundles {
param (
[string] $BundleSymlink,
[string] $BundleMac
)
$sourceVersionPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleMac "VERSION"
$targetVersionPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
It "Xamarin.Android symlink <BundleSymlink> exists" -TestCases $allBundles {
param ( [string] $BundleSymlink )
(Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink) | Should -Exist
}
It "Android symlink <BundleSymlink> points to the correct version" -TestCases $allBundles {
param (
[string] $BundleSymlink,
[string] $BundleAndroid
)
$sourceVersionPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleAndroid "VERSION"
$targetVersionPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink "VERSION"
Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath
}
}

View File

@@ -0,0 +1,107 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$XCODE_VERSIONS = Get-ToolsetValue "xcode.versions"
$DEFAULT_XCODE = Get-ToolsetValue "xcode.default"
$LATEST_XCODE_VERSION = $XCODE_VERSIONS | Select-Object -First 1
$OS = Get-OSVersion
Describe "Xcode" {
It "Default Xcode is $DEFAULT_XCODE" {
"xcodebuild -version" | Should -ReturnZeroExitCode
(Get-CommandResult "xcodebuild -version").Output | Should -BeLike "Xcode $DEFAULT_XCODE*"
}
# Cut "_beta" postfix for test cases
$testCases = $XCODE_VERSIONS | ForEach-Object { @{XcodeVersion = $_.Split("_")[0] } }
It "<XcodeVersion>" -TestCases $testCases {
param ( [string] $XcodeVersion )
$xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild"
"$xcodebuildPath -version" | Should -ReturnZeroExitCode
}
It "Xcode <XcodeVersion> tools are installed" -TestCases $testCases -Skip:($os.IsHighSierra) {
param ( [string] $XcodeVersion )
$TOOLS_NOT_INSTALLED_EXIT_CODE = 69
$xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild"
$result = Get-CommandResult "$xcodebuildPath -checkFirstLaunchStatus"
if ($XcodeVersion -ne $LATEST_XCODE_VERSION) {
$result.ExitCode | Should -Not -Be $TOOLS_NOT_INSTALLED_EXIT_CODE
} else {
$result.ExitCode | Should -BeIn (0, $TOOLS_NOT_INSTALLED_EXIT_CODE)
}
}
It "Xcode <XcodeVersion> has correct beta symlink" -TestCases $testCases {
param ( [string] $XcodeVersion )
$xcodesWithBetaSymlink = @("12", "12_beta", "9.3", "9.4")
$shouldBetaSymlinkExists = $XcodeVersion.StartsWith("10") -or $XcodeVersion.StartsWith("11") -or ($XcodeVersion -in $xcodesWithBetaSymlink)
$betaSymlinkPath = Get-XcodeRootPath -Version "${XcodeVersion}_beta"
Test-Path $betaSymlinkPath | Should -Be $shouldBetaSymlinkExists
}
It "/Applications/Xcode* symlinks are valid" {
$symlinks = Get-ChildItem "/Applications" -Filter "Xcode*" | Where-Object { $_.LinkType }
$symlinks.Target | ForEach-Object {
$_ | Should -Exist
}
}
Context "XCODE_DEVELOPER_DIR" {
$stableXcodeVersions = $XCODE_VERSIONS | Where-Object { -not ($_ -match "beta") }
$majorXcodeVersions = $stableXcodeVersions | ForEach-Object { $_.Split(".")[0] } | Select-Object -Unique
$testCases = $majorXcodeVersions | ForEach-Object {
$majorXcodeVersion = $_
$expectedVersion = $stableXcodeVersions | Where-Object { $_.StartsWith("$majorXcodeVersion") } | Select-Object -First 1
return @{
MajorXcodeVersion = $majorXcodeVersion
ExpectedVersion = $expectedVersion
}
}
It "XCODE_<MajorXcodeVersion>_DEVELOPER_DIR" -TestCases $testCases {
param (
[string] $MajorXcodeVersion,
[string] $ExpectedVersion
)
$variableName = "XCODE_${MajorXcodeVersion}_DEVELOPER_DIR"
$actualPath = Get-EnvironmentVariable $variableName
$expectedPath = Join-Path (Get-XcodeRootPath -Version $ExpectedVersion) "Contents/Developer"
$actualPath | Should -Exist
$actualPath | Should -Be $expectedPath
}
}
}
Describe "Xcode simulators" {
$XCODE_VERSIONS | ForEach-Object {
Switch-Xcode -Version $_
Context "$_" {
It "No duplicates in devices" {
[array]$devicesList = @(Get-XcodeDevicesList | Where-Object { $_ })
Validate-ArrayWithoutDuplicates $devicesList -Because "Found duplicate device simulators"
}
It "No duplicates in pairs" {
[array]$pairsList = @(Get-XcodePairsList | Where-Object { $_ })
Validate-ArrayWithoutDuplicates $pairsList -Because "Found duplicate pairs simulators"
}
}
}
AfterAll {
$DEFAULT_XCODE = Get-ToolsetValue "xcode.default"
Switch-Xcode -Version $DEFAULT_XCODE
}
}

View File

@@ -0,0 +1,82 @@
# Toolset JSON structure
## Xcode
- `default` - version of Xcode to set as default
**Example:** `"11.2.1"`
- `versions` - the array of versions of Xcode to install
**Example:** `[ "11.3", "11.2.1", "11.2", "11.1", "11" ]`
## Xamarin
- `vsmac` - version of Visual Studio For Mac to install.
**Example:** `"8.3.11.1"`
- `mono-versions` - the array of Mono versions to install.
**Example:** `[ "6.4.0.208", "6.0.0.334" ]`
- `ios-versions` - the array of Xamarin iOS versions to install.
**Example:** `[ "13.6.0.12", "13.4.0.2", "13.2.0.47" ]`
- `mac-versions` - the array of Xamarin iOS versions to install.
**Example:** `[ "6.6.0.12", "6.4.0.2", "6.2.0.47" ]`
- `android-versions` - the array of Xamarin iOS versions to install.
**Example:** `[ "10.0.6.2", "9.4.1.0" ]`
**Note:** More than one version of SDK with the same major.minor version should not be installed. It applies to `mono-versions`, `ios-versions`, `mac-versions`, `android-versions` fields.
For example, if Mono `6.4.0.100` is installed and Mono `6.4.1.2` was released recently, we should not install both, just update `6.4.0.100` -> `6.4.1.2`. Only major and minor version changes can break backward compatibility so it is safe.
<br>
- `bundle-default` - the symlink of the bundle that will be set as default on the image.
This bundle will be set as `Current`.
**Example:** `"5_12_0"` (set bundle with symlink `5_12_0` as default)
**Example:** `"latest"` (set latest bundle as default)
- `bundles` - the array of objects that describe bundles that will be created on image after sdk installation.
The first bundle in the list will be as `Latest`.
Each object should contain the following fields:
- `symlink` - unique id of the bundle (usually looks like "<major_mono_version>_<minor_mono_version>_<index>")
- `mono` - version of Mono that will be set in this bundle. Only two numbers (`major.minor`) should be specified.
- `ios` - version of Xamarin.iOS that will be set in this bundle. Only two numbers (`major.minor`) should be specified.
- `mac` - version of Xamarin.Mac that will be set in this bundle. Only two numbers (`major.minor`) should be specified.
- `android` - version of Xamarin.Android that will be set in this bundle. Only two numbers (`major.minor`) should be specified.
**Example:**
```
[
{
"symlink": "6_4_2",
"mono": "6.4",
"ios": "13.6",
"mac": "6.6",
"android": "10.0"
},
{
"symlink": "6_4_1",
"mono": "6.4",
"ios": "13.4",
"mac": "6.4",
"android": "10.0"
}
]
```
## Android
- `platform-list` - the array of android platforms to install.
**Example:** `[ "android-29", "android-28", "android-27" ]`
- `build-tools` - the array of android build tools to install.
**Example:** `[ "29.0.2", "29.0.1", "29.0.0", "28.0.3" ]`
- `extra-list` - the array of android extra items to install.
**Example:** `[ "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager" ]`
- `addon-list` - the array of android addons to install.
**Example:** `[ "addon-google_apis-google-24", "addon-google_apis-google-23" ]`
# Toolset JSON validation
File `Toolset.Tests.ps1` contains PowerShell [Pester](https://github.com/Pester/Pester) tests that validate JSON toolset files.
Type `Invoke-Pester` in the current folder in PowerShell to run tests.

View File

@@ -0,0 +1,144 @@
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
$toolsets = Get-ChildItem -Path $PSScriptRoot -Filter "toolset-*.json"
function Get-ShortVersion([System.Version] $Version) {
return [System.Version]::Parse($Version).ToString(2)
}
function Invoke-BashUtilsFunction([string] $FunctionName, [string]$parameter) {
$xamarinUtilsPath = "$PSScriptRoot/../provision/utils/xamarin-utils.sh"
return Invoke-Expression "bash -c `"source $xamarinUtilsPath && $FunctionName $parameter`""
}
Describe "Toolset JSON validation" {
$toolsets | ForEach-Object {
It "$($_.Name) is valid" {
$jsonContent = Get-Content -Raw $_.Fullname
$jsonContent | Test-Json | Should -BeTrue
}
}
}
$toolsets | ForEach-Object {
Describe "$($_.Name)" {
$toolset = Get-Content -Raw $_.Fullname | ConvertFrom-Json
Context "Xcode" {
It "Default Xcode should be defined" {
$toolset.xcode.default | Should -BeTrue
}
It "Default Xcode is listed in Xcode list" {
$toolset.xcode.versions | Should -Contain $toolset.xcode.default
}
}
Context "VSMac" {
$vsmacVersion = $toolset.xamarin.vsmac
It "Version '$vsmacVersion' is available and can be downloaded" {
$vsmacUrl = Invoke-BashUtilsFunction("buildVSMacDownloadUrl", $vsmacVersion)
Validate-Url $vsmacUrl
}
}
Context "Mono" {
$sdkVersions = $toolset.xamarin."mono-versions"
$sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildMonoDownloadUrl", $_)
Validate-Url $sdkUrl
}
}
It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
}
}
Context "Xamarin.iOS" {
$sdkVersions = $toolset.xamarin."ios-versions"
$sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildXamariniIOSDownloadUrl", $_)
Validate-Url $sdkUrl
}
}
It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
}
}
Context "Xamarin.Mac" {
$sdkVersions = $toolset.xamarin."mac-versions"
$sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildXamarinMacDownloadUrl", $_)
Validate-Url $sdkUrl
}
}
It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
}
}
Context "Xamarin.Android" {
$sdkVersions = $toolset.xamarin."android-versions"
$sdkVersions | ForEach-Object {
It "Version '$_' is available and can be downloaded" {
$sdkUrl = Invoke-BashUtilsFunction("buildXamarinAndroidDownloadUrl", $_)
Validate-Url $sdkUrl
}
}
It "Version list doesn't contain versions with the same major/minor version" {
$versions = $sdkVersions | ForEach-Object { $_.Replace("-", ".") } | ForEach-Object { Get-ShortVersion $_ }
Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor"
}
}
Context "Xamarin bundles" {
$monoVersions = $toolset.xamarin."mono-versions" | ForEach-Object { Get-ShortVersion $_ }
$iOSVersions = $toolset.xamarin."ios-versions" | ForEach-Object { Get-ShortVersion $_ }
$macVersions = $toolset.xamarin."mac-versions" | ForEach-Object { Get-ShortVersion $_ }
# Old Xamarin.Android version looks like "9.0.0-18" that doesn't support by System.Version
$androidVersions = $toolset.xamarin."android-versions" | ForEach-Object { Get-ShortVersion $_.Replace("-", ".") }
$bundles = $toolset.xamarin.bundles
$bundles | ForEach-Object {
It "'$($_.symlink)' is valid" {
$monoVersions | Should -Contain $_.mono
$iOSVersions | Should -Contain $_.ios
$macVersions | Should -Contain $_.mac
$androidVersions | Should -Contain $_.android
}
}
It "Each bundle has unique symlink" {
$symlinks = $bundles | ForEach-Object { $_.symlink }
Validate-ArrayWithoutDuplicates $symlinks -Because "Bundle symlinks should be unique"
}
It "Current bundle is valid" {
$currentBundleSymlink = $toolset.xamarin."bundle-default"
if ($currentBundleSymlink -ne "latest") {
$bundleSymlinks = $bundles | ForEach-Object { $_.symlink }
$bundleSymlinks | Should -Contain $currentBundleSymlink -Because "Current bundle should be installed"
}
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"@actions/toolcache-python-macos-1013-x64": [
"2.7", "3.5", "3.6", "3.7", "3.8"
],
"@actions/toolcache-ruby-macos-1013-x64": [
"2.4", "2.5", "2.6", "2.7"
]
}

View File

@@ -0,0 +1,5 @@
{
"@actions/toolcache-ruby-macos-1013-x64": [
"2.4", "2.5", "2.6", "2.7"
]
}

View File

@@ -0,0 +1,5 @@
{
"@actions/toolcache-ruby-macos-1013-x64": [
"2.4", "2.5", "2.6", "2.7"
]
}

View File

@@ -0,0 +1,202 @@
{
"xcode": {
"default": "10.1",
"versions": [
"10.1", "10", "9.4.1", "9.4", "9.3.1", "9.3", "9.2", "9.1", "9", "8.3.3", "8.2.1", "8.1", "8"
]
},
"xamarin": {
"vsmac": "8.3.11.1",
"mono-versions": [
"6.4.0.208", "6.0.0.334", "5.18.1.3", "5.16.1.0", "5.12.0.309", "5.10.1.57", "5.8.1.0", "5.4.1.7", "5.2.0.224", "5.0.1.1", "4.8.1.0"
],
"ios-versions": [
"13.6.0.12", "13.4.0.2", "13.2.0.47", "12.14.0.114", "12.10.0.157", "12.8.0.2", "12.6.0.25", "12.2.1.16", "12.0.0.15", "11.14.0.13", "11.12.0.4", "11.9.1.24", "11.8.0.20", "11.6.1.4", "11.2.0.11", "11.0.0.0", "10.10.0.36", "10.6.0.10"
],
"mac-versions": [
"6.6.0.12", "6.4.0.2", "6.2.0.47", "5.16.1.24", "5.10.0.157", "5.8.0.0", "5.6.0.25", "5.3.1.28", "5.2.1.16" , "4.6.0.13", "4.4.1.193", "4.2.1.28", "4.0.0.216", "3.8.0.49", "3.6.3.3", "3.4.0.36", "3.0.0.398"
],
"android-versions": [
"10.0.6.2", "9.4.1.0", "9.3.0-23", "9.2.3-0", "9.1.8-0", "9.0.0-20", "8.3.3-2", "8.2.0-16", "8.1.5-0", "8.0.0-33", "7.4.5-1", "7.3.1-2", "7.1.0-43"
],
"bundle-default": "5_12_0",
"bundles": [
{
"symlink": "6_4_2",
"mono": "6.4",
"ios": "13.6",
"mac": "6.6",
"android": "10.0"
},
{
"symlink": "6_4_1",
"mono": "6.4",
"ios": "13.4",
"mac": "6.4",
"android": "10.0"
},
{
"symlink": "6_4_0",
"mono": "6.4",
"ios": "13.2",
"mac": "6.2",
"android": "10.0"
},
{
"symlink": "6_0_0",
"mono": "6.0",
"ios": "12.14",
"mac": "5.16",
"android": "9.4"
},
{
"symlink": "5_18_3",
"mono": "5.18",
"ios": "12.10",
"mac": "5.10",
"android": "9.3"
},
{
"symlink": "5_18_2",
"mono": "5.18",
"ios": "12.8",
"mac": "5.8",
"android": "9.2"
},
{
"symlink": "5_18_1",
"mono": "5.18",
"ios": "12.6",
"mac": "5.6",
"android": "9.2"
},
{
"symlink": "5_16_0_0",
"mono": "5.16",
"ios": "12.2",
"mac": "5.2",
"android": "9.1"
},
{
"symlink": "5_16_0",
"mono": "5.16",
"ios": "12.2",
"mac": "5.2",
"android": "9.1"
},
{
"symlink": "5_12_0_3",
"mono": "5.12",
"ios": "12.2",
"mac": "5.3",
"android": "9.0"
},
{
"symlink": "5_12_0_XC10_PRE",
"mono": "5.12",
"ios": "12.0",
"mac": "5.2",
"android": "9.0"
},
{
"symlink": "5_12_0",
"mono": "5.12",
"ios": "11.14",
"mac": "4.6",
"android": "9.0"
},
{
"symlink": "5_10_1",
"mono": "5.10",
"ios": "11.12",
"mac": "4.4",
"android": "8.3"
},
{
"symlink": "5_8_1",
"mono": "5.8",
"ios": "11.9",
"mac": "4.2",
"android": "8.2"
},
{
"symlink": "5_8_0",
"mono": "5.8",
"ios": "11.8",
"mac": "4.2",
"android": "8.2"
},
{
"symlink": "5_4_1",
"mono": "5.4",
"ios": "11.6",
"mac": "4.0",
"android": "8.1"
},
{
"symlink": "5_4_0",
"mono": "5.4",
"ios": "11.2",
"mac": "3.8",
"android": "8.0"
},
{
"symlink": "5_2_0",
"mono": "5.2",
"ios": "11.0",
"mac": "3.6",
"android": "7.4"
},
{
"symlink": "Legacy_5_0_1",
"mono": "5.0",
"ios": "10.10",
"mac": "3.4",
"android": "7.3"
},
{
"symlink": "Legacy_4_8_1",
"mono": "4.8",
"ios": "10.6",
"mac": "3.0",
"android": "7.1"
}
]
},
"java": {
"default": "8",
"versions": [
"7", "8", "11", "12", "13", "14"
]
},
"android": {
"platform-list": [
"android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24", "android-23", "android-22", "android-21", "android-20", "android-19", "android-18", "android-17", "android-16", "android-15"
],
"build-tools": [
"30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0", "23.0.3", "23.0.2", "23.0.1", "23.0.0", "22.0.1", "21.1.2", "20.0.0", "19.1.0", "17.0.0"
],
"extra-list": [
"android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout;1.0.0", "m2repository;com;android;support;constraint;constraint-layout;1.0.1", "m2repository;com;android;support;constraint;constraint-layout;1.0.2"
],
"addon-list": [
"addon-google_apis-google-24", "addon-google_apis-google-23", "addon-google_apis-google-22", "addon-google_apis-google-21"
]
},
"powershellModules": [
{"name": "Az"},
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"toolcache": [
{
"name": "PyPy",
"arch": "x64",
"platform" : "darwin",
"versions": [
"2.7",
"3.6"
]
}
]
}

View File

@@ -0,0 +1,261 @@
{
"xcode": {
"default": "11.3.1",
"versions": [
"11.3.1", "11.3", "11.2.1", "11.2", "11.1", "11", "10.3", "10.2.1", "10.2", "10.1", "10", "9.4.1"
]
},
"xamarin": {
"vsmac": "8.5.0.3183",
"mono-versions": [
"6.8.0.123", "6.6.0.166", "6.4.0.208", "6.0.0.334", "5.18.1.3", "5.16.1.0", "5.12.0.309", "5.10.1.57", "5.8.1.0", "5.4.1.7", "5.2.0.224", "5.0.1.1", "4.8.1.0"
],
"ios-versions": [
"13.14.1.39", "13.10.0.21", "13.8.3.0", "13.6.0.12", "13.4.0.2", "13.2.0.47", "12.14.0.114", "12.10.0.157", "12.8.0.2", "12.6.0.25", "12.2.1.16", "12.0.0.15", "11.14.0.13", "11.12.0.4", "11.9.1.24", "11.8.0.20", "11.6.1.4", "11.2.0.11", "11.0.0.0", "10.10.0.36", "10.6.0.10"
],
"mac-versions": [
"6.14.1.39", "6.10.0.21", "6.8.3.0", "6.6.0.12", "6.4.0.2", "6.2.0.47", "5.16.1.24", "5.10.0.157", "5.8.0.0", "5.6.0.25", "5.3.1.28", "5.2.1.16" , "4.6.0.13", "4.4.1.193", "4.2.1.28", "4.0.0.216", "3.8.0.49", "3.6.3.3", "3.4.0.36", "3.0.0.398"
],
"android-versions": [
"10.2.0.100", "10.1.3.7", "10.0.6.2", "9.4.1.0", "9.3.0-23", "9.2.3-0", "9.1.8-0", "9.0.0-20", "8.3.3-2", "8.2.0-16", "8.1.5-0", "8.0.0-33", "7.4.5-1", "7.3.1-2", "7.1.0-43"
],
"bundle-default": "5_12_0",
"bundles": [
{
"symlink": "6_8_0",
"mono": "6.8",
"ios": "13.14",
"mac": "6.14",
"android": "10.2"
},
{
"symlink": "6_6_1",
"mono": "6.6",
"ios": "13.10",
"mac": "6.10",
"android": "10.1"
},
{
"symlink": "6_6_0",
"mono": "6.6",
"ios": "13.8",
"mac": "6.8",
"android": "10.1"
},
{
"symlink": "6_4_2",
"mono": "6.4",
"ios": "13.6",
"mac": "6.6",
"android": "10.0"
},
{
"symlink": "6_4_1",
"mono": "6.4",
"ios": "13.4",
"mac": "6.4",
"android": "10.0"
},
{
"symlink": "6_4_0",
"mono": "6.4",
"ios": "13.2",
"mac": "6.2",
"android": "10.0"
},
{
"symlink": "6_0_0",
"mono": "6.0",
"ios": "12.14",
"mac": "5.16",
"android": "9.4"
},
{
"symlink": "5_18_3",
"mono": "5.18",
"ios": "12.10",
"mac": "5.10",
"android": "9.3"
},
{
"symlink": "5_18_2",
"mono": "5.18",
"ios": "12.8",
"mac": "5.8",
"android": "9.2"
},
{
"symlink": "5_18_1",
"mono": "5.18",
"ios": "12.6",
"mac": "5.6",
"android": "9.2"
},
{
"symlink": "5_16_0_0",
"mono": "5.16",
"ios": "12.2",
"mac": "5.2",
"android": "9.1"
},
{
"symlink": "5_16_0",
"mono": "5.16",
"ios": "12.2",
"mac": "5.2",
"android": "9.1"
},
{
"symlink": "5_12_0_3",
"mono": "5.12",
"ios": "12.2",
"mac": "5.3",
"android": "9.0"
},
{
"symlink": "5_12_0_XC10_PRE",
"mono": "5.12",
"ios": "12.0",
"mac": "5.2",
"android": "9.0"
},
{
"symlink": "5_12_0",
"mono": "5.12",
"ios": "11.14",
"mac": "4.6",
"android": "9.0"
},
{
"symlink": "5_10_1",
"mono": "5.10",
"ios": "11.12",
"mac": "4.4",
"android": "8.3"
},
{
"symlink": "5_8_1",
"mono": "5.8",
"ios": "11.9",
"mac": "4.2",
"android": "8.2"
},
{
"symlink": "5_8_0",
"mono": "5.8",
"ios": "11.8",
"mac": "4.2",
"android": "8.2"
},
{
"symlink": "5_4_1",
"mono": "5.4",
"ios": "11.6",
"mac": "4.0",
"android": "8.1"
},
{
"symlink": "5_4_0",
"mono": "5.4",
"ios": "11.2",
"mac": "3.8",
"android": "8.0"
},
{
"symlink": "5_2_0",
"mono": "5.2",
"ios": "11.0",
"mac": "3.6",
"android": "7.4"
},
{
"symlink": "Legacy_5_0_1",
"mono": "5.0",
"ios": "10.10",
"mac": "3.4",
"android": "7.3"
},
{
"symlink": "Legacy_4_8_1",
"mono": "4.8",
"ios": "10.6",
"mac": "3.0",
"android": "7.1"
}
]
},
"java": {
"default": "8",
"versions": [
"7", "8", "11", "12", "13", "14"
]
},
"android": {
"platform-list": [
"android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24", "android-23", "android-22", "android-21", "android-20", "android-19", "android-18", "android-17", "android-16", "android-15"
],
"build-tools": [
"30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0", "23.0.3", "23.0.2", "23.0.1", "23.0.0", "22.0.1", "21.1.2", "20.0.0", "19.1.0", "17.0.0"
],
"extra-list": [
"android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout;1.0.0", "m2repository;com;android;support;constraint;constraint-layout;1.0.1", "m2repository;com;android;support;constraint;constraint-layout;1.0.2"
],
"addon-list": [
"addon-google_apis-google-24", "addon-google_apis-google-23", "addon-google_apis-google-22", "addon-google_apis-google-21"
]
},
"powershellModules": [
{"name": "Az"},
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"toolcache": [
{
"name": "Python",
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "darwin",
"versions": [
"2.7.*",
"3.5.*",
"3.6.*",
"3.7.*",
"3.8.*"
]
},
{
"name": "PyPy",
"arch": "x64",
"platform" : "darwin",
"versions": [
"2.7",
"3.6"
]
},
{
"name": "Node",
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
"platform" : "darwin",
"arch": "x64",
"versions": [
"8.*",
"10.*",
"12.*",
"14.*"
]
},
{
"name": "Go",
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "darwin",
"versions": [
"1.11.*",
"1.12.*",
"1.13.*",
"1.14.*",
"1.15.*"
]
}
]
}

View File

@@ -0,0 +1,163 @@
{
"xcode": {
"default": "11.7",
"versions": [
"12_beta", "11.7", "11.6", "11.5", "11.4.1", "11.4", "11.3.1", "11.2.1", "11.1", "11", "10.3"
]
},
"xamarin": {
"vsmac": "8.7.5.19",
"mono-versions": [
"6.12.0.93", "6.10.0.106", "6.8.0.123", "6.6.0.166", "6.4.0.208"
],
"ios-versions": [
"13.20.2.2", "13.18.2.1", "13.16.0.13", "13.14.1.39", "13.10.0.21", "13.8.3.0", "13.6.0.12", "13.4.0.2", "13.2.0.47"
],
"mac-versions": [
"6.20.2.2", "6.18.3.2", "6.16.0.13", "6.14.1.39", "6.10.0.21", "6.8.3.0", "6.6.0.12", "6.4.0.2", "6.2.0.47"
],
"android-versions": [
"11.0.2.0", "10.3.1.4", "10.2.0.100", "10.1.3.7", "10.0.6.2"
],
"bundle-default": "latest",
"bundles": [
{
"symlink": "6_12_0",
"mono":"6.12",
"ios": "13.20",
"mac": "6.20",
"android": "11.0"
},
{
"symlink": "6_10_0",
"mono":"6.10",
"ios": "13.18",
"mac": "6.18",
"android": "10.3"
},
{
"symlink": "6_8_1",
"mono":"6.8",
"ios": "13.16",
"mac": "6.16",
"android": "10.2"
},
{
"symlink": "6_8_0",
"mono": "6.8",
"ios": "13.14",
"mac": "6.14",
"android": "10.2"
},
{
"symlink": "6_6_1",
"mono": "6.6",
"ios": "13.10",
"mac": "6.10",
"android": "10.1"
},
{
"symlink": "6_6_0",
"mono": "6.6",
"ios": "13.8",
"mac": "6.8",
"android": "10.1"
},
{
"symlink": "6_4_2",
"mono": "6.4",
"ios": "13.6",
"mac": "6.6",
"android": "10.0"
},
{
"symlink": "6_4_1",
"mono": "6.4",
"ios": "13.4",
"mac": "6.4",
"android": "10.0"
},
{
"symlink": "6_4_0",
"mono": "6.4",
"ios": "13.2",
"mac": "6.2",
"android": "10.0"
}
]
},
"java": {
"default": "8",
"versions": [
"7", "8", "11", "12", "13", "14"
]
},
"android": {
"platform-list": [
"android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24"
],
"build-tools": [
"30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0"
],
"extra-list": [
"android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout;1.0.0", "m2repository;com;android;support;constraint;constraint-layout;1.0.1", "m2repository;com;android;support;constraint;constraint-layout;1.0.2"
],
"addon-list": [
"addon-google_apis-google-24", "addon-google_apis-google-23", "addon-google_apis-google-22", "addon-google_apis-google-21"
]
},
"powershellModules": [
{"name": "Az"},
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"toolcache": [
{
"name": "Python",
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "darwin",
"versions": [
"2.7.*",
"3.5.*",
"3.6.*",
"3.7.*",
"3.8.*"
]
},
{
"name": "PyPy",
"arch": "x64",
"platform" : "darwin",
"versions": [
"2.7",
"3.6"
]
},
{
"name": "Node",
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
"platform" : "darwin",
"arch": "x64",
"versions": [
"8.*",
"10.*",
"12.*",
"14.*"
]
},
{
"name": "Go",
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "darwin",
"versions": [
"1.11.*",
"1.12.*",
"1.13.*",
"1.14.*",
"1.15.*"
]
}
]
}

View File

@@ -0,0 +1,99 @@
{
"xcode": {
"default": "11.7",
"versions": [
"12_beta", "11.7"
]
},
"xamarin": {
"vsmac": "8.7.5.19",
"mono-versions": [
"6.12.0.93", "6.10.0.106"
],
"ios-versions": [
"13.20.2.2", "13.18.2.1"
],
"mac-versions": [
"6.20.2.2", "6.18.3.2"
],
"android-versions": [
"11.0.2.0", "10.3.1.4"
],
"bundle-default": "latest",
"bundles": [
{
"symlink": "6_12_0",
"mono":"6.12",
"ios": "13.20",
"mac": "6.20",
"android": "11.0"
},
{
"symlink": "6_10_0",
"mono":"6.10",
"ios": "13.18",
"mac": "6.18",
"android": "10.3"
}
]
},
"java": {
"default": "8",
"versions": [
"8", "11"
]
},
"android": {
"platform-list": [
"android-30", "android-29", "android-28", "android-27"
],
"build-tools": [
"30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0"
],
"extra-list": [
"android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager"
],
"addon-list": []
},
"powershellModules": [
{"name": "Az"},
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"toolcache": [
{
"name": "Python",
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "darwin",
"versions": [
"2.7.*",
"3.5.*",
"3.6.*",
"3.7.*",
"3.8.*"
]
},
{
"name": "Node",
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
"platform" : "darwin",
"arch": "x64",
"versions": [
"10.*",
"12.*",
"14.*"
]
},
{
"name": "Go",
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "darwin",
"versions": [
"1.14.*",
"1.15.*"
]
}
]
}