diff --git a/images.CI/macos/anka/Service.Helpers.psm1 b/images.CI/macos/anka/Service.Helpers.psm1 index 74a1e1e6b..e7af5cb8f 100644 --- a/images.CI/macos/anka/Service.Helpers.psm1 +++ b/images.CI/macos/anka/Service.Helpers.psm1 @@ -13,7 +13,7 @@ function Enable-AutoLogon { [string] $Password ) - $url = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/provision/bootstrap-provisioner/setAutoLogin.sh" + $url = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/assets/bootstrap-provisioner/setAutoLogin.sh" $script = Invoke-RestMethod -Uri $url $base64 = [Convert]::ToBase64String($script.ToCharArray()) $command = "echo $base64 | base64 --decode > ./setAutoLogin.sh;sudo bash ./setAutoLogin.sh '${UserName}' '${Password}';rm ./setAutoLogin.sh" @@ -43,7 +43,7 @@ function Invoke-SoftwareUpdateArm64 { '14.\d' { $nextOSVersion = 'NotYetDefined' } } - $url = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/provision/configuration/auto-software-update-arm64.exp" + $url = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/assets/auto-software-update-arm64.exp" $script = Invoke-RestMethod -Uri $url foreach ($update in $listOfUpdates) { if ($update -notmatch "$nextOSVersion") { diff --git a/images.CI/shebang-linter.ps1 b/images.CI/shebang-linter.ps1 index 53c7d9817..08f8c19d8 100644 --- a/images.CI/shebang-linter.ps1 +++ b/images.CI/shebang-linter.ps1 @@ -23,7 +23,7 @@ function Validate-Scripts { } $PathUbuntu = "./images/ubuntu/scripts" -$PathMacOS = "./images/macos/provision" +$PathMacOS = "./images/macos" $PatternUbuntu = "#!/bin/bash -e" $PatternMacOS = "#!/bin/bash -e -o pipefail" $ScriptsWithBrokenShebang = @() diff --git a/images/macos/provision/configuration/add-certificate.swift b/images/macos/assets/add-certificate.swift similarity index 100% rename from images/macos/provision/configuration/add-certificate.swift rename to images/macos/assets/add-certificate.swift diff --git a/images/macos/provision/configuration/auto-software-update-arm64.exp b/images/macos/assets/auto-software-update-arm64.exp similarity index 100% rename from images/macos/provision/configuration/auto-software-update-arm64.exp rename to images/macos/assets/auto-software-update-arm64.exp diff --git a/images/macos/provision/configuration/environment/bashprofile b/images/macos/assets/bashprofile similarity index 100% rename from images/macos/provision/configuration/environment/bashprofile rename to images/macos/assets/bashprofile diff --git a/images/macos/provision/configuration/environment/bashrc b/images/macos/assets/bashrc similarity index 100% rename from images/macos/provision/configuration/environment/bashrc rename to images/macos/assets/bashrc diff --git a/images/macos/provision/bootstrap-provisioner/change_password b/images/macos/assets/bootstrap-provisioner/change_password old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/bootstrap-provisioner/change_password rename to images/macos/assets/bootstrap-provisioner/change_password diff --git a/images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh b/images/macos/assets/bootstrap-provisioner/installNewProvisioner.sh similarity index 100% rename from images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh rename to images/macos/assets/bootstrap-provisioner/installNewProvisioner.sh diff --git a/images/macos/provision/bootstrap-provisioner/kcpassword.py b/images/macos/assets/bootstrap-provisioner/kcpassword.py old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/bootstrap-provisioner/kcpassword.py rename to images/macos/assets/bootstrap-provisioner/kcpassword.py diff --git a/images/macos/provision/bootstrap-provisioner/setAutoLogin.sh b/images/macos/assets/bootstrap-provisioner/setAutoLogin.sh similarity index 100% rename from images/macos/provision/bootstrap-provisioner/setAutoLogin.sh rename to images/macos/assets/bootstrap-provisioner/setAutoLogin.sh diff --git a/images/macos/provision/assets/select-xamarin-sdk-v2.sh b/images/macos/assets/xamarin-selector/select-xamarin-sdk-v2.sh similarity index 100% rename from images/macos/provision/assets/select-xamarin-sdk-v2.sh rename to images/macos/assets/xamarin-selector/select-xamarin-sdk-v2.sh diff --git a/images/macos/provision/assets/select-xamarin-sdk.sh b/images/macos/assets/xamarin-selector/select-xamarin-sdk.sh similarity index 100% rename from images/macos/provision/assets/select-xamarin-sdk.sh rename to images/macos/assets/xamarin-selector/select-xamarin-sdk.sh diff --git a/images/macos/provision/core/action-archive-cache.sh b/images/macos/scripts/build/action-archive-cache.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/action-archive-cache.sh rename to images/macos/scripts/build/action-archive-cache.sh diff --git a/images/macos/provision/configuration/add-network-interface-detection.sh b/images/macos/scripts/build/add-network-interface-detection.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/add-network-interface-detection.sh rename to images/macos/scripts/build/add-network-interface-detection.sh diff --git a/images/macos/provision/core/android-toolsets.sh b/images/macos/scripts/build/android-toolsets.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/android-toolsets.sh rename to images/macos/scripts/build/android-toolsets.sh diff --git a/images/macos/provision/core/apache.sh b/images/macos/scripts/build/apache.sh similarity index 100% rename from images/macos/provision/core/apache.sh rename to images/macos/scripts/build/apache.sh diff --git a/images/macos/provision/core/audiodevice.sh b/images/macos/scripts/build/audiodevice.sh similarity index 100% rename from images/macos/provision/core/audiodevice.sh rename to images/macos/scripts/build/audiodevice.sh diff --git a/images/macos/provision/configuration/autologin.sh b/images/macos/scripts/build/autologin.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/autologin.sh rename to images/macos/scripts/build/autologin.sh diff --git a/images/macos/provision/core/aws.sh b/images/macos/scripts/build/aws.sh similarity index 100% rename from images/macos/provision/core/aws.sh rename to images/macos/scripts/build/aws.sh diff --git a/images/macos/provision/core/azcopy.sh b/images/macos/scripts/build/azcopy.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/azcopy.sh rename to images/macos/scripts/build/azcopy.sh diff --git a/images/macos/provision/core/bicep.sh b/images/macos/scripts/build/bicep.sh similarity index 100% rename from images/macos/provision/core/bicep.sh rename to images/macos/scripts/build/bicep.sh diff --git a/images/macos/provision/core/build-xcode-symlinks.sh b/images/macos/scripts/build/build-xcode-symlinks.sh similarity index 100% rename from images/macos/provision/core/build-xcode-symlinks.sh rename to images/macos/scripts/build/build-xcode-symlinks.sh diff --git a/images/macos/provision/core/chrome.sh b/images/macos/scripts/build/chrome.sh similarity index 100% rename from images/macos/provision/core/chrome.sh rename to images/macos/scripts/build/chrome.sh diff --git a/images/macos/provision/configuration/cleanup-brew.sh b/images/macos/scripts/build/cleanup-brew.sh similarity index 100% rename from images/macos/provision/configuration/cleanup-brew.sh rename to images/macos/scripts/build/cleanup-brew.sh diff --git a/images/macos/provision/core/cocoapods.sh b/images/macos/scripts/build/cocoapods.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/cocoapods.sh rename to images/macos/scripts/build/cocoapods.sh diff --git a/images/macos/provision/core/codeql-bundle.sh b/images/macos/scripts/build/codeql-bundle.sh similarity index 100% rename from images/macos/provision/core/codeql-bundle.sh rename to images/macos/scripts/build/codeql-bundle.sh diff --git a/images/macos/provision/core/commonutils.sh b/images/macos/scripts/build/commonutils.sh similarity index 100% rename from images/macos/provision/core/commonutils.sh rename to images/macos/scripts/build/commonutils.sh diff --git a/images/macos/provision/configuration/configure-hostname.sh b/images/macos/scripts/build/configure-hostname.sh similarity index 100% rename from images/macos/provision/configuration/configure-hostname.sh rename to images/macos/scripts/build/configure-hostname.sh diff --git a/images/macos/provision/configuration/configure-machine.sh b/images/macos/scripts/build/configure-machine.sh similarity index 100% rename from images/macos/provision/configuration/configure-machine.sh rename to images/macos/scripts/build/configure-machine.sh diff --git a/images/macos/provision/configuration/configure-ssh.sh b/images/macos/scripts/build/configure-ssh.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/configure-ssh.sh rename to images/macos/scripts/build/configure-ssh.sh diff --git a/images/macos/provision/configuration/configure-tccdb-macos.sh b/images/macos/scripts/build/configure-tccdb-macos.sh similarity index 100% rename from images/macos/provision/configuration/configure-tccdb-macos.sh rename to images/macos/scripts/build/configure-tccdb-macos.sh diff --git a/images/macos/provision/core/configure-toolset.ps1 b/images/macos/scripts/build/configure-toolset.ps1 similarity index 100% rename from images/macos/provision/core/configure-toolset.ps1 rename to images/macos/scripts/build/configure-toolset.ps1 diff --git a/images/macos/provision/core/delete-duplicate-sims.rb b/images/macos/scripts/build/delete-duplicate-sims.rb similarity index 100% rename from images/macos/provision/core/delete-duplicate-sims.rb rename to images/macos/scripts/build/delete-duplicate-sims.rb diff --git a/images/macos/provision/configuration/disable-auto-updates.sh b/images/macos/scripts/build/disable-auto-updates.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/disable-auto-updates.sh rename to images/macos/scripts/build/disable-auto-updates.sh diff --git a/images/macos/provision/core/dotnet.sh b/images/macos/scripts/build/dotnet.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/dotnet.sh rename to images/macos/scripts/build/dotnet.sh diff --git a/images/macos/provision/core/edge.sh b/images/macos/scripts/build/edge.sh similarity index 100% rename from images/macos/provision/core/edge.sh rename to images/macos/scripts/build/edge.sh diff --git a/images/macos/provision/configuration/finalize-vm.sh b/images/macos/scripts/build/finalize-vm.sh similarity index 100% rename from images/macos/provision/configuration/finalize-vm.sh rename to images/macos/scripts/build/finalize-vm.sh diff --git a/images/macos/provision/core/firefox.sh b/images/macos/scripts/build/firefox.sh similarity index 100% rename from images/macos/provision/core/firefox.sh rename to images/macos/scripts/build/firefox.sh diff --git a/images/macos/provision/core/fix-xcode-simulators.ps1 b/images/macos/scripts/build/fix-xcode-simulators.ps1 similarity index 100% rename from images/macos/provision/core/fix-xcode-simulators.ps1 rename to images/macos/scripts/build/fix-xcode-simulators.ps1 diff --git a/images/macos/provision/core/gcc.sh b/images/macos/scripts/build/gcc.sh similarity index 100% rename from images/macos/provision/core/gcc.sh rename to images/macos/scripts/build/gcc.sh diff --git a/images/macos/provision/core/git.sh b/images/macos/scripts/build/git.sh similarity index 100% rename from images/macos/provision/core/git.sh rename to images/macos/scripts/build/git.sh diff --git a/images/macos/provision/core/golang.sh b/images/macos/scripts/build/golang.sh similarity index 100% rename from images/macos/provision/core/golang.sh rename to images/macos/scripts/build/golang.sh diff --git a/images/macos/provision/core/haskell.sh b/images/macos/scripts/build/haskell.sh similarity index 100% rename from images/macos/provision/core/haskell.sh rename to images/macos/scripts/build/haskell.sh diff --git a/images/macos/provision/core/homebrew.sh b/images/macos/scripts/build/homebrew.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/homebrew.sh rename to images/macos/scripts/build/homebrew.sh diff --git a/images/macos/provision/core/llvm.sh b/images/macos/scripts/build/llvm.sh similarity index 100% rename from images/macos/provision/core/llvm.sh rename to images/macos/scripts/build/llvm.sh diff --git a/images/macos/provision/configuration/max-files.sh b/images/macos/scripts/build/max-files.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/max-files.sh rename to images/macos/scripts/build/max-files.sh diff --git a/images/macos/provision/core/miniconda.sh b/images/macos/scripts/build/miniconda.sh similarity index 100% rename from images/macos/provision/core/miniconda.sh rename to images/macos/scripts/build/miniconda.sh diff --git a/images/macos/provision/core/mongodb.sh b/images/macos/scripts/build/mongodb.sh similarity index 100% rename from images/macos/provision/core/mongodb.sh rename to images/macos/scripts/build/mongodb.sh diff --git a/images/macos/provision/core/mono.sh b/images/macos/scripts/build/mono.sh similarity index 100% rename from images/macos/provision/core/mono.sh rename to images/macos/scripts/build/mono.sh diff --git a/images/macos/provision/core/nginx.sh b/images/macos/scripts/build/nginx.sh similarity index 100% rename from images/macos/provision/core/nginx.sh rename to images/macos/scripts/build/nginx.sh diff --git a/images/macos/provision/core/node.sh b/images/macos/scripts/build/node.sh similarity index 100% rename from images/macos/provision/core/node.sh rename to images/macos/scripts/build/node.sh diff --git a/images/macos/provision/configuration/ntpconf.sh b/images/macos/scripts/build/ntpconf.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/ntpconf.sh rename to images/macos/scripts/build/ntpconf.sh diff --git a/images/macos/provision/core/nvm.sh b/images/macos/scripts/build/nvm.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/nvm.sh rename to images/macos/scripts/build/nvm.sh diff --git a/images/macos/provision/core/open_windows_check.sh b/images/macos/scripts/build/open_windows_check.sh similarity index 100% rename from images/macos/provision/core/open_windows_check.sh rename to images/macos/scripts/build/open_windows_check.sh diff --git a/images/macos/provision/core/openjdk.sh b/images/macos/scripts/build/openjdk.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/openjdk.sh rename to images/macos/scripts/build/openjdk.sh diff --git a/images/macos/provision/core/openssl.sh b/images/macos/scripts/build/openssl.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/openssl.sh rename to images/macos/scripts/build/openssl.sh diff --git a/images/macos/provision/core/php.sh b/images/macos/scripts/build/php.sh similarity index 100% rename from images/macos/provision/core/php.sh rename to images/macos/scripts/build/php.sh diff --git a/images/macos/provision/core/pipx-packages.sh b/images/macos/scripts/build/pipx-packages.sh similarity index 100% rename from images/macos/provision/core/pipx-packages.sh rename to images/macos/scripts/build/pipx-packages.sh diff --git a/images/macos/provision/core/postgresql.sh b/images/macos/scripts/build/postgresql.sh similarity index 100% rename from images/macos/provision/core/postgresql.sh rename to images/macos/scripts/build/postgresql.sh diff --git a/images/macos/provision/core/powershell.sh b/images/macos/scripts/build/powershell.sh similarity index 100% rename from images/macos/provision/core/powershell.sh rename to images/macos/scripts/build/powershell.sh diff --git a/images/macos/provision/configuration/preimagedata.sh b/images/macos/scripts/build/preimagedata.sh similarity index 100% rename from images/macos/provision/configuration/preimagedata.sh rename to images/macos/scripts/build/preimagedata.sh diff --git a/images/macos/provision/core/pypy.sh b/images/macos/scripts/build/pypy.sh similarity index 100% rename from images/macos/provision/core/pypy.sh rename to images/macos/scripts/build/pypy.sh diff --git a/images/macos/provision/core/python.sh b/images/macos/scripts/build/python.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/python.sh rename to images/macos/scripts/build/python.sh diff --git a/images/macos/provision/core/reboot.sh b/images/macos/scripts/build/reboot.sh similarity index 100% rename from images/macos/provision/core/reboot.sh rename to images/macos/scripts/build/reboot.sh diff --git a/images/macos/provision/core/rosetta.sh b/images/macos/scripts/build/rosetta.sh similarity index 100% rename from images/macos/provision/core/rosetta.sh rename to images/macos/scripts/build/rosetta.sh diff --git a/images/macos/provision/core/ruby.sh b/images/macos/scripts/build/ruby.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/ruby.sh rename to images/macos/scripts/build/ruby.sh diff --git a/images/macos/provision/core/rubygem.sh b/images/macos/scripts/build/rubygem.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/rubygem.sh rename to images/macos/scripts/build/rubygem.sh diff --git a/images/macos/provision/core/rust.sh b/images/macos/scripts/build/rust.sh similarity index 100% rename from images/macos/provision/core/rust.sh rename to images/macos/scripts/build/rust.sh diff --git a/images/macos/provision/core/safari.sh b/images/macos/scripts/build/safari.sh similarity index 100% rename from images/macos/provision/core/safari.sh rename to images/macos/scripts/build/safari.sh diff --git a/images/macos/provision/configuration/screensaver-off.sh b/images/macos/scripts/build/screensaver-off.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/configuration/screensaver-off.sh rename to images/macos/scripts/build/screensaver-off.sh diff --git a/images/macos/provision/configuration/shell-change.sh b/images/macos/scripts/build/shell-change.sh similarity index 100% rename from images/macos/provision/configuration/shell-change.sh rename to images/macos/scripts/build/shell-change.sh diff --git a/images/macos/provision/core/swiftlint.sh b/images/macos/scripts/build/swiftlint.sh similarity index 100% rename from images/macos/provision/core/swiftlint.sh rename to images/macos/scripts/build/swiftlint.sh diff --git a/images/macos/provision/core/toolset.ps1 b/images/macos/scripts/build/toolset.ps1 similarity index 97% rename from images/macos/provision/core/toolset.ps1 rename to images/macos/scripts/build/toolset.ps1 index 8d6869327..5648623bb 100644 --- a/images/macos/provision/core/toolset.ps1 +++ b/images/macos/scripts/build/toolset.ps1 @@ -1,58 +1,58 @@ -################################################################################ -## File: toolset.ps1 -## Team: CI-Build -## Desc: Install toolset -################################################################################ -Import-Module "~/image-generation/helpers/Tests.Helpers.psm1" -Import-Module "~/image-generation/helpers/Common.Helpers.psm1" - -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..." - Start-DownloadWithRetry -Url $ReleaseAsset.download_url -DownloadPath $assetFolderPath - - 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 -} - -$arch = Get-Architecture - -# Get toolcache content from toolset -$toolsToInstall = @("Python", "Node", "Go") -$tools = Get-ToolsetValue "toolcache" | Where-Object {$toolsToInstall -contains $_.Name} - -foreach ($tool in $tools) { - # Get versions manifest for current tool - $assets = Invoke-RestMethodWithRetry -Url $tool.url - - # Get github release asset for each version - foreach ($version in $tool.arch.$arch.versions) { - $asset = $assets | Where-Object version -like $version ` - | Select-Object -ExpandProperty files ` - | Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $arch)} ` - | 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 - } - } -} - +################################################################################ +## File: toolset.ps1 +## Team: CI-Build +## Desc: Install toolset +################################################################################ +Import-Module "~/image-generation/helpers/Tests.Helpers.psm1" +Import-Module "~/image-generation/helpers/Common.Helpers.psm1" + +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..." + Start-DownloadWithRetry -Url $ReleaseAsset.download_url -DownloadPath $assetFolderPath + + 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 +} + +$arch = Get-Architecture + +# Get toolcache content from toolset +$toolsToInstall = @("Python", "Node", "Go") +$tools = Get-ToolsetValue "toolcache" | Where-Object {$toolsToInstall -contains $_.Name} + +foreach ($tool in $tools) { + # Get versions manifest for current tool + $assets = Invoke-RestMethodWithRetry -Url $tool.url + + # Get github release asset for each version + foreach ($version in $tool.arch.$arch.versions) { + $asset = $assets | Where-Object version -like $version ` + | Select-Object -ExpandProperty files ` + | Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $arch)} ` + | 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 + } + } +} + Invoke-PesterTests "Toolcache" \ No newline at end of file diff --git a/images/macos/provision/core/vcpkg.sh b/images/macos/scripts/build/vcpkg.sh similarity index 100% rename from images/macos/provision/core/vcpkg.sh rename to images/macos/scripts/build/vcpkg.sh diff --git a/images/macos/provision/core/vsmac.sh b/images/macos/scripts/build/vsmac.sh similarity index 100% rename from images/macos/provision/core/vsmac.sh rename to images/macos/scripts/build/vsmac.sh diff --git a/images/macos/provision/core/xamarin.sh b/images/macos/scripts/build/xamarin.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/xamarin.sh rename to images/macos/scripts/build/xamarin.sh diff --git a/images/macos/provision/core/xcode-clt.sh b/images/macos/scripts/build/xcode-clt.sh similarity index 100% rename from images/macos/provision/core/xcode-clt.sh rename to images/macos/scripts/build/xcode-clt.sh diff --git a/images/macos/provision/core/xcode-postbuild.sh b/images/macos/scripts/build/xcode-postbuild.sh similarity index 100% rename from images/macos/provision/core/xcode-postbuild.sh rename to images/macos/scripts/build/xcode-postbuild.sh diff --git a/images/macos/provision/core/xcode-sims.sh b/images/macos/scripts/build/xcode-sims.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/core/xcode-sims.sh rename to images/macos/scripts/build/xcode-sims.sh diff --git a/images/macos/provision/core/xcode.ps1 b/images/macos/scripts/build/xcode.ps1 similarity index 100% rename from images/macos/provision/core/xcode.ps1 rename to images/macos/scripts/build/xcode.ps1 diff --git a/images/macos/software-report/SoftwareReport.Android.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Android.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Android.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Android.psm1 diff --git a/images/macos/software-report/SoftwareReport.Browsers.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Browsers.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Browsers.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Browsers.psm1 diff --git a/images/macos/software-report/SoftwareReport.Common.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Common.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/scripts/docs-gen/SoftwareReport.Generator.ps1 similarity index 97% rename from images/macos/software-report/SoftwareReport.Generator.ps1 rename to images/macos/scripts/docs-gen/SoftwareReport.Generator.ps1 index 50b5f72c5..321d7d1c8 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/scripts/docs-gen/SoftwareReport.Generator.ps1 @@ -1,319 +1,319 @@ -using module ./software-report-base/SoftwareReport.psm1 -using module ./software-report-base/SoftwareReport.Nodes.psm1 - -param ( - [Parameter(Mandatory)][string] - $OutputDirectory, - $ImageName -) - -$ErrorActionPreference = "Stop" - -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/SoftwareReport.WebServers.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 - -# OS info -$osInfo = Build-OSInfoSection $ImageName - -# Software report -$softwareReport = [SoftwareReport]::new($osInfo) -$installedSoftware = $softwareReport.Root.AddHeader("Installed Software") - -# Language and Runtime -$languageAndRuntime = $installedSoftware.AddHeader("Language and Runtime") -$languageAndRuntime.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetVersionList), '^\d+\.\d+\.\d') -$languageAndRuntime.AddToolVersion("Bash", $(Get-BashVersion)) -$languageAndRuntime.AddNodes($(Get-ClangLLVMVersions)) -$languageAndRuntime.AddNodes($(Get-GccVersions)) -$languageAndRuntime.AddNodes($(Get-FortranVersions)) -$languageAndRuntime.AddToolVersion("Julia", $(Get-JuliaVersion)) -$languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $languageAndRuntime.AddToolVersion("Go", $(Get-GoVersion)) -} -$languageAndRuntime.AddToolVersion("Mono", $(Get-MonoVersion)) -$languageAndRuntime.AddToolVersion("Node.js", $(Get-NodeVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $languageAndRuntime.AddToolVersion("MSBuild", $(Get-MSBuildVersion)) - $languageAndRuntime.AddToolVersion("NVM", $(Get-NVMVersion)) - $languageAndRuntime.AddToolVersionsListInline("NVM - Cached node versions", $(Get-NVMNodeVersionList), '^\d+') -} -$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion)) -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion)) -} - -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $languageAndRuntime.AddToolVersion("Python", $(Get-PythonVersion)) -} - -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $languageAndRuntime.AddToolVersion("Python3", $(Get-Python3Version)) -} -$languageAndRuntime.AddToolVersion("R", $(Get-RVersion)) -$languageAndRuntime.AddToolVersion("Ruby", $(Get-RubyVersion)) - -# Package Management -$packageManagement = $installedSoftware.AddHeader("Package Management") -$packageManagement.AddToolVersion("Bundler", $(Get-BundlerVersion)) -$packageManagement.AddToolVersion("Carthage", $(Get-CarthageVersion)) -$packageManagement.AddToolVersion("CocoaPods", $(Get-CocoaPodsVersion)) -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion)) -} -$packageManagement.AddToolVersion("Homebrew", $(Get-HomebrewVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $packageManagement.AddToolVersion("Miniconda", $(Get-CondaVersion)) -} -$packageManagement.AddToolVersion("NPM", $(Get-NPMVersion)) -$packageManagement.AddToolVersion("NuGet", $(Get-NuGetVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $packageManagement.AddToolVersion("Pip", $(Get-PipVersion -Version 2)) -} - -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $packageManagement.AddToolVersion("Pip3", $(Get-PipVersion -Version 3)) - $packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion)) -} - -$packageManagement.AddToolVersion("RubyGems", $(Get-RubyGemsVersion)) -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion)) -} -$packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion)) - -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $packageManagement.AddNode($(Build-PackageManagementEnvironmentTable)) -} -# Project Management -$projectManagement = $installedSoftware.AddHeader("Project Management") -$projectManagement.AddToolVersion("Apache Ant", $(Get-ApacheAntVersion)) -$projectManagement.AddToolVersion("Apache Maven", $(Get-MavenVersion)) -$projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $projectManagement.AddToolVersion("Sbt", $(Get-SbtVersion)) -} - -# Utilities -$utilities = $installedSoftware.AddHeader("Utilities") -$utilities.AddToolVersion("7-Zip", $(Get-7zipVersion)) -$utilities.AddToolVersion("aria2", $(Get-Aria2Version)) -$utilities.AddToolVersion("azcopy", $(Get-AzcopyVersion)) -$utilities.AddToolVersion("bazel", $(Get-BazelVersion)) -$utilities.AddToolVersion("bazelisk", $(Get-BazeliskVersion)) -$utilities.AddToolVersion("bsdtar", $(Get-BsdtarVersion)) -$utilities.AddToolVersion("Curl", $(Get-CurlVersion)) -$utilities.AddToolVersion("Git", $(Get-GitVersion)) -$utilities.AddToolVersion("Git LFS", $(Get-GitLFSVersion)) -$utilities.AddToolVersion("GitHub CLI", $(Get-GitHubCLIVersion)) -$utilities.AddToolVersion("GNU Tar", $(Get-GnuTarVersion)) -$utilities.AddToolVersion("GNU Wget", $(Get-WgetVersion)) -$utilities.AddToolVersion("gpg (GnuPG)", $(Get-GPGVersion)) -if ($os.IsBigSur) { - $utilities.AddToolVersion("helm", $(Get-HelmVersion)) -} -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $utilities.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion)) -} -$utilities.AddToolVersion("jq", $(Get-JqVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $utilities.AddToolVersion("mongo", $(Get-MongoVersion)) - $utilities.AddToolVersion("mongod", $(Get-MongodVersion)) -} -if ($os.IsBigSur) { - $utilities.AddToolVersion("Newman", $(Get-NewmanVersion)) -} -$utilities.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion)) -$utilities.AddToolVersion("Packer", $(Get-PackerVersion)) -$utilities.AddToolVersion("pkg-config", $(Get-PKGConfigVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $utilities.AddToolVersion("PostgreSQL", $(Get-PostgresServerVersion)) - $utilities.AddToolVersion("psql (PostgreSQL)", $(Get-PostgresClientVersion)) - $utilities.AddToolVersion("Sox", $(Get-SoxVersion)) - $utilities.AddToolVersion("Subversion (SVN)", $(Get-SVNVersion)) - $utilities.AddToolVersion("Switchaudio-osx", $(Get-SwitchAudioOsxVersion)) -} -if ($os.IsMonterey) { - $utilities.AddToolVersion("Vagrant", $(Get-VagrantVersion)) - $utilities.AddToolVersion("VirtualBox", $(Get-VirtualBoxVersion)) -} -$utilities.AddToolVersion("yq", $(Get-YqVersion)) -$utilities.AddToolVersion("zstd", $(Get-ZstdVersion)) - -# Tools -$tools = $installedSoftware.AddHeader("Tools") -if ($os.IsBigSur) { - $tools.AddToolVersion("Aliyun CLI", $(Get-AliyunCLIVersion)) -} -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $tools.AddToolVersion("App Center CLI", $(Get-AppCenterCLIVersion)) -} -$tools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion)) -$tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion)) -$tools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion)) -$tools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion)) -$tools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion)) -$tools.AddToolVersion("Bicep CLI", $(Get-BicepVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $tools.AddToolVersion("Cabal", $(Get-CabalVersion)) -} -$tools.AddToolVersion("Cmake", $(Get-CmakeVersion)) -$tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion)) -if ($os.IsMonterey) { - $tools.AddToolVersion("Colima", $(Get-ColimaVersion)) -} -$tools.AddToolVersion("Fastlane", $(Get-FastlaneVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $tools.AddToolVersion("GHC", $(Get-GHCVersion)) - $tools.AddToolVersion("GHCup", $(Get-GHCupVersion)) - $tools.AddToolVersion("Jazzy", $(Get-JazzyVersion)) -} -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $tools.AddToolVersion("Stack", $(Get-StackVersion)) -} -$tools.AddToolVersion("SwiftFormat", $(Get-SwiftFormatVersion)) -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $tools.AddToolVersion("Swig", $(Get-SwigVersion)) -} -$tools.AddToolVersion("Xcode Command Line Tools", $(Get-XcodeCommandLineToolsVersion)) - -# Linters -$linters = $installedSoftware.AddHeader("Linters") -if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { - $linters.AddToolVersion("SwiftLint", $(Get-SwiftLintVersion)) -} -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $linters.AddToolVersion("Yamllint", $(Get-YamllintVersion)) -} - -# Browsers -$browsers = $installedSoftware.AddHeader("Browsers") -$browsers.AddNodes($(Build-BrowserSection)) -$browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable)) - -# Java -$java = $installedSoftware.AddHeader("Java") -$java.AddTable($(Get-JavaVersions)) - -# Toolcache -if (-not $os.IsSonoma) { - $toolcache = $installedSoftware.AddHeader("Cached Tools") - $toolcache.AddNodes($(Build-ToolcacheSection)) - - # Rust - $rust = $installedSoftware.AddHeader("Rust Tools") - $rust.AddToolVersion("Cargo", $(Get-RustCargoVersion)) - $rust.AddToolVersion("Rust", $(Get-RustVersion)) - $rust.AddToolVersion("Rustdoc", $(Get-RustdocVersion)) - $rust.AddToolVersion("Rustup", $(Get-RustupVersion)) - - $rustPackages = $rust.AddHeader("Packages") - if (-not $os.IsVentura) { - $rustPackages.AddToolVersion("Bindgen", $(Get-Bindgen)) - $rustPackages.AddToolVersion("Cargo-audit", $(Get-Cargoaudit)) - $rustPackages.AddToolVersion("Cargo-outdated", $(Get-Cargooutdated)) - $rustPackages.AddToolVersion("Cbindgen", $(Get-Cbindgen)) - } - $rustPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion)) - $rustPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion)) -} - -# PowerShell -$powerShell = $installedSoftware.AddHeader("PowerShell Tools") -$powerShell.AddToolVersion("PowerShell", $(Get-PowershellVersion)) - -$powerShellModules = $powerShell.AddHeader("PowerShell Modules") -$powerShellModules.AddNodes($(Get-PowerShellModules)) - -# Web Servers -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $webServers = $installedSoftware.AddHeader("Web Servers") - $webServers.AddTable($(Build-WebServersSection)) -} - -# Xamarin section -if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { - $xamarin = $installedSoftware.AddHeader("Xamarin") - $vsForMac = $xamarin.AddHeader("Visual Studio for Mac") - $vsForMac.AddTable($(Build-VSMacTable)) - $note = - @' -To use Visual Studio 2019 by default rename the app: -mv "/Applications/Visual Studio.app" "/Applications/Visual Studio 2022.app" -mv "/Applications/Visual Studio 2019.app" "/Applications/Visual Studio.app" -'@ - $vsForMacNotes = $vsForMac.AddHeader("Notes") - $vsForMacNotes.AddNote($note) - - $xamarinBundles = $xamarin.AddHeader("Xamarin bundles") - $xamarinBundles.AddTable($(Build-XamarinTable)) - - $unitTestFramework = $xamarin.AddHeader("Unit Test Framework") - $unitTestFramework.AddToolVersion("NUnit", $(Get-NUnitVersion)) -} - -# Xcode section -$xcode = $installedSoftware.AddHeader("Xcode") -# First run doesn't provide full data about devices and runtimes -Get-XcodeInfoList | Out-Null - -$xcodeInfo = Get-XcodeInfoList -$xcode.AddTable($(Build-XcodeTable $xcodeInfo)) - -$xcodeTools = $xcode.AddHeader("Xcode Support Tools") -$xcodeTools.AddNodes($(Build-XcodeSupportToolsSection)) - -$installedSdks = $xcode.AddHeader("Installed SDKs") -$installedSdks.AddTable($(Build-XcodeSDKTable $xcodeInfo)) - -$installedSimulators = $xcode.AddHeader("Installed Simulators") -$installedSimulators.AddTable($(Build-XcodeSimulatorsTable $xcodeInfo)) - -# Android section -$android = $installedSoftware.AddHeader("Android") -$androidTable = Build-AndroidTable -$android.AddTable($androidTable) - -$androidEnv = $android.AddHeader("Environment variables") -$androidEnv.AddTable($(Build-AndroidEnvironmentTable)) - -if ($os.IsBigSur -or $os.IsMonterey) { - $miscellaneous = $installedSoftware.AddHeader("Miscellaneous") - $miscellaneous.AddToolVersion("libXext", $(Get-LibXextVersion)) - $miscellaneous.AddToolVersion("libXft", $(Get-LibXftVersion)) - $miscellaneous.AddToolVersion("Tcl/Tk", $(Get-TclTkVersion)) - $miscellaneous.AddToolVersion("Zlib", $(Get-ZlibVersion)) -} - -if ($os.IsMonterey) { - $miscellaneousEnv = $miscellaneous.AddHeader("Environment variables") - $miscellaneousEnv.AddTable($(Build-MiscellaneousEnvironmentTable)) - - $notes = @' -If you want to use Parallels Desktop you should download a package from URL stored in -PARALLELS_DMG_URL environment variable. A system extension is allowed for this version. -'@ - $miscellaneousEnvNotes = $miscellaneousEnv.AddHeader("Notes") - $miscellaneousEnvNotes.AddNote($notes) -} - -if (-not (Test-Path $OutputDirectory)) { New-Item -Path $OutputDirectory -ItemType Directory | Out-Null } - -# -# Write final reports -# -Write-Host $markdownExtended -$softwareReport.ToJson() | Out-File -FilePath "${OutputDirectory}/systeminfo.json" -Encoding UTF8NoBOM -$softwareReport.ToMarkdown() | Out-File -FilePath "${OutputDirectory}/systeminfo.md" -Encoding UTF8NoBOM +using module ./software-report-base/SoftwareReport.psm1 +using module ./software-report-base/SoftwareReport.Nodes.psm1 + +param ( + [Parameter(Mandatory)][string] + $OutputDirectory, + $ImageName +) + +$ErrorActionPreference = "Stop" + +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/SoftwareReport.WebServers.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 + +# OS info +$osInfo = Build-OSInfoSection $ImageName + +# Software report +$softwareReport = [SoftwareReport]::new($osInfo) +$installedSoftware = $softwareReport.Root.AddHeader("Installed Software") + +# Language and Runtime +$languageAndRuntime = $installedSoftware.AddHeader("Language and Runtime") +$languageAndRuntime.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetVersionList), '^\d+\.\d+\.\d') +$languageAndRuntime.AddToolVersion("Bash", $(Get-BashVersion)) +$languageAndRuntime.AddNodes($(Get-ClangLLVMVersions)) +$languageAndRuntime.AddNodes($(Get-GccVersions)) +$languageAndRuntime.AddNodes($(Get-FortranVersions)) +$languageAndRuntime.AddToolVersion("Julia", $(Get-JuliaVersion)) +$languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $languageAndRuntime.AddToolVersion("Go", $(Get-GoVersion)) +} +$languageAndRuntime.AddToolVersion("Mono", $(Get-MonoVersion)) +$languageAndRuntime.AddToolVersion("Node.js", $(Get-NodeVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $languageAndRuntime.AddToolVersion("MSBuild", $(Get-MSBuildVersion)) + $languageAndRuntime.AddToolVersion("NVM", $(Get-NVMVersion)) + $languageAndRuntime.AddToolVersionsListInline("NVM - Cached node versions", $(Get-NVMNodeVersionList), '^\d+') +} +$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion)) +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion)) +} + +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $languageAndRuntime.AddToolVersion("Python", $(Get-PythonVersion)) +} + +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $languageAndRuntime.AddToolVersion("Python3", $(Get-Python3Version)) +} +$languageAndRuntime.AddToolVersion("R", $(Get-RVersion)) +$languageAndRuntime.AddToolVersion("Ruby", $(Get-RubyVersion)) + +# Package Management +$packageManagement = $installedSoftware.AddHeader("Package Management") +$packageManagement.AddToolVersion("Bundler", $(Get-BundlerVersion)) +$packageManagement.AddToolVersion("Carthage", $(Get-CarthageVersion)) +$packageManagement.AddToolVersion("CocoaPods", $(Get-CocoaPodsVersion)) +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion)) +} +$packageManagement.AddToolVersion("Homebrew", $(Get-HomebrewVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $packageManagement.AddToolVersion("Miniconda", $(Get-CondaVersion)) +} +$packageManagement.AddToolVersion("NPM", $(Get-NPMVersion)) +$packageManagement.AddToolVersion("NuGet", $(Get-NuGetVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $packageManagement.AddToolVersion("Pip", $(Get-PipVersion -Version 2)) +} + +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $packageManagement.AddToolVersion("Pip3", $(Get-PipVersion -Version 3)) + $packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion)) +} + +$packageManagement.AddToolVersion("RubyGems", $(Get-RubyGemsVersion)) +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion)) +} +$packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion)) + +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $packageManagement.AddNode($(Build-PackageManagementEnvironmentTable)) +} +# Project Management +$projectManagement = $installedSoftware.AddHeader("Project Management") +$projectManagement.AddToolVersion("Apache Ant", $(Get-ApacheAntVersion)) +$projectManagement.AddToolVersion("Apache Maven", $(Get-MavenVersion)) +$projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $projectManagement.AddToolVersion("Sbt", $(Get-SbtVersion)) +} + +# Utilities +$utilities = $installedSoftware.AddHeader("Utilities") +$utilities.AddToolVersion("7-Zip", $(Get-7zipVersion)) +$utilities.AddToolVersion("aria2", $(Get-Aria2Version)) +$utilities.AddToolVersion("azcopy", $(Get-AzcopyVersion)) +$utilities.AddToolVersion("bazel", $(Get-BazelVersion)) +$utilities.AddToolVersion("bazelisk", $(Get-BazeliskVersion)) +$utilities.AddToolVersion("bsdtar", $(Get-BsdtarVersion)) +$utilities.AddToolVersion("Curl", $(Get-CurlVersion)) +$utilities.AddToolVersion("Git", $(Get-GitVersion)) +$utilities.AddToolVersion("Git LFS", $(Get-GitLFSVersion)) +$utilities.AddToolVersion("GitHub CLI", $(Get-GitHubCLIVersion)) +$utilities.AddToolVersion("GNU Tar", $(Get-GnuTarVersion)) +$utilities.AddToolVersion("GNU Wget", $(Get-WgetVersion)) +$utilities.AddToolVersion("gpg (GnuPG)", $(Get-GPGVersion)) +if ($os.IsBigSur) { + $utilities.AddToolVersion("helm", $(Get-HelmVersion)) +} +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $utilities.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion)) +} +$utilities.AddToolVersion("jq", $(Get-JqVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $utilities.AddToolVersion("mongo", $(Get-MongoVersion)) + $utilities.AddToolVersion("mongod", $(Get-MongodVersion)) +} +if ($os.IsBigSur) { + $utilities.AddToolVersion("Newman", $(Get-NewmanVersion)) +} +$utilities.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion)) +$utilities.AddToolVersion("Packer", $(Get-PackerVersion)) +$utilities.AddToolVersion("pkg-config", $(Get-PKGConfigVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $utilities.AddToolVersion("PostgreSQL", $(Get-PostgresServerVersion)) + $utilities.AddToolVersion("psql (PostgreSQL)", $(Get-PostgresClientVersion)) + $utilities.AddToolVersion("Sox", $(Get-SoxVersion)) + $utilities.AddToolVersion("Subversion (SVN)", $(Get-SVNVersion)) + $utilities.AddToolVersion("Switchaudio-osx", $(Get-SwitchAudioOsxVersion)) +} +if ($os.IsMonterey) { + $utilities.AddToolVersion("Vagrant", $(Get-VagrantVersion)) + $utilities.AddToolVersion("VirtualBox", $(Get-VirtualBoxVersion)) +} +$utilities.AddToolVersion("yq", $(Get-YqVersion)) +$utilities.AddToolVersion("zstd", $(Get-ZstdVersion)) + +# Tools +$tools = $installedSoftware.AddHeader("Tools") +if ($os.IsBigSur) { + $tools.AddToolVersion("Aliyun CLI", $(Get-AliyunCLIVersion)) +} +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $tools.AddToolVersion("App Center CLI", $(Get-AppCenterCLIVersion)) +} +$tools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion)) +$tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion)) +$tools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion)) +$tools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion)) +$tools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion)) +$tools.AddToolVersion("Bicep CLI", $(Get-BicepVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $tools.AddToolVersion("Cabal", $(Get-CabalVersion)) +} +$tools.AddToolVersion("Cmake", $(Get-CmakeVersion)) +$tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion)) +if ($os.IsMonterey) { + $tools.AddToolVersion("Colima", $(Get-ColimaVersion)) +} +$tools.AddToolVersion("Fastlane", $(Get-FastlaneVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $tools.AddToolVersion("GHC", $(Get-GHCVersion)) + $tools.AddToolVersion("GHCup", $(Get-GHCupVersion)) + $tools.AddToolVersion("Jazzy", $(Get-JazzyVersion)) +} +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $tools.AddToolVersion("Stack", $(Get-StackVersion)) +} +$tools.AddToolVersion("SwiftFormat", $(Get-SwiftFormatVersion)) +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $tools.AddToolVersion("Swig", $(Get-SwigVersion)) +} +$tools.AddToolVersion("Xcode Command Line Tools", $(Get-XcodeCommandLineToolsVersion)) + +# Linters +$linters = $installedSoftware.AddHeader("Linters") +if ((-not $os.IsVenturaArm64) -and (-not $os.IsSonomaArm64)) { + $linters.AddToolVersion("SwiftLint", $(Get-SwiftLintVersion)) +} +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $linters.AddToolVersion("Yamllint", $(Get-YamllintVersion)) +} + +# Browsers +$browsers = $installedSoftware.AddHeader("Browsers") +$browsers.AddNodes($(Build-BrowserSection)) +$browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable)) + +# Java +$java = $installedSoftware.AddHeader("Java") +$java.AddTable($(Get-JavaVersions)) + +# Toolcache +if (-not $os.IsSonoma) { + $toolcache = $installedSoftware.AddHeader("Cached Tools") + $toolcache.AddNodes($(Build-ToolcacheSection)) + + # Rust + $rust = $installedSoftware.AddHeader("Rust Tools") + $rust.AddToolVersion("Cargo", $(Get-RustCargoVersion)) + $rust.AddToolVersion("Rust", $(Get-RustVersion)) + $rust.AddToolVersion("Rustdoc", $(Get-RustdocVersion)) + $rust.AddToolVersion("Rustup", $(Get-RustupVersion)) + + $rustPackages = $rust.AddHeader("Packages") + if (-not $os.IsVentura) { + $rustPackages.AddToolVersion("Bindgen", $(Get-Bindgen)) + $rustPackages.AddToolVersion("Cargo-audit", $(Get-Cargoaudit)) + $rustPackages.AddToolVersion("Cargo-outdated", $(Get-Cargooutdated)) + $rustPackages.AddToolVersion("Cbindgen", $(Get-Cbindgen)) + } + $rustPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion)) + $rustPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion)) +} + +# PowerShell +$powerShell = $installedSoftware.AddHeader("PowerShell Tools") +$powerShell.AddToolVersion("PowerShell", $(Get-PowershellVersion)) + +$powerShellModules = $powerShell.AddHeader("PowerShell Modules") +$powerShellModules.AddNodes($(Get-PowerShellModules)) + +# Web Servers +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $webServers = $installedSoftware.AddHeader("Web Servers") + $webServers.AddTable($(Build-WebServersSection)) +} + +# Xamarin section +if ((-not $os.IsVentura) -and (-not $os.IsSonoma)) { + $xamarin = $installedSoftware.AddHeader("Xamarin") + $vsForMac = $xamarin.AddHeader("Visual Studio for Mac") + $vsForMac.AddTable($(Build-VSMacTable)) + $note = + @' +To use Visual Studio 2019 by default rename the app: +mv "/Applications/Visual Studio.app" "/Applications/Visual Studio 2022.app" +mv "/Applications/Visual Studio 2019.app" "/Applications/Visual Studio.app" +'@ + $vsForMacNotes = $vsForMac.AddHeader("Notes") + $vsForMacNotes.AddNote($note) + + $xamarinBundles = $xamarin.AddHeader("Xamarin bundles") + $xamarinBundles.AddTable($(Build-XamarinTable)) + + $unitTestFramework = $xamarin.AddHeader("Unit Test Framework") + $unitTestFramework.AddToolVersion("NUnit", $(Get-NUnitVersion)) +} + +# Xcode section +$xcode = $installedSoftware.AddHeader("Xcode") +# First run doesn't provide full data about devices and runtimes +Get-XcodeInfoList | Out-Null + +$xcodeInfo = Get-XcodeInfoList +$xcode.AddTable($(Build-XcodeTable $xcodeInfo)) + +$xcodeTools = $xcode.AddHeader("Xcode Support Tools") +$xcodeTools.AddNodes($(Build-XcodeSupportToolsSection)) + +$installedSdks = $xcode.AddHeader("Installed SDKs") +$installedSdks.AddTable($(Build-XcodeSDKTable $xcodeInfo)) + +$installedSimulators = $xcode.AddHeader("Installed Simulators") +$installedSimulators.AddTable($(Build-XcodeSimulatorsTable $xcodeInfo)) + +# Android section +$android = $installedSoftware.AddHeader("Android") +$androidTable = Build-AndroidTable +$android.AddTable($androidTable) + +$androidEnv = $android.AddHeader("Environment variables") +$androidEnv.AddTable($(Build-AndroidEnvironmentTable)) + +if ($os.IsBigSur -or $os.IsMonterey) { + $miscellaneous = $installedSoftware.AddHeader("Miscellaneous") + $miscellaneous.AddToolVersion("libXext", $(Get-LibXextVersion)) + $miscellaneous.AddToolVersion("libXft", $(Get-LibXftVersion)) + $miscellaneous.AddToolVersion("Tcl/Tk", $(Get-TclTkVersion)) + $miscellaneous.AddToolVersion("Zlib", $(Get-ZlibVersion)) +} + +if ($os.IsMonterey) { + $miscellaneousEnv = $miscellaneous.AddHeader("Environment variables") + $miscellaneousEnv.AddTable($(Build-MiscellaneousEnvironmentTable)) + + $notes = @' +If you want to use Parallels Desktop you should download a package from URL stored in +PARALLELS_DMG_URL environment variable. A system extension is allowed for this version. +'@ + $miscellaneousEnvNotes = $miscellaneousEnv.AddHeader("Notes") + $miscellaneousEnvNotes.AddNote($notes) +} + +if (-not (Test-Path $OutputDirectory)) { New-Item -Path $OutputDirectory -ItemType Directory | Out-Null } + +# +# Write final reports +# +Write-Host $markdownExtended +$softwareReport.ToJson() | Out-File -FilePath "${OutputDirectory}/systeminfo.json" -Encoding UTF8NoBOM +$softwareReport.ToMarkdown() | Out-File -FilePath "${OutputDirectory}/systeminfo.md" -Encoding UTF8NoBOM diff --git a/images/macos/software-report/SoftwareReport.Java.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Java.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Java.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Java.psm1 diff --git a/images/macos/software-report/SoftwareReport.Toolcache.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Toolcache.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Toolcache.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Toolcache.psm1 diff --git a/images/macos/software-report/SoftwareReport.WebServers.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.WebServers.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.WebServers.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.WebServers.psm1 diff --git a/images/macos/software-report/SoftwareReport.Xamarin.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Xamarin.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Xamarin.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Xamarin.psm1 diff --git a/images/macos/software-report/SoftwareReport.Xcode.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Xcode.psm1 similarity index 100% rename from images/macos/software-report/SoftwareReport.Xcode.psm1 rename to images/macos/scripts/docs-gen/SoftwareReport.Xcode.psm1 diff --git a/images/macos/helpers/Common.Helpers.psm1 b/images/macos/scripts/helpers/Common.Helpers.psm1 similarity index 100% rename from images/macos/helpers/Common.Helpers.psm1 rename to images/macos/scripts/helpers/Common.Helpers.psm1 diff --git a/images/macos/helpers/SoftwareReport.Helpers.psm1 b/images/macos/scripts/helpers/SoftwareReport.Helpers.psm1 similarity index 100% rename from images/macos/helpers/SoftwareReport.Helpers.psm1 rename to images/macos/scripts/helpers/SoftwareReport.Helpers.psm1 diff --git a/images/macos/helpers/Tests.Helpers.psm1 b/images/macos/scripts/helpers/Tests.Helpers.psm1 similarity index 100% rename from images/macos/helpers/Tests.Helpers.psm1 rename to images/macos/scripts/helpers/Tests.Helpers.psm1 diff --git a/images/macos/helpers/Xcode.Helpers.psm1 b/images/macos/scripts/helpers/Xcode.Helpers.psm1 similarity index 100% rename from images/macos/helpers/Xcode.Helpers.psm1 rename to images/macos/scripts/helpers/Xcode.Helpers.psm1 diff --git a/images/macos/helpers/Xcode.Installer.psm1 b/images/macos/scripts/helpers/Xcode.Installer.psm1 similarity index 100% rename from images/macos/helpers/Xcode.Installer.psm1 rename to images/macos/scripts/helpers/Xcode.Installer.psm1 diff --git a/images/macos/provision/utils/confirm-identified-developers.scpt b/images/macos/scripts/helpers/confirm-identified-developers.scpt similarity index 100% rename from images/macos/provision/utils/confirm-identified-developers.scpt rename to images/macos/scripts/helpers/confirm-identified-developers.scpt diff --git a/images/macos/provision/utils/invoke-tests.sh b/images/macos/scripts/helpers/invoke-tests.sh similarity index 100% rename from images/macos/provision/utils/invoke-tests.sh rename to images/macos/scripts/helpers/invoke-tests.sh diff --git a/images/macos/provision/utils/utils.sh b/images/macos/scripts/helpers/utils.sh old mode 100755 new mode 100644 similarity index 100% rename from images/macos/provision/utils/utils.sh rename to images/macos/scripts/helpers/utils.sh diff --git a/images/macos/provision/utils/xamarin-utils.sh b/images/macos/scripts/helpers/xamarin-utils.sh similarity index 100% rename from images/macos/provision/utils/xamarin-utils.sh rename to images/macos/scripts/helpers/xamarin-utils.sh diff --git a/images/macos/tests/ActionArchiveCache.Tests.ps1 b/images/macos/scripts/tests/ActionArchiveCache.Tests.ps1 similarity index 100% rename from images/macos/tests/ActionArchiveCache.Tests.ps1 rename to images/macos/scripts/tests/ActionArchiveCache.Tests.ps1 diff --git a/images/macos/tests/Android.Tests.ps1 b/images/macos/scripts/tests/Android.Tests.ps1 similarity index 97% rename from images/macos/tests/Android.Tests.ps1 rename to images/macos/scripts/tests/Android.Tests.ps1 index d399f558d..fe247262f 100644 --- a/images/macos/tests/Android.Tests.ps1 +++ b/images/macos/scripts/tests/Android.Tests.ps1 @@ -1,82 +1,82 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking -Import-Module "$PSScriptRoot/../software-report/SoftwareReport.Android.psm1" -DisableNameChecking - -$os = Get-OSVersion - -Describe "Android" { - $androidSdkManagerPackages = Get-AndroidPackages - [int]$platformMinVersion = Get-ToolsetValue "android.platform_min_version" - [version]$buildToolsMinVersion = Get-ToolsetValue "android.build_tools_min_version" - [array]$ndkVersions = Get-ToolsetValue "android.ndk.versions" - $ndkFullVersions = $ndkVersions | ForEach-Object { Get-ChildItem "$env:ANDROID_HOME/ndk/${_}.*" -Name | Select-Object -Last 1 } | ForEach-Object { "ndk/${_}" } - # Platforms starting with a letter are the preview versions, which is not installed on the image - $platformVersionsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("platforms;") }) -replace 'platforms;android-', '' | Where-Object { $_ -match "^\d" } | Sort-Object -Unique - $platformsInstalled = $platformVersionsList | Where-Object { [int]($_.Split("-")[0]) -ge $platformMinVersion } | ForEach-Object { "platforms/android-${_}" } - - $buildToolsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("build-tools;") }) -replace 'build-tools;', '' - $buildTools = $buildToolsList | Where-Object { $_ -match "\d+(\.\d+){2,}$" } | Where-Object { [version]$_ -ge $buildToolsMinVersion } | Sort-Object -Unique | - ForEach-Object { "build-tools/${_}" } - - $androidPackages = @( - "tools", - "platform-tools", - "cmake", - $platformsInstalled, - $buildTools, - $ndkFullVersions, - (Get-ToolsetValue "android.extra-list" | ForEach-Object { "extras/${_}" }), - (Get-ToolsetValue "android.addon-list" | ForEach-Object { "add-ons/${_}" }), - (Get-ToolsetValue "android.additional-tools") - ) | ForEach-Object { $_ } - - # Remove empty strings from array to avoid possible issues - $androidPackages = $androidPackages | Where-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 "SDKManagers" { - $testCases = @( - @{ - PackageName = "Command-line tools" - Sdkmanager = "$env:ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" - } - ) - if ($os.IsBigSur -or $os.IsMonterey) { - $testCases += @( - @{ - PackageName = "SDK tools" - Sdkmanager = "$env:ANDROID_HOME/tools/bin/sdkmanager" - } - ) - } - - It "Sdkmanager from is available" -TestCases $testCases { - "$Sdkmanager --version" | Should -ReturnZeroExitCode - } - } - - Context "Packages" { - $testCases = $androidPackages | ForEach-Object { @{ PackageName = $_ } } - - It "" -TestCases $testCases { - param ([string] $PackageName) - Validate-AndroidPackage $PackageName - } - } -} +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/../software-report/SoftwareReport.Android.psm1" -DisableNameChecking + +$os = Get-OSVersion + +Describe "Android" { + $androidSdkManagerPackages = Get-AndroidPackages + [int]$platformMinVersion = Get-ToolsetValue "android.platform_min_version" + [version]$buildToolsMinVersion = Get-ToolsetValue "android.build_tools_min_version" + [array]$ndkVersions = Get-ToolsetValue "android.ndk.versions" + $ndkFullVersions = $ndkVersions | ForEach-Object { Get-ChildItem "$env:ANDROID_HOME/ndk/${_}.*" -Name | Select-Object -Last 1 } | ForEach-Object { "ndk/${_}" } + # Platforms starting with a letter are the preview versions, which is not installed on the image + $platformVersionsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("platforms;") }) -replace 'platforms;android-', '' | Where-Object { $_ -match "^\d" } | Sort-Object -Unique + $platformsInstalled = $platformVersionsList | Where-Object { [int]($_.Split("-")[0]) -ge $platformMinVersion } | ForEach-Object { "platforms/android-${_}" } + + $buildToolsList = ($androidSdkManagerPackages | Where-Object { "$_".StartsWith("build-tools;") }) -replace 'build-tools;', '' + $buildTools = $buildToolsList | Where-Object { $_ -match "\d+(\.\d+){2,}$" } | Where-Object { [version]$_ -ge $buildToolsMinVersion } | Sort-Object -Unique | + ForEach-Object { "build-tools/${_}" } + + $androidPackages = @( + "tools", + "platform-tools", + "cmake", + $platformsInstalled, + $buildTools, + $ndkFullVersions, + (Get-ToolsetValue "android.extra-list" | ForEach-Object { "extras/${_}" }), + (Get-ToolsetValue "android.addon-list" | ForEach-Object { "add-ons/${_}" }), + (Get-ToolsetValue "android.additional-tools") + ) | ForEach-Object { $_ } + + # Remove empty strings from array to avoid possible issues + $androidPackages = $androidPackages | Where-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 "SDKManagers" { + $testCases = @( + @{ + PackageName = "Command-line tools" + Sdkmanager = "$env:ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" + } + ) + if ($os.IsBigSur -or $os.IsMonterey) { + $testCases += @( + @{ + PackageName = "SDK tools" + Sdkmanager = "$env:ANDROID_HOME/tools/bin/sdkmanager" + } + ) + } + + It "Sdkmanager from is available" -TestCases $testCases { + "$Sdkmanager --version" | Should -ReturnZeroExitCode + } + } + + Context "Packages" { + $testCases = $androidPackages | ForEach-Object { @{ PackageName = $_ } } + + It "" -TestCases $testCases { + param ([string] $PackageName) + Validate-AndroidPackage $PackageName + } + } +} diff --git a/images/macos/tests/BasicTools.Tests.ps1 b/images/macos/scripts/tests/BasicTools.Tests.ps1 similarity index 100% rename from images/macos/tests/BasicTools.Tests.ps1 rename to images/macos/scripts/tests/BasicTools.Tests.ps1 diff --git a/images/macos/tests/Browsers.Tests.ps1 b/images/macos/scripts/tests/Browsers.Tests.ps1 similarity index 100% rename from images/macos/tests/Browsers.Tests.ps1 rename to images/macos/scripts/tests/Browsers.Tests.ps1 diff --git a/images/macos/tests/Common.Tests.ps1 b/images/macos/scripts/tests/Common.Tests.ps1 similarity index 100% rename from images/macos/tests/Common.Tests.ps1 rename to images/macos/scripts/tests/Common.Tests.ps1 diff --git a/images/macos/tests/Databases.Tests.ps1 b/images/macos/scripts/tests/Databases.Tests.ps1 similarity index 100% rename from images/macos/tests/Databases.Tests.ps1 rename to images/macos/scripts/tests/Databases.Tests.ps1 diff --git a/images/macos/tests/Git.Tests.ps1 b/images/macos/scripts/tests/Git.Tests.ps1 similarity index 100% rename from images/macos/tests/Git.Tests.ps1 rename to images/macos/scripts/tests/Git.Tests.ps1 diff --git a/images/macos/tests/Haskell.Tests.ps1 b/images/macos/scripts/tests/Haskell.Tests.ps1 similarity index 100% rename from images/macos/tests/Haskell.Tests.ps1 rename to images/macos/scripts/tests/Haskell.Tests.ps1 diff --git a/images/macos/tests/Java.Tests.ps1 b/images/macos/scripts/tests/Java.Tests.ps1 similarity index 100% rename from images/macos/tests/Java.Tests.ps1 rename to images/macos/scripts/tests/Java.Tests.ps1 diff --git a/images/macos/tests/LLVM.Tests.ps1 b/images/macos/scripts/tests/LLVM.Tests.ps1 similarity index 100% rename from images/macos/tests/LLVM.Tests.ps1 rename to images/macos/scripts/tests/LLVM.Tests.ps1 diff --git a/images/macos/tests/Linters.Tests.ps1 b/images/macos/scripts/tests/Linters.Tests.ps1 similarity index 96% rename from images/macos/tests/Linters.Tests.ps1 rename to images/macos/scripts/tests/Linters.Tests.ps1 index d4a2fdded..38fcfda5c 100644 --- a/images/macos/tests/Linters.Tests.ps1 +++ b/images/macos/scripts/tests/Linters.Tests.ps1 @@ -1,9 +1,9 @@ -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -$os = Get-OSVersion - -Describe "SwiftLint" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) { - It "SwiftLint" { - "swiftlint version" | Should -ReturnZeroExitCode - } -} +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$os = Get-OSVersion + +Describe "SwiftLint" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) { + It "SwiftLint" { + "swiftlint version" | Should -ReturnZeroExitCode + } +} diff --git a/images/macos/tests/Node.Tests.ps1 b/images/macos/scripts/tests/Node.Tests.ps1 similarity index 96% rename from images/macos/tests/Node.Tests.ps1 rename to images/macos/scripts/tests/Node.Tests.ps1 index 6c11f161a..28a81f639 100644 --- a/images/macos/tests/Node.Tests.ps1 +++ b/images/macos/scripts/tests/Node.Tests.ps1 @@ -1,56 +1,56 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -$os = Get-OSVersion - -Describe "Node.js" { - It "Node.js is installed" { - "node --version" | Should -ReturnZeroExitCode - } - - It "Node.js version should correspond to the version in the toolset" { - node --version | Should -BeLike "v$(Get-ToolsetValue 'node.default')*" - } - - It "NPM is installed" { - "npm --version" | Should -ReturnZeroExitCode - } - - It "Yarn is installed" { - "yarn --version" | Should -ReturnZeroExitCode - } -} - -Describe "nvm" -Skip:($os.IsVentura -or $os.IsSonoma) { - 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" { - [array]$nvmVersions = Get-ToolsetValue 'node.nvm_versions' - $testCases = $nvmVersions | ForEach-Object { @{NvmVersion = $_} } - - It "" -TestCases $testCases { - param ( - [string] $NvmVersion - ) - - "$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode - } - } -} - -Describe "Global NPM Packages" { - $globalNpmPackages = Get-ToolsetValue "npm.global_packages" - $globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } } - - It "" -TestCases $globalNpmPackagesWithTests { - $Test | Should -ReturnZeroExitCode - } -} +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$os = Get-OSVersion + +Describe "Node.js" { + It "Node.js is installed" { + "node --version" | Should -ReturnZeroExitCode + } + + It "Node.js version should correspond to the version in the toolset" { + node --version | Should -BeLike "v$(Get-ToolsetValue 'node.default')*" + } + + It "NPM is installed" { + "npm --version" | Should -ReturnZeroExitCode + } + + It "Yarn is installed" { + "yarn --version" | Should -ReturnZeroExitCode + } +} + +Describe "nvm" -Skip:($os.IsVentura -or $os.IsSonoma) { + 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" { + [array]$nvmVersions = Get-ToolsetValue 'node.nvm_versions' + $testCases = $nvmVersions | ForEach-Object { @{NvmVersion = $_} } + + It "" -TestCases $testCases { + param ( + [string] $NvmVersion + ) + + "$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode + } + } +} + +Describe "Global NPM Packages" { + $globalNpmPackages = Get-ToolsetValue "npm.global_packages" + $globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } } + + It "" -TestCases $globalNpmPackagesWithTests { + $Test | Should -ReturnZeroExitCode + } +} diff --git a/images/macos/tests/OpenSSL.Tests.ps1 b/images/macos/scripts/tests/OpenSSL.Tests.ps1 similarity index 100% rename from images/macos/tests/OpenSSL.Tests.ps1 rename to images/macos/scripts/tests/OpenSSL.Tests.ps1 diff --git a/images/macos/tests/PHP.Tests.ps1 b/images/macos/scripts/tests/PHP.Tests.ps1 similarity index 100% rename from images/macos/tests/PHP.Tests.ps1 rename to images/macos/scripts/tests/PHP.Tests.ps1 diff --git a/images/macos/tests/PipxPackages.Tests.ps1 b/images/macos/scripts/tests/PipxPackages.Tests.ps1 similarity index 100% rename from images/macos/tests/PipxPackages.Tests.ps1 rename to images/macos/scripts/tests/PipxPackages.Tests.ps1 diff --git a/images/macos/tests/Powershell.Tests.ps1 b/images/macos/scripts/tests/Powershell.Tests.ps1 similarity index 97% rename from images/macos/tests/Powershell.Tests.ps1 rename to images/macos/scripts/tests/Powershell.Tests.ps1 index 0674b1ef0..939957472 100644 --- a/images/macos/tests/Powershell.Tests.ps1 +++ b/images/macos/scripts/tests/Powershell.Tests.ps1 @@ -1,43 +1,43 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -Describe "Powershell" { - Context "Powershell is installed" { - 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 " is installed" -TestCases $withoutVersionsModules { - param ( - [string] $moduleName - ) - - Get-Module -Name $moduleName -ListAvailable | Should -BeTrue - } - - if ($withVersionsModules) { - It " with is installed" -TestCases $withVersionsModules { - param ( - [string] $moduleName, - [string] $expectedVersion - ) - - (Get-Module -Name $moduleName -ListAvailable).Version -contains $expectedVersion | Should -BeTrue - } - } - } +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +Describe "Powershell" { + Context "Powershell is installed" { + 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 " is installed" -TestCases $withoutVersionsModules { + param ( + [string] $moduleName + ) + + Get-Module -Name $moduleName -ListAvailable | Should -BeTrue + } + + if ($withVersionsModules) { + It " with is installed" -TestCases $withVersionsModules { + param ( + [string] $moduleName, + [string] $expectedVersion + ) + + (Get-Module -Name $moduleName -ListAvailable).Version -contains $expectedVersion | Should -BeTrue + } + } + } } \ No newline at end of file diff --git a/images/macos/tests/Python.Tests.ps1 b/images/macos/scripts/tests/Python.Tests.ps1 similarity index 97% rename from images/macos/tests/Python.Tests.ps1 rename to images/macos/scripts/tests/Python.Tests.ps1 index 012f78084..6126ee9f2 100644 --- a/images/macos/tests/Python.Tests.ps1 +++ b/images/macos/scripts/tests/Python.Tests.ps1 @@ -1,44 +1,44 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -$os = Get-OSVersion - -Describe "Python3" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) { - 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 3 is available" { - "pip3 --version" | Should -ReturnZeroExitCode - } - - It "Pipx is available" { - "pipx --version" | Should -ReturnZeroExitCode - } - - It "Pip 3 and Python 3 came from the same brew formula" { - $pip3Path = Split-Path (readlink (which pip3)) - $python3Path = Split-Path (readlink (which python3)) - $pip3Path | Should -BeExactly $python3Path - } - -} - -Describe "Python2" -Skip:($os.IsVentura -or $os.IsSonoma) { - It "Python 2 is available" { - "/Library/Frameworks/Python.framework/Versions/2.7/bin/python --version" | Should -ReturnZeroExitCode - } - - It "Pip 2 is available" { - "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip --version" | Should -ReturnZeroExitCode - } - - It "2to3 symlink does not point to Python 2" { - $2to3path = (Get-ChildItem (Get-Command 2to3).Path).Target - $2to3path | Should -Not -BeLike '/Frameworks/Python.framework/Versions/2.*' - } -} +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$os = Get-OSVersion + +Describe "Python3" -Skip:($os.IsVenturaArm64 -or $os.IsSonomaArm64) { + 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 3 is available" { + "pip3 --version" | Should -ReturnZeroExitCode + } + + It "Pipx is available" { + "pipx --version" | Should -ReturnZeroExitCode + } + + It "Pip 3 and Python 3 came from the same brew formula" { + $pip3Path = Split-Path (readlink (which pip3)) + $python3Path = Split-Path (readlink (which python3)) + $pip3Path | Should -BeExactly $python3Path + } + +} + +Describe "Python2" -Skip:($os.IsVentura -or $os.IsSonoma) { + It "Python 2 is available" { + "/Library/Frameworks/Python.framework/Versions/2.7/bin/python --version" | Should -ReturnZeroExitCode + } + + It "Pip 2 is available" { + "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip --version" | Should -ReturnZeroExitCode + } + + It "2to3 symlink does not point to Python 2" { + $2to3path = (Get-ChildItem (Get-Command 2to3).Path).Target + $2to3path | Should -Not -BeLike '/Frameworks/Python.framework/Versions/2.*' + } +} diff --git a/images/macos/tests/Ruby.arm64.Tests.ps1 b/images/macos/scripts/tests/Ruby.arm64.Tests.ps1 similarity index 100% rename from images/macos/tests/Ruby.arm64.Tests.ps1 rename to images/macos/scripts/tests/Ruby.arm64.Tests.ps1 diff --git a/images/macos/tests/Ruby.x64.Tests.ps1 b/images/macos/scripts/tests/Ruby.x64.Tests.ps1 similarity index 100% rename from images/macos/tests/Ruby.x64.Tests.ps1 rename to images/macos/scripts/tests/Ruby.x64.Tests.ps1 diff --git a/images/macos/tests/RubyGem.Tests.ps1 b/images/macos/scripts/tests/RubyGem.Tests.ps1 similarity index 100% rename from images/macos/tests/RubyGem.Tests.ps1 rename to images/macos/scripts/tests/RubyGem.Tests.ps1 diff --git a/images/macos/tests/RunAll-Tests.ps1 b/images/macos/scripts/tests/RunAll-Tests.ps1 similarity index 100% rename from images/macos/tests/RunAll-Tests.ps1 rename to images/macos/scripts/tests/RunAll-Tests.ps1 diff --git a/images/macos/tests/Rust.Tests.ps1 b/images/macos/scripts/tests/Rust.Tests.ps1 similarity index 100% rename from images/macos/tests/Rust.Tests.ps1 rename to images/macos/scripts/tests/Rust.Tests.ps1 diff --git a/images/macos/tests/System.Tests.ps1 b/images/macos/scripts/tests/System.Tests.ps1 similarity index 100% rename from images/macos/tests/System.Tests.ps1 rename to images/macos/scripts/tests/System.Tests.ps1 diff --git a/images/macos/tests/Toolcache.Tests.ps1 b/images/macos/scripts/tests/Toolcache.Tests.ps1 similarity index 100% rename from images/macos/tests/Toolcache.Tests.ps1 rename to images/macos/scripts/tests/Toolcache.Tests.ps1 diff --git a/images/macos/toolsets/Toolset.Tests.ps1 b/images/macos/scripts/tests/Toolset.Tests.ps1 similarity index 97% rename from images/macos/toolsets/Toolset.Tests.ps1 rename to images/macos/scripts/tests/Toolset.Tests.ps1 index 8e5b69ef2..098d15629 100644 --- a/images/macos/toolsets/Toolset.Tests.ps1 +++ b/images/macos/scripts/tests/Toolset.Tests.ps1 @@ -1,144 +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" - } - - } - - } - } +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" + } + + } + + } + } } \ No newline at end of file diff --git a/images/macos/tests/WebServers.Tests.ps1 b/images/macos/scripts/tests/WebServers.Tests.ps1 similarity index 100% rename from images/macos/tests/WebServers.Tests.ps1 rename to images/macos/scripts/tests/WebServers.Tests.ps1 diff --git a/images/macos/tests/Xamarin.Tests.ps1 b/images/macos/scripts/tests/Xamarin.Tests.ps1 similarity index 97% rename from images/macos/tests/Xamarin.Tests.ps1 rename to images/macos/scripts/tests/Xamarin.Tests.ps1 index 335183345..8eb12ba35 100644 --- a/images/macos/tests/Xamarin.Tests.ps1 +++ b/images/macos/scripts/tests/Xamarin.Tests.ps1 @@ -1,309 +1,309 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -$os = Get-OSVersion -if ($os.IsVentura -or $os.IsSonoma) { - $MONO_VERSIONS = @(Get-ToolsetValue "mono.framework.version") - $XAMARIN_IOS_VERSIONS = @() - $XAMARIN_MAC_VERSIONS = @() - $XAMARIN_ANDROID_VERSIONS = @() -} elseif ($os.IsBigSur -or $os.IsMonterey) { - $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 - } - } - } - - It "MSBuild is available" { - "msbuild -version" | Should -ReturnZeroExitCode - } -} - -Describe "Xamarin.iOS" -Skip:($os.IsVentura -or $os.IsSonoma) { - $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" -Skip:($os.IsVentura -or $os.IsSonoma) { - $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" -Skip:($os.IsVentura -or $os.IsSonoma) { - $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" -Skip:($os.IsVentura -or $os.IsSonoma) { - 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" - } - - If ($XAMARIN_BUNDLES.Count -eq 0) { return } # Skip this test if there are no bundles - - [array]$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 exists" -TestCases $allBundles { - param ( [string] $BundleSymlink ) - - (Join-Path $MONO_VERSIONS_PATH $BundleSymlink) | Should -Exist - } - - It "Mono symlink 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 exists" -TestCases $allBundles { - param ( [string] $BundleSymlink ) - - (Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink) | Should -Exist - } - - It "iOS symlink 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 exists" -TestCases $allBundles { - param ( [string] $BundleSymlink ) - - (Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink) | Should -Exist - } - - It "Mac symlink 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 exists" -TestCases $allBundles { - param ( [string] $BundleSymlink ) - - (Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink) | Should -Exist - } - - It "Android symlink 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 - } -} - -Describe "Nuget" -Skip:($os.IsVentura -or $os.IsSonoma) { - It "Nuget config contains nuget.org feed" { - Get-Content $env:HOME/.config/NuGet/NuGet.Config | Out-String | Should -Match "nuget.org" - } -} +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$os = Get-OSVersion +if ($os.IsVentura -or $os.IsSonoma) { + $MONO_VERSIONS = @(Get-ToolsetValue "mono.framework.version") + $XAMARIN_IOS_VERSIONS = @() + $XAMARIN_MAC_VERSIONS = @() + $XAMARIN_ANDROID_VERSIONS = @() +} elseif ($os.IsBigSur -or $os.IsMonterey) { + $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 + } + } + } + + It "MSBuild is available" { + "msbuild -version" | Should -ReturnZeroExitCode + } +} + +Describe "Xamarin.iOS" -Skip:($os.IsVentura -or $os.IsSonoma) { + $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" -Skip:($os.IsVentura -or $os.IsSonoma) { + $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" -Skip:($os.IsVentura -or $os.IsSonoma) { + $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" -Skip:($os.IsVentura -or $os.IsSonoma) { + 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" + } + + If ($XAMARIN_BUNDLES.Count -eq 0) { return } # Skip this test if there are no bundles + + [array]$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 exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $MONO_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "Mono symlink 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 exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "iOS symlink 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 exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "Mac symlink 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 exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "Android symlink 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 + } +} + +Describe "Nuget" -Skip:($os.IsVentura -or $os.IsSonoma) { + It "Nuget config contains nuget.org feed" { + Get-Content $env:HOME/.config/NuGet/NuGet.Config | Out-String | Should -Match "nuget.org" + } +} diff --git a/images/macos/tests/Xcode.Tests.ps1 b/images/macos/scripts/tests/Xcode.Tests.ps1 similarity index 97% rename from images/macos/tests/Xcode.Tests.ps1 rename to images/macos/scripts/tests/Xcode.Tests.ps1 index 5eb49fdb5..6909fdcbf 100644 --- a/images/macos/tests/Xcode.Tests.ps1 +++ b/images/macos/scripts/tests/Xcode.Tests.ps1 @@ -1,136 +1,136 @@ -Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1" -Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking - -$ARCH = Get-Architecture -$xcodeVersions = Get-ToolsetValue "xcode.$ARCH.versions" -$defaultXcode = Get-ToolsetValue "xcode.default" -$latestXcodeVersion = $xcodeVersions | Select-Object -First 1 -$os = Get-OSVersion - -Describe "Xcode" { - $testCases = $xcodeVersions | ForEach-Object { @{ XcodeVersion = $_.link; LatestXcodeVersion = $xcodeVersions[0].link; Symlinks = $_.symlinks } } - - Context "Versions" { - It "" -TestCases $testCases { - $xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild" - "$xcodebuildPath -version" | Should -ReturnZeroExitCode - } - } - - Context "Default" { - $defaultXcodeTestCase = @{ DefaultXcode = $defaultXcode } - It "Default Xcode is " -TestCases $defaultXcodeTestCase { - "xcodebuild -version" | Should -ReturnZeroExitCode - (Get-CommandResult "xcodebuild -version").Output | Should -BeLike "Xcode ${DefaultXcode}*" - } - - It "Xcode.app points to default Xcode" -TestCases $defaultXcodeTestCase { - $xcodeApp = "/Applications/Xcode.app" - $expectedTarget = Get-XcodeRootPath -Version $DefaultXcode - $xcodeApp | Should -Exist - $expectedTarget | Should -Exist - (Get-Item $xcodeApp).Target | Should -Be $expectedTarget - } - } - - Context "Additional tools" { - It "Xcode tools are installed" -TestCases $testCases { - $TOOLS_NOT_INSTALLED_EXIT_CODE = 69 - $xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild" - $result = Get-CommandResult "$xcodebuildPath -checkFirstLaunchStatus" - - if ($XcodeVersion -ne $LatestXcodeVersion) { - $result.ExitCode | Should -Not -Be $TOOLS_NOT_INSTALLED_EXIT_CODE - } else { - $result.ExitCode | Should -BeIn (0, $TOOLS_NOT_INSTALLED_EXIT_CODE) - } - } - } - - Context "Symlinks" { - It "Xcode has correct symlinks" -TestCases $testCases { - $sourcePath = Get-XcodeRootPath -Version $XcodeVersion - $Symlinks | Where-Object { $_ } | ForEach-Object { - $targetPath = Get-XcodeRootPath -Version $_ - $targetPath | Should -Exist - (Get-Item $targetPath).Target | Should -Be $sourcePath - } - } - } - - It "/Applications/Xcode* symlinks are valid" { - $symlinks = Get-ChildItem "/Applications" -Filter "Xcode*" | Where-Object { $_.LinkType } - - $symlinks.Target | ForEach-Object { - $_ | Should -Exist - } - } -} - -Describe "XCODE_DEVELOPER_DIR variables" { - $exactVersionsList = $xcodeVersions.link | Where-Object { Test-XcodeStableRelease -Version $_ } | ForEach-Object { - $xcodeRootPath = Get-XcodeRootPath -Version $_ - $xcodeVersionInfo = Get-XcodeVersionInfo -XcodeRootPath $xcodeRootPath - return @{ - RootPath = $xcodeRootPath - Version = [SemVer]::Parse($xcodeVersionInfo.Version) - } - } | Sort-Object -Property Version -Descending - $majorVersions = $exactVersionsList.Version.Major | Select-Object -Unique - $testCases = $majorVersions | ForEach-Object { @{ MajorVersion = $_; VersionsList = $exactVersionsList } } - - It "XCODE__DEVELOPER_DIR" -TestCases $testCases { - $variableName = "XCODE_${MajorVersion}_DEVELOPER_DIR" - $actualPath = Get-EnvironmentVariable $variableName - $expectedVersion = $VersionsList | Where-Object { $_.Version.Major -eq $MajorVersion } | Select-Object -First 1 - $expectedPath = "$($expectedVersion.RootPath)/Contents/Developer" - $actualPath | Should -Exist - $actualPath | Should -Be $expectedPath - } -} - -Describe "Xcode simulators" { - $xcodeVersions.link | Where-Object { Test-XcodeStableRelease -Version $_ } | ForEach-Object { - Context "$_" { - $testCase = @{ XcodeVersion = $_ } - It "No duplicates in devices" -TestCases $testCase { - Switch-Xcode -Version $XcodeVersion - [array]$devicesList = @(Get-XcodeDevicesList | Where-Object { $_ }) - Write-Host "Devices for $XcodeVersion" - Write-Host ($devicesList -join "`n") - Validate-ArrayWithoutDuplicates $devicesList -Because "Found duplicate device simulators" - } - -# It "No duplicates in pairs" -TestCases $testCase { -# Switch-Xcode -Version $XcodeVersion -# [array]$pairsList = @(Get-XcodePairsList | Where-Object { $_ }) -# Write-Host "Pairs for $XcodeVersion" -# Write-Host ($pairsList -join "`n") -# Validate-ArrayWithoutDuplicates $pairsList -Because "Found duplicate pairs simulators" -# } - } - } - - AfterEach { - $defaultXcode = Get-ToolsetValue "xcode.default" - Switch-Xcode -Version $defaultXcode - } -} - -Describe "Xcode Simulators Naming" -Skip:(-not $os.IsMonterey) { - $testCases = Get-BrokenXcodeSimulatorsList - It "Simulator ' []'" -TestCases $testCases { - $simctlPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "simctl" - [string]$rawDevicesInfo = Invoke-Expression "$simctlPath list devices --json" - $jsonDevicesInfo = ($rawDevicesInfo | ConvertFrom-Json).devices - - $foundSimulators = $jsonDevicesInfo.$RuntimeId | Where-Object { $_.deviceTypeIdentifier -eq $DeviceId } - $foundSimulators | Should -HaveCount 1 - $foundSimulators[0].name | Should -Be $SimulatorName - - $foundSimulators = $jsonDevicesInfo.$RuntimeId | Where-Object { $_.name -eq $SimulatorName } - $foundSimulators | Should -HaveCount 1 - $foundSimulators[0].deviceTypeIdentifier | Should -Be $DeviceId - } +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking + +$ARCH = Get-Architecture +$xcodeVersions = Get-ToolsetValue "xcode.$ARCH.versions" +$defaultXcode = Get-ToolsetValue "xcode.default" +$latestXcodeVersion = $xcodeVersions | Select-Object -First 1 +$os = Get-OSVersion + +Describe "Xcode" { + $testCases = $xcodeVersions | ForEach-Object { @{ XcodeVersion = $_.link; LatestXcodeVersion = $xcodeVersions[0].link; Symlinks = $_.symlinks } } + + Context "Versions" { + It "" -TestCases $testCases { + $xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild" + "$xcodebuildPath -version" | Should -ReturnZeroExitCode + } + } + + Context "Default" { + $defaultXcodeTestCase = @{ DefaultXcode = $defaultXcode } + It "Default Xcode is " -TestCases $defaultXcodeTestCase { + "xcodebuild -version" | Should -ReturnZeroExitCode + (Get-CommandResult "xcodebuild -version").Output | Should -BeLike "Xcode ${DefaultXcode}*" + } + + It "Xcode.app points to default Xcode" -TestCases $defaultXcodeTestCase { + $xcodeApp = "/Applications/Xcode.app" + $expectedTarget = Get-XcodeRootPath -Version $DefaultXcode + $xcodeApp | Should -Exist + $expectedTarget | Should -Exist + (Get-Item $xcodeApp).Target | Should -Be $expectedTarget + } + } + + Context "Additional tools" { + It "Xcode tools are installed" -TestCases $testCases { + $TOOLS_NOT_INSTALLED_EXIT_CODE = 69 + $xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild" + $result = Get-CommandResult "$xcodebuildPath -checkFirstLaunchStatus" + + if ($XcodeVersion -ne $LatestXcodeVersion) { + $result.ExitCode | Should -Not -Be $TOOLS_NOT_INSTALLED_EXIT_CODE + } else { + $result.ExitCode | Should -BeIn (0, $TOOLS_NOT_INSTALLED_EXIT_CODE) + } + } + } + + Context "Symlinks" { + It "Xcode has correct symlinks" -TestCases $testCases { + $sourcePath = Get-XcodeRootPath -Version $XcodeVersion + $Symlinks | Where-Object { $_ } | ForEach-Object { + $targetPath = Get-XcodeRootPath -Version $_ + $targetPath | Should -Exist + (Get-Item $targetPath).Target | Should -Be $sourcePath + } + } + } + + It "/Applications/Xcode* symlinks are valid" { + $symlinks = Get-ChildItem "/Applications" -Filter "Xcode*" | Where-Object { $_.LinkType } + + $symlinks.Target | ForEach-Object { + $_ | Should -Exist + } + } +} + +Describe "XCODE_DEVELOPER_DIR variables" { + $exactVersionsList = $xcodeVersions.link | Where-Object { Test-XcodeStableRelease -Version $_ } | ForEach-Object { + $xcodeRootPath = Get-XcodeRootPath -Version $_ + $xcodeVersionInfo = Get-XcodeVersionInfo -XcodeRootPath $xcodeRootPath + return @{ + RootPath = $xcodeRootPath + Version = [SemVer]::Parse($xcodeVersionInfo.Version) + } + } | Sort-Object -Property Version -Descending + $majorVersions = $exactVersionsList.Version.Major | Select-Object -Unique + $testCases = $majorVersions | ForEach-Object { @{ MajorVersion = $_; VersionsList = $exactVersionsList } } + + It "XCODE__DEVELOPER_DIR" -TestCases $testCases { + $variableName = "XCODE_${MajorVersion}_DEVELOPER_DIR" + $actualPath = Get-EnvironmentVariable $variableName + $expectedVersion = $VersionsList | Where-Object { $_.Version.Major -eq $MajorVersion } | Select-Object -First 1 + $expectedPath = "$($expectedVersion.RootPath)/Contents/Developer" + $actualPath | Should -Exist + $actualPath | Should -Be $expectedPath + } +} + +Describe "Xcode simulators" { + $xcodeVersions.link | Where-Object { Test-XcodeStableRelease -Version $_ } | ForEach-Object { + Context "$_" { + $testCase = @{ XcodeVersion = $_ } + It "No duplicates in devices" -TestCases $testCase { + Switch-Xcode -Version $XcodeVersion + [array]$devicesList = @(Get-XcodeDevicesList | Where-Object { $_ }) + Write-Host "Devices for $XcodeVersion" + Write-Host ($devicesList -join "`n") + Validate-ArrayWithoutDuplicates $devicesList -Because "Found duplicate device simulators" + } + +# It "No duplicates in pairs" -TestCases $testCase { +# Switch-Xcode -Version $XcodeVersion +# [array]$pairsList = @(Get-XcodePairsList | Where-Object { $_ }) +# Write-Host "Pairs for $XcodeVersion" +# Write-Host ($pairsList -join "`n") +# Validate-ArrayWithoutDuplicates $pairsList -Because "Found duplicate pairs simulators" +# } + } + } + + AfterEach { + $defaultXcode = Get-ToolsetValue "xcode.default" + Switch-Xcode -Version $defaultXcode + } +} + +Describe "Xcode Simulators Naming" -Skip:(-not $os.IsMonterey) { + $testCases = Get-BrokenXcodeSimulatorsList + It "Simulator ' []'" -TestCases $testCases { + $simctlPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "simctl" + [string]$rawDevicesInfo = Invoke-Expression "$simctlPath list devices --json" + $jsonDevicesInfo = ($rawDevicesInfo | ConvertFrom-Json).devices + + $foundSimulators = $jsonDevicesInfo.$RuntimeId | Where-Object { $_.deviceTypeIdentifier -eq $DeviceId } + $foundSimulators | Should -HaveCount 1 + $foundSimulators[0].name | Should -Be $SimulatorName + + $foundSimulators = $jsonDevicesInfo.$RuntimeId | Where-Object { $_.name -eq $SimulatorName } + $foundSimulators | Should -HaveCount 1 + $foundSimulators[0].deviceTypeIdentifier | Should -Be $DeviceId + } } \ No newline at end of file diff --git a/images/macos/templates/macOS-11.json b/images/macos/templates/macOS-11.json index 814580fbf..4e9804358 100644 --- a/images/macos/templates/macOS-11.json +++ b/images/macos/templates/macOS-11.json @@ -45,52 +45,37 @@ }, { "type": "file", - "source": "./provision/assets", - "destination": "~/image-generation/" - }, - { - "type": "file", - "source": "./tests", - "destination": "~/image-generation/" - }, - { - "type": "file", - "source": "./software-report", + "sources": [ + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" + ], "destination": "~/image-generation/" }, { "type": "file", "source": "../../helpers/software-report-base", - "destination": "~/image-generation/software-report/" + "destination": "~/image-generation/docs-gen/" }, { "type": "file", - "source": "./helpers", - "destination": "~/image-generation/" - }, - { - "type": "file", - "source": "./provision/configuration/add-certificate.swift", + "source": "./assets/add-certificate.swift", "destination": "~/image-generation/add-certificate.swift" }, { "type": "file", - "source": "./provision/configuration/environment/bashrc", + "source": "./assets/bashrc", "destination": "~/.bashrc" }, { "type": "file", - "source": "./provision/configuration/environment/bashprofile", + "source": "./assets/bashprofile", "destination": "~/.bash_profile" }, { "type": "file", - "source": "./provision/utils", - "destination": "~/" - }, - { - "type": "file", - "source": "./provision/bootstrap-provisioner", + "source": "./assets/bootstrap-provisioner", "destination": "~/bootstrap" }, { @@ -98,26 +83,39 @@ "source": "./toolsets/toolset-11.json", "destination": "~/image-generation/toolset.json" }, + { + "type": "shell", + "inline": [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh" ] }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/core/xcode-clt.sh", - "./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" + "./scripts/build/xcode-clt.sh", + "./scripts/build/add-network-interface-detection.sh", + "./scripts/build/autologin.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/screensaver-off.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/max-files.sh", + "./scripts/build/shell-change.sh" ], "environment_vars": [ "PASSWORD={{user `vm_password`}}", @@ -128,9 +126,9 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `build_id`}}", @@ -140,7 +138,7 @@ { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "script": "./provision/core/reboot.sh", + "script": "./scripts/build/reboot.sh", "expect_disconnect": true }, { @@ -148,17 +146,17 @@ "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "pause_before": "30s", "scripts": [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.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/git.sh", - "./provision/core/mongodb.sh", - "./provision/core/node.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/python.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/mongodb.sh", + "./scripts/build/node.sh" ], "environment_vars": [ "API_PAT={{user `github_api_pat`}}" @@ -167,7 +165,7 @@ { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", - "script": "./provision/core/xcode.ps1", + "script": "./scripts/build/xcode.ps1", "environment_vars": [ "XCODE_INSTALL_STORAGE_URL={{user `xcode_install_storage_url`}}", "XCODE_INSTALL_SAS={{user `xcode_install_sas`}}" @@ -176,43 +174,43 @@ { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "script": "./provision/core/reboot.sh", + "script": "./scripts/build/reboot.sh", "expect_disconnect": true }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/core/action-archive-cache.sh", - "./provision/core/commonutils.sh", - "./provision/core/llvm.sh", - "./provision/core/golang.sh", - "./provision/core/swiftlint.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/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/xamarin.sh", - "./provision/core/vsmac.sh", - "./provision/core/nvm.sh", - "./provision/core/apache.sh", - "./provision/core/nginx.sh", - "./provision/core/postgresql.sh", - "./provision/core/audiodevice.sh", - "./provision/core/vcpkg.sh", - "./provision/core/miniconda.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/edge.sh", - "./provision/core/firefox.sh", - "./provision/core/pypy.sh", - "./provision/core/pipx-packages.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/commonutils.sh", + "./scripts/build/llvm.sh", + "./scripts/build/golang.sh", + "./scripts/build/swiftlint.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/php.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/haskell.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/xamarin.sh", + "./scripts/build/vsmac.sh", + "./scripts/build/nvm.sh", + "./scripts/build/apache.sh", + "./scripts/build/nginx.sh", + "./scripts/build/postgresql.sh", + "./scripts/build/audiodevice.sh", + "./scripts/build/vcpkg.sh", + "./scripts/build/miniconda.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/edge.sh", + "./scripts/build/firefox.sh", + "./scripts/build/pypy.sh", + "./scripts/build/pipx-packages.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ], "environment_vars": [ "API_PAT={{user `github_api_pat`}}" @@ -222,15 +220,15 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", "scripts": [ - "./provision/core/toolset.ps1", - "./provision/core/configure-toolset.ps1" + "./scripts/build/toolset.ps1", + "./scripts/build/configure-toolset.ps1" ] }, { "type": "shell", "execute_command": "ruby {{ .Path }}", "scripts": [ - "./provision/core/delete-duplicate-sims.rb" + "./scripts/build/delete-duplicate-sims.rb" ] }, { @@ -250,8 +248,8 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/configuration/configure-hostname.sh", - "./provision/configuration/finalize-vm.sh" + "./scripts/build/configure-hostname.sh", + "./scripts/build/finalize-vm.sh" ] } ] diff --git a/images/macos/templates/macOS-12.anka.pkr.hcl b/images/macos/templates/macOS-12.anka.pkr.hcl index 5c1755b00..1850c957c 100644 --- a/images/macos/templates/macOS-12.anka.pkr.hcl +++ b/images/macos/templates/macOS-12.anka.pkr.hcl @@ -80,31 +80,27 @@ build { provisioner "file" { destination = "image-generation/" sources = [ - "./provision/assets", - "./tests", - "./software-report", - "./helpers" + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" ] } provisioner "file" { - destination = "image-generation/software-report/" + destination = "image-generation/docs-gen/" source = "../../helpers/software-report-base" } provisioner "file" { destination = "image-generation/add-certificate.swift" - source = "./provision/configuration/add-certificate.swift" + source = "./assets/add-certificate.swift" } provisioner "file" { destination = ".bashrc" - source = "./provision/configuration/environment/bashrc" + source = "./assets/bashrc" } provisioner "file" { destination = ".bash_profile" - source = "./provision/configuration/environment/bashprofile" - } - provisioner "file" { - destination = "./" - source = "./provision/utils" + source = "./assets/bashprofile" } provisioner "shell" { inline = [ @@ -113,29 +109,41 @@ build { } provisioner "file" { destination = "bootstrap" - source = "./provision/bootstrap-provisioner/" + source = "./assets/bootstrap-provisioner/" } provisioner "file" { destination = "image-generation/toolset.json" source = "./toolsets/toolset-12.json" } + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ] + } provisioner "shell" { scripts = [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { scripts = [ - "./provision/configuration/configure-tccdb-macos.sh", - "./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" + "./scripts/build/configure-tccdb-macos.sh", + "./scripts/build/add-network-interface-detection.sh", + "./scripts/build/autologin.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/screensaver-off.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/max-files.sh", + "./scripts/build/shell-change.sh" ] environment_vars = [ "PASSWORD=${var.vm_password}", @@ -145,9 +153,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ] environment_vars = [ "IMAGE_VERSION=${var.build_id}", @@ -157,25 +165,25 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { pause_before = "30s" scripts = [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.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/git.sh", - "./provision/core/mongodb.sh", - "./provision/core/node.sh", - "./provision/core/commonutils.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/python.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/mongodb.sh", + "./scripts/build/node.sh", + "./scripts/build/commonutils.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}", @@ -184,7 +192,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/xcode.ps1" + script = "./scripts/build/xcode.ps1" environment_vars = [ "XCODE_INSTALL_STORAGE_URL=${var.xcode_install_storage_url}", "XCODE_INSTALL_SAS=${var.xcode_install_sas}" @@ -192,41 +200,41 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { scripts = [ - "./provision/core/action-archive-cache.sh", - "./provision/core/llvm.sh", - "./provision/core/golang.sh", - "./provision/core/swiftlint.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/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/xamarin.sh", - "./provision/core/vsmac.sh", - "./provision/core/nvm.sh", - "./provision/core/apache.sh", - "./provision/core/nginx.sh", - "./provision/core/postgresql.sh", - "./provision/core/audiodevice.sh", - "./provision/core/vcpkg.sh", - "./provision/core/miniconda.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/edge.sh", - "./provision/core/firefox.sh", - "./provision/core/pypy.sh", - "./provision/core/pipx-packages.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/llvm.sh", + "./scripts/build/golang.sh", + "./scripts/build/swiftlint.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/php.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/haskell.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/xamarin.sh", + "./scripts/build/vsmac.sh", + "./scripts/build/nvm.sh", + "./scripts/build/apache.sh", + "./scripts/build/nginx.sh", + "./scripts/build/postgresql.sh", + "./scripts/build/audiodevice.sh", + "./scripts/build/vcpkg.sh", + "./scripts/build/miniconda.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/edge.sh", + "./scripts/build/firefox.sh", + "./scripts/build/pypy.sh", + "./scripts/build/pipx-packages.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}" @@ -235,17 +243,17 @@ build { } provisioner "shell" { scripts = [ - "./provision/core/toolset.ps1", - "./provision/core/configure-toolset.ps1" + "./scripts/build/toolset.ps1", + "./scripts/build/configure-toolset.ps1" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/delete-duplicate-sims.rb" + script = "./scripts/build/delete-duplicate-sims.rb" execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" } provisioner "shell" { - script = "./provision/core/fix-xcode-simulators.ps1" + script = "./scripts/build/fix-xcode-simulators.ps1" execute_command = "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { @@ -262,8 +270,8 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/configure-hostname.sh", - "./provision/configuration/finalize-vm.sh" + "./scripts/build/configure-hostname.sh", + "./scripts/build/finalize-vm.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } diff --git a/images/macos/templates/macOS-12.json b/images/macos/templates/macOS-12.json index 587d4d6db..ed9119b81 100644 --- a/images/macos/templates/macOS-12.json +++ b/images/macos/templates/macOS-12.json @@ -45,52 +45,37 @@ }, { "type": "file", - "source": "./provision/assets", - "destination": "~/image-generation/" - }, - { - "type": "file", - "source": "./tests", - "destination": "~/image-generation/" - }, - { - "type": "file", - "source": "./software-report", + "sources": [ + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" + ], "destination": "~/image-generation/" }, { "type": "file", "source": "../../helpers/software-report-base", - "destination": "~/image-generation/software-report/" + "destination": "~/image-generation/docs-gen/" }, { "type": "file", - "source": "./helpers", - "destination": "~/image-generation/" - }, - { - "type": "file", - "source": "./provision/configuration/add-certificate.swift", + "source": "./assets/add-certificate.swift", "destination": "~/image-generation/add-certificate.swift" }, { "type": "file", - "source": "./provision/configuration/environment/bashrc", + "source": "./assets/bashrc", "destination": "~/.bashrc" }, { "type": "file", - "source": "./provision/configuration/environment/bashprofile", + "source": "./assets/bashprofile", "destination": "~/.bash_profile" }, { "type": "file", - "source": "./provision/utils", - "destination": "~/" - }, - { - "type": "file", - "source": "./provision/bootstrap-provisioner", + "source": "./assets/bootstrap-provisioner", "destination": "~/bootstrap" }, { @@ -98,25 +83,38 @@ "source": "./toolsets/toolset-12.json", "destination": "~/image-generation/toolset.json" }, + { + "type": "shell", + "inline": [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh" ] }, { "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" + "./scripts/build/add-network-interface-detection.sh", + "./scripts/build/autologin.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/screensaver-off.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/max-files.sh", + "./scripts/build/shell-change.sh" ], "environment_vars": [ "PASSWORD={{user `vm_password`}}", @@ -127,9 +125,9 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ], "environment_vars": [ "IMAGE_VERSION={{user `build_id`}}", @@ -140,7 +138,7 @@ { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "script": "./provision/core/reboot.sh", + "script": "./scripts/build/reboot.sh", "expect_disconnect": true }, { @@ -148,18 +146,18 @@ "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "pause_before": "30s", "scripts": [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.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/git.sh", - "./provision/core/mongodb.sh", - "./provision/core/node.sh", - "./provision/core/commonutils.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/python.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/mongodb.sh", + "./scripts/build/node.sh", + "./scripts/build/commonutils.sh" ], "environment_vars": [ "API_PAT={{user `github_api_pat`}}", @@ -169,7 +167,7 @@ { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", - "script": "./provision/core/xcode.ps1", + "script": "./scripts/build/xcode.ps1", "environment_vars": [ "XCODE_INSTALL_STORAGE_URL={{user `xcode_install_storage_url`}}", "XCODE_INSTALL_SAS={{user `xcode_install_sas`}}" @@ -178,42 +176,42 @@ { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "script": "./provision/core/reboot.sh", + "script": "./scripts/build/reboot.sh", "expect_disconnect": true }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/core/action-archive-cache.sh", - "./provision/core/llvm.sh", - "./provision/core/golang.sh", - "./provision/core/swiftlint.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/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/xamarin.sh", - "./provision/core/vsmac.sh", - "./provision/core/nvm.sh", - "./provision/core/apache.sh", - "./provision/core/nginx.sh", - "./provision/core/postgresql.sh", - "./provision/core/audiodevice.sh", - "./provision/core/vcpkg.sh", - "./provision/core/miniconda.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/edge.sh", - "./provision/core/firefox.sh", - "./provision/core/pypy.sh", - "./provision/core/pipx-packages.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/llvm.sh", + "./scripts/build/golang.sh", + "./scripts/build/swiftlint.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/php.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/haskell.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/xamarin.sh", + "./scripts/build/vsmac.sh", + "./scripts/build/nvm.sh", + "./scripts/build/apache.sh", + "./scripts/build/nginx.sh", + "./scripts/build/postgresql.sh", + "./scripts/build/audiodevice.sh", + "./scripts/build/vcpkg.sh", + "./scripts/build/miniconda.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/edge.sh", + "./scripts/build/firefox.sh", + "./scripts/build/pypy.sh", + "./scripts/build/pipx-packages.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ], "environment_vars": [ "API_PAT={{user `github_api_pat`}}" @@ -223,21 +221,21 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", "scripts": [ - "./provision/core/toolset.ps1", - "./provision/core/configure-toolset.ps1" + "./scripts/build/toolset.ps1", + "./scripts/build/configure-toolset.ps1" ] }, { "type": "shell", "execute_command": "ruby {{ .Path }}", "scripts": [ - "./provision/core/delete-duplicate-sims.rb" + "./scripts/build/delete-duplicate-sims.rb" ] }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", - "script": "./provision/core/fix-xcode-simulators.ps1" + "script": "./scripts/build/fix-xcode-simulators.ps1" }, { "type": "shell", @@ -256,8 +254,8 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "./provision/configuration/configure-hostname.sh", - "./provision/configuration/finalize-vm.sh" + "./scripts/build/configure-hostname.sh", + "./scripts/build/finalize-vm.sh" ] } ] diff --git a/images/macos/templates/macOS-13.anka.pkr.hcl b/images/macos/templates/macOS-13.anka.pkr.hcl index 7756bba84..3f8acc39f 100644 --- a/images/macos/templates/macOS-13.anka.pkr.hcl +++ b/images/macos/templates/macOS-13.anka.pkr.hcl @@ -80,31 +80,27 @@ build { provisioner "file" { destination = "image-generation/" sources = [ - "./provision/assets", - "./tests", - "./software-report", - "./helpers" + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" ] } provisioner "file" { - destination = "image-generation/software-report/" + destination = "image-generation/docs-gen/" source = "../../helpers/software-report-base" } provisioner "file" { destination = "image-generation/add-certificate.swift" - source = "./provision/configuration/add-certificate.swift" + source = "./assets/add-certificate.swift" } provisioner "file" { destination = ".bashrc" - source = "./provision/configuration/environment/bashrc" + source = "./assets/bashrc" } provisioner "file" { destination = ".bash_profile" - source = "./provision/configuration/environment/bashprofile" - } - provisioner "file" { - destination = "./" - source = "./provision/utils" + source = "./assets/bashprofile" } provisioner "shell" { inline = [ @@ -113,25 +109,37 @@ build { } provisioner "file" { destination = "bootstrap" - source = "./provision/bootstrap-provisioner/" + source = "./assets/bootstrap-provisioner/" } provisioner "file" { destination = "image-generation/toolset.json" source = "./toolsets/toolset-13.json" } + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ] + } provisioner "shell" { scripts = [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { scripts = [ - "./provision/configuration/configure-tccdb-macos.sh", - "./provision/configuration/disable-auto-updates.sh", - "./provision/configuration/ntpconf.sh", - "./provision/configuration/shell-change.sh" + "./scripts/build/configure-tccdb-macos.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/shell-change.sh" ] environment_vars = [ "PASSWORD=${var.vm_password}", @@ -141,9 +149,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ] environment_vars = [ "IMAGE_VERSION=${var.build_id}", @@ -153,25 +161,25 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { pause_before = "30s" scripts = [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.sh", - "./provision/core/mono.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/git.sh", - "./provision/core/node.sh", - "./provision/core/commonutils.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/mono.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/python.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/node.sh", + "./scripts/build/commonutils.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}", @@ -180,7 +188,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/xcode.ps1" + script = "./scripts/build/xcode.ps1" environment_vars = [ "XCODE_INSTALL_STORAGE_URL=${var.xcode_install_storage_url}", "XCODE_INSTALL_SAS=${var.xcode_install_sas}" @@ -188,31 +196,31 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { scripts = [ - "./provision/core/action-archive-cache.sh", - "./provision/core/llvm.sh", - "./provision/core/swiftlint.sh", - "./provision/core/openjdk.sh", - "./provision/core/php.sh", - "./provision/core/aws.sh", - "./provision/core/rust.sh", - "./provision/core/gcc.sh", - "./provision/core/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/apache.sh", - "./provision/core/vcpkg.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/edge.sh", - "./provision/core/firefox.sh", - "./provision/core/pypy.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/llvm.sh", + "./scripts/build/swiftlint.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/php.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/apache.sh", + "./scripts/build/vcpkg.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/edge.sh", + "./scripts/build/firefox.sh", + "./scripts/build/pypy.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}" @@ -221,13 +229,13 @@ build { } provisioner "shell" { scripts = [ - "./provision/core/toolset.ps1", - "./provision/core/configure-toolset.ps1" + "./scripts/build/toolset.ps1", + "./scripts/build/configure-toolset.ps1" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/delete-duplicate-sims.rb" + script = "./scripts/build/delete-duplicate-sims.rb" execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" } provisioner "shell" { @@ -244,9 +252,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/configure-hostname.sh", - "./provision/configuration/cleanup-brew.sh", - "./provision/configuration/finalize-vm.sh" + "./scripts/build/configure-hostname.sh", + "./scripts/build/cleanup-brew.sh", + "./scripts/build/finalize-vm.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } diff --git a/images/macos/templates/macOS-13.arm64.anka.pkr.hcl b/images/macos/templates/macOS-13.arm64.anka.pkr.hcl index 4e273277c..17ae11ec7 100644 --- a/images/macos/templates/macOS-13.arm64.anka.pkr.hcl +++ b/images/macos/templates/macOS-13.arm64.anka.pkr.hcl @@ -81,31 +81,27 @@ build { provisioner "file" { destination = "image-generation/" sources = [ - "./provision/assets", - "./tests", - "./software-report", - "./helpers" + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" ] } provisioner "file" { - destination = "image-generation/software-report/" + destination = "image-generation/docs-gen/" source = "../../helpers/software-report-base" } provisioner "file" { destination = "image-generation/add-certificate.swift" - source = "./provision/configuration/add-certificate.swift" + source = "./assets/add-certificate.swift" } provisioner "file" { destination = ".bashrc" - source = "./provision/configuration/environment/bashrc" + source = "./assets/bashrc" } provisioner "file" { destination = ".bash_profile" - source = "./provision/configuration/environment/bashprofile" - } - provisioner "file" { - destination = "./" - source = "./provision/utils" + source = "./assets/bashprofile" } provisioner "shell" { inline = [ @@ -114,26 +110,38 @@ build { } provisioner "file" { destination = "bootstrap" - source = "./provision/bootstrap-provisioner/" + source = "./assets/bootstrap-provisioner/" } provisioner "file" { destination = "image-generation/toolset.json" source = "./toolsets/toolset-13.json" } + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ] + } provisioner "shell" { scripts = [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh", - "./provision/core/rosetta.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh", + "./scripts/build/rosetta.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { scripts = [ - "./provision/configuration/configure-tccdb-macos.sh", - "./provision/configuration/disable-auto-updates.sh", - "./provision/configuration/ntpconf.sh", - "./provision/configuration/shell-change.sh" + "./scripts/build/configure-tccdb-macos.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/shell-change.sh" ] environment_vars = [ "PASSWORD=${var.vm_password}", @@ -143,9 +151,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ] environment_vars = [ "IMAGE_VERSION=${var.build_id}", @@ -155,24 +163,24 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { pause_before = "30s" scripts = [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.sh", - "./provision/core/mono.sh", - "./provision/core/dotnet.sh", - "./provision/core/azcopy.sh", - "./provision/core/openssl.sh", - "./provision/core/ruby.sh", - "./provision/core/rubygem.sh", - "./provision/core/git.sh", - "./provision/core/node.sh", - "./provision/core/commonutils.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/mono.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/node.sh", + "./scripts/build/commonutils.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}", @@ -181,7 +189,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/xcode.ps1" + script = "./scripts/build/xcode.ps1" environment_vars = [ "XCODE_INSTALL_STORAGE_URL=${var.xcode_install_storage_url}", "XCODE_INSTALL_SAS=${var.xcode_install_sas}" @@ -189,24 +197,24 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { scripts = [ - "./provision/core/action-archive-cache.sh", - "./provision/core/llvm.sh", - "./provision/core/openjdk.sh", - "./provision/core/aws.sh", - "./provision/core/rust.sh", - "./provision/core/gcc.sh", - "./provision/core/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/llvm.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}" @@ -215,13 +223,13 @@ build { } provisioner "shell" { scripts = [ - "./provision/core/toolset.ps1", - "./provision/core/configure-toolset.ps1" + "./scripts/build/toolset.ps1", + "./scripts/build/configure-toolset.ps1" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/delete-duplicate-sims.rb" + script = "./scripts/build/delete-duplicate-sims.rb" execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" } provisioner "shell" { @@ -238,7 +246,7 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/configure-hostname.sh" + "./scripts/build/configure-hostname.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } diff --git a/images/macos/templates/macOS-14.anka.pkr.hcl b/images/macos/templates/macOS-14.anka.pkr.hcl index 8699a6f51..907d88150 100644 --- a/images/macos/templates/macOS-14.anka.pkr.hcl +++ b/images/macos/templates/macOS-14.anka.pkr.hcl @@ -80,31 +80,27 @@ build { provisioner "file" { destination = "image-generation/" sources = [ - "./provision/assets", - "./tests", - "./software-report", - "./helpers" + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" ] } provisioner "file" { - destination = "image-generation/software-report/" + destination = "image-generation/docs-gen/" source = "../../helpers/software-report-base" } provisioner "file" { destination = "image-generation/add-certificate.swift" - source = "./provision/configuration/add-certificate.swift" + source = "./assets/add-certificate.swift" } provisioner "file" { destination = ".bashrc" - source = "./provision/configuration/environment/bashrc" + source = "./assets/bashrc" } provisioner "file" { destination = ".bash_profile" - source = "./provision/configuration/environment/bashprofile" - } - provisioner "file" { - destination = "./" - source = "./provision/utils" + source = "./assets/bashprofile" } provisioner "shell" { inline = [ @@ -113,25 +109,37 @@ build { } provisioner "file" { destination = "bootstrap" - source = "./provision/bootstrap-provisioner/" + source = "./assets/bootstrap-provisioner/" } provisioner "file" { destination = "image-generation/toolset.json" source = "./toolsets/toolset-14.json" } + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ] + } provisioner "shell" { scripts = [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { scripts = [ - "./provision/configuration/configure-tccdb-macos.sh", - "./provision/configuration/disable-auto-updates.sh", - "./provision/configuration/ntpconf.sh", - "./provision/configuration/shell-change.sh" + "./scripts/build/configure-tccdb-macos.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/shell-change.sh" ] environment_vars = [ "PASSWORD=${var.vm_password}", @@ -141,9 +149,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ] environment_vars = [ "IMAGE_VERSION=${var.build_id}", @@ -153,25 +161,25 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { pause_before = "30s" scripts = [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.sh", - "./provision/core/mono.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/git.sh", - "./provision/core/node.sh", - "./provision/core/commonutils.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/mono.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/python.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/node.sh", + "./scripts/build/commonutils.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}", @@ -180,7 +188,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/xcode.ps1" + script = "./scripts/build/xcode.ps1" environment_vars = [ "XCODE_INSTALL_STORAGE_URL=${var.xcode_install_storage_url}", "XCODE_INSTALL_SAS=${var.xcode_install_sas}" @@ -188,31 +196,31 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { scripts = [ - "./provision/core/action-archive-cache.sh", - "./provision/core/llvm.sh", - "./provision/core/swiftlint.sh", - "./provision/core/openjdk.sh", - "./provision/core/php.sh", - "./provision/core/aws.sh", - "./provision/core/rust.sh", - "./provision/core/gcc.sh", - "./provision/core/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/apache.sh", - "./provision/core/vcpkg.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/edge.sh", - "./provision/core/firefox.sh", - "./provision/core/pypy.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/llvm.sh", + "./scripts/build/swiftlint.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/php.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/apache.sh", + "./scripts/build/vcpkg.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/edge.sh", + "./scripts/build/firefox.sh", + "./scripts/build/pypy.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}" @@ -220,7 +228,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/delete-duplicate-sims.rb" + script = "./scripts/build/delete-duplicate-sims.rb" execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" } provisioner "shell" { @@ -236,9 +244,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/configure-hostname.sh", - "./provision/configuration/cleanup-brew.sh", - "./provision/configuration/finalize-vm.sh" + "./scripts/build/configure-hostname.sh", + "./scripts/build/cleanup-brew.sh", + "./scripts/build/finalize-vm.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } diff --git a/images/macos/templates/macOS-14.arm64.anka.pkr.hcl b/images/macos/templates/macOS-14.arm64.anka.pkr.hcl index abb617c32..0ca811520 100644 --- a/images/macos/templates/macOS-14.arm64.anka.pkr.hcl +++ b/images/macos/templates/macOS-14.arm64.anka.pkr.hcl @@ -81,31 +81,27 @@ build { provisioner "file" { destination = "image-generation/" sources = [ - "./provision/assets", - "./tests", - "./software-report", - "./helpers" + "./assets/xamarin-selector", + "./scripts/tests", + "./scripts/docs-gen", + "./scripts/helpers" ] } provisioner "file" { - destination = "image-generation/software-report/" + destination = "image-generation/docs-gen/" source = "../../helpers/software-report-base" } provisioner "file" { destination = "image-generation/add-certificate.swift" - source = "./provision/configuration/add-certificate.swift" + source = "./assets/add-certificate.swift" } provisioner "file" { destination = ".bashrc" - source = "./provision/configuration/environment/bashrc" + source = "./assets/bashrc" } provisioner "file" { destination = ".bash_profile" - source = "./provision/configuration/environment/bashprofile" - } - provisioner "file" { - destination = "./" - source = "./provision/utils" + source = "./assets/bashprofile" } provisioner "shell" { inline = [ @@ -114,26 +110,38 @@ build { } provisioner "file" { destination = "bootstrap" - source = "./provision/bootstrap-provisioner/" + source = "./assets/bootstrap-provisioner/" } provisioner "file" { destination = "image-generation/toolset.json" source = "./toolsets/toolset-14.json" } + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = [ + "mv ~/image-generation/docs-gen ~/image-generation/software-report", + "mv ~/image-generation/xamarin-selector ~/image-generation/assets", + "mkdir ~/utils", + "mv ~/image-generation/helpers/confirm-identified-developers.scpt ~/utils", + "mv ~/image-generation/helpers/invoke-tests.sh ~/utils", + "mv ~/image-generation/helpers/utils.sh ~/utils", + "mv ~/image-generation/helpers/xamarin-utils.sh ~/utils" + ] + } provisioner "shell" { scripts = [ - "./provision/core/xcode-clt.sh", - "./provision/core/homebrew.sh", - "./provision/core/rosetta.sh" + "./scripts/build/xcode-clt.sh", + "./scripts/build/homebrew.sh", + "./scripts/build/rosetta.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { scripts = [ - "./provision/configuration/configure-tccdb-macos.sh", - "./provision/configuration/disable-auto-updates.sh", - "./provision/configuration/ntpconf.sh", - "./provision/configuration/shell-change.sh" + "./scripts/build/configure-tccdb-macos.sh", + "./scripts/build/disable-auto-updates.sh", + "./scripts/build/ntpconf.sh", + "./scripts/build/shell-change.sh" ] environment_vars = [ "PASSWORD=${var.vm_password}", @@ -143,9 +151,9 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/preimagedata.sh", - "./provision/configuration/configure-ssh.sh", - "./provision/configuration/configure-machine.sh" + "./scripts/build/preimagedata.sh", + "./scripts/build/configure-ssh.sh", + "./scripts/build/configure-machine.sh" ] environment_vars = [ "IMAGE_VERSION=${var.build_id}", @@ -155,24 +163,24 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { pause_before = "30s" scripts = [ - "./provision/core/open_windows_check.sh", - "./provision/core/powershell.sh", - "./provision/core/mono.sh", - "./provision/core/dotnet.sh", - "./provision/core/azcopy.sh", - "./provision/core/openssl.sh", - "./provision/core/ruby.sh", - "./provision/core/rubygem.sh", - "./provision/core/git.sh", - "./provision/core/node.sh", - "./provision/core/commonutils.sh" + "./scripts/build/open_windows_check.sh", + "./scripts/build/powershell.sh", + "./scripts/build/mono.sh", + "./scripts/build/dotnet.sh", + "./scripts/build/azcopy.sh", + "./scripts/build/openssl.sh", + "./scripts/build/ruby.sh", + "./scripts/build/rubygem.sh", + "./scripts/build/git.sh", + "./scripts/build/node.sh", + "./scripts/build/commonutils.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}", @@ -181,7 +189,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/xcode.ps1" + script = "./scripts/build/xcode.ps1" environment_vars = [ "XCODE_INSTALL_STORAGE_URL=${var.xcode_install_storage_url}", "XCODE_INSTALL_SAS=${var.xcode_install_sas}" @@ -189,24 +197,24 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}" } provisioner "shell" { - script = "./provision/core/reboot.sh" + script = "./scripts/build/reboot.sh" execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; sudo {{ .Vars }} {{ .Path }}" expect_disconnect = true } provisioner "shell" { scripts = [ - "./provision/core/action-archive-cache.sh", - "./provision/core/llvm.sh", - "./provision/core/openjdk.sh", - "./provision/core/aws.sh", - "./provision/core/rust.sh", - "./provision/core/gcc.sh", - "./provision/core/cocoapods.sh", - "./provision/core/android-toolsets.sh", - "./provision/core/safari.sh", - "./provision/core/chrome.sh", - "./provision/core/bicep.sh", - "./provision/core/codeql-bundle.sh" + "./scripts/build/action-archive-cache.sh", + "./scripts/build/llvm.sh", + "./scripts/build/openjdk.sh", + "./scripts/build/aws.sh", + "./scripts/build/rust.sh", + "./scripts/build/gcc.sh", + "./scripts/build/cocoapods.sh", + "./scripts/build/android-toolsets.sh", + "./scripts/build/safari.sh", + "./scripts/build/chrome.sh", + "./scripts/build/bicep.sh", + "./scripts/build/codeql-bundle.sh" ] environment_vars = [ "API_PAT=${var.github_api_pat}" @@ -214,7 +222,7 @@ build { execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" } provisioner "shell" { - script = "./provision/core/delete-duplicate-sims.rb" + script = "./scripts/build/delete-duplicate-sims.rb" execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}" } provisioner "shell" { @@ -230,7 +238,7 @@ build { } provisioner "shell" { scripts = [ - "./provision/configuration/configure-hostname.sh" + "./scripts/build/configure-hostname.sh" ] execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}" }