|
| 1 | +using module ./software-report-base/SoftwareReport.psm1 |
| 2 | +using module ./software-report-base/SoftwareReport.Nodes.psm1 |
| 3 | + |
| 4 | +param ( |
| 5 | + [Parameter(Mandatory)][string] |
| 6 | + $OutputDirectory, |
| 7 | + $ImageName |
| 8 | +) |
| 9 | + |
| 10 | +$ErrorActionPreference = "Stop" |
| 11 | + |
| 12 | +Import-Module "$PSScriptRoot/SoftwareReport.Common.psm1" -DisableNameChecking |
| 13 | +Import-Module "$PSScriptRoot/SoftwareReport.Xcode.psm1" -DisableNameChecking |
| 14 | +Import-Module "$PSScriptRoot/SoftwareReport.Android.psm1" -DisableNameChecking |
| 15 | +Import-Module "$PSScriptRoot/SoftwareReport.Java.psm1" -DisableNameChecking |
| 16 | +Import-Module "$PSScriptRoot/SoftwareReport.Toolcache.psm1" -DisableNameChecking |
| 17 | +Import-Module "$PSScriptRoot/SoftwareReport.Browsers.psm1" -DisableNameChecking |
| 18 | +Import-Module "$PSScriptRoot/SoftwareReport.Helpers.psm1" -DisableNameChecking |
| 19 | +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" |
| 20 | +Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1" |
| 21 | + |
| 22 | +# Operating System info |
| 23 | +$os = Get-OSVersion |
| 24 | + |
| 25 | +# OS info |
| 26 | +$osInfo = Build-OSInfoSection $ImageName |
| 27 | + |
| 28 | +# Software report |
| 29 | +$softwareReport = [SoftwareReport]::new($osInfo) |
| 30 | +$installedSoftware = $softwareReport.Root.AddHeader("Installed Software") |
| 31 | + |
| 32 | +# Language and Runtime |
| 33 | +$languageAndRuntime = $installedSoftware.AddHeader("Language and Runtime") |
| 34 | +$languageAndRuntime.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetVersionList), '^\d+\.\d+\.\d') |
| 35 | +$languageAndRuntime.AddToolVersion("Bash", $(Get-BashVersion)) |
| 36 | +$languageAndRuntime.AddNodes($(Get-ClangLLVMVersions)) |
| 37 | +$languageAndRuntime.AddNodes($(Get-GccVersions)) |
| 38 | +$languageAndRuntime.AddNodes($(Get-FortranVersions)) |
| 39 | +$languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion)) |
| 40 | +if (($os.IsSonoma)) { |
| 41 | + $languageAndRuntime.AddToolVersion("Mono", $(Get-MonoVersion)) |
| 42 | +} |
| 43 | +$languageAndRuntime.AddToolVersion("Node.js", $(Get-NodeVersion)) |
| 44 | +$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion)) |
| 45 | +if ((-not $os.IsArm64)) { |
| 46 | + $languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion)) |
| 47 | +} |
| 48 | +$languageAndRuntime.AddToolVersion("Python3", $(Get-Python3Version)) |
| 49 | +$languageAndRuntime.AddToolVersion("Ruby", $(Get-RubyVersion)) |
| 50 | + |
| 51 | +# Package Management |
| 52 | +$packageManagement = $installedSoftware.AddHeader("Package Management") |
| 53 | +$packageManagement.AddToolVersion("Bundler", $(Get-BundlerVersion)) |
| 54 | +$packageManagement.AddToolVersion("Carthage", $(Get-CarthageVersion)) |
| 55 | +$packageManagement.AddToolVersion("CocoaPods", $(Get-CocoaPodsVersion)) |
| 56 | +if ((-not $os.IsArm64)) { |
| 57 | + $packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion)) |
| 58 | +} |
| 59 | +$packageManagement.AddToolVersion("Homebrew", $(Get-HomebrewVersion)) |
| 60 | +$packageManagement.AddToolVersion("NPM", $(Get-NPMVersion)) |
| 61 | +if (($os.IsSonoma)) { |
| 62 | + $packageManagement.AddToolVersion("NuGet", $(Get-NuGetVersion)) |
| 63 | +} |
| 64 | +$packageManagement.AddToolVersion("Pip3", $(Get-Pip3Version)) |
| 65 | +$packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion)) |
| 66 | +$packageManagement.AddToolVersion("RubyGems", $(Get-RubyGemsVersion)) |
| 67 | +$packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion)) |
| 68 | +$packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion)) |
| 69 | + |
| 70 | +# Project Management |
| 71 | +$projectManagement = $installedSoftware.AddHeader("Project Management") |
| 72 | +$projectManagement.AddToolVersion("Apache Ant", $(Get-ApacheAntVersion)) |
| 73 | +$projectManagement.AddToolVersion("Apache Maven", $(Get-MavenVersion)) |
| 74 | +$projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion)) |
| 75 | + |
| 76 | +# Utilities |
| 77 | +$utilities = $installedSoftware.AddHeader("Utilities") |
| 78 | +$utilities.AddToolVersion("7-Zip", $(Get-7zipVersion)) |
| 79 | +$utilities.AddToolVersion("aria2", $(Get-Aria2Version)) |
| 80 | +$utilities.AddToolVersion("azcopy", $(Get-AzcopyVersion)) |
| 81 | +$utilities.AddToolVersion("bazel", $(Get-BazelVersion)) |
| 82 | +$utilities.AddToolVersion("bazelisk", $(Get-BazeliskVersion)) |
| 83 | +$utilities.AddToolVersion("bsdtar", $(Get-BsdtarVersion)) |
| 84 | +$utilities.AddToolVersion("Curl", $(Get-CurlVersion)) |
| 85 | +$utilities.AddToolVersion("Git", $(Get-GitVersion)) |
| 86 | +$utilities.AddToolVersion("Git LFS", $(Get-GitLFSVersion)) |
| 87 | +$utilities.AddToolVersion("GitHub CLI", $(Get-GitHubCLIVersion)) |
| 88 | +$utilities.AddToolVersion("GNU Tar", $(Get-GnuTarVersion)) |
| 89 | +$utilities.AddToolVersion("GNU Wget", $(Get-WgetVersion)) |
| 90 | +$utilities.AddToolVersion("gpg (GnuPG)", $(Get-GPGVersion)) |
| 91 | +$utilities.AddToolVersion("jq", $(Get-JqVersion)) |
| 92 | +$utilities.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion)) |
| 93 | +$utilities.AddToolVersion("Packer", $(Get-PackerVersion)) |
| 94 | +$utilities.AddToolVersion("pkgconf", $(Get-PKGConfVersion)) |
| 95 | +$utilities.AddToolVersion("Unxip", $(Get-UnxipVersion)) |
| 96 | +$utilities.AddToolVersion("yq", $(Get-YqVersion)) |
| 97 | +$utilities.AddToolVersion("zstd", $(Get-ZstdVersion)) |
| 98 | +$utilities.AddToolVersion("Ninja", $(Get-NinjaVersion)) |
| 99 | + |
| 100 | +# Tools |
| 101 | +$tools = $installedSoftware.AddHeader("Tools") |
| 102 | +$tools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion)) |
| 103 | +$tools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMCLIVersion)) |
| 104 | +$tools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion)) |
| 105 | +$tools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion)) |
| 106 | +$tools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion)) |
| 107 | +$tools.AddToolVersion("Bicep CLI", $(Get-BicepVersion)) |
| 108 | +$tools.AddToolVersion("Cmake", $(Get-CmakeVersion)) |
| 109 | +$tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion)) |
| 110 | +$tools.AddToolVersion("Fastlane", $(Get-FastlaneVersion)) |
| 111 | +$tools.AddToolVersion("SwiftFormat", $(Get-SwiftFormatVersion)) |
| 112 | +$tools.AddToolVersion("Xcbeautify", $(Get-XcbeautifyVersion)) |
| 113 | +$tools.AddToolVersion("Xcode Command Line Tools", $(Get-XcodeCommandLineToolsVersion)) |
| 114 | +$tools.AddToolVersion("Xcodes", $(Get-XcodesVersion)) |
| 115 | + |
| 116 | +# Linters |
| 117 | +if ((-not $os.IsArm64)) { |
| 118 | + $linters = $installedSoftware.AddHeader("Linters") |
| 119 | + $linters.AddToolVersion("SwiftLint", $(Get-SwiftLintVersion)) |
| 120 | +} |
| 121 | + |
| 122 | +# Browsers |
| 123 | +$browsers = $installedSoftware.AddHeader("Browsers") |
| 124 | +$browsers.AddNodes($(Build-BrowserSection)) |
| 125 | +$browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable)) |
| 126 | + |
| 127 | +# Java |
| 128 | +$java = $installedSoftware.AddHeader("Java") |
| 129 | +$java.AddTable($(Get-JavaVersions)) |
| 130 | + |
| 131 | +# Toolcache |
| 132 | +$toolcache = $installedSoftware.AddHeader("Cached Tools") |
| 133 | +$toolcache.AddNodes($(Build-ToolcacheSection)) |
| 134 | + |
| 135 | +# Rust |
| 136 | +$rust = $installedSoftware.AddHeader("Rust Tools") |
| 137 | +$rust.AddToolVersion("Cargo", $(Get-RustCargoVersion)) |
| 138 | +$rust.AddToolVersion("Rust", $(Get-RustVersion)) |
| 139 | +$rust.AddToolVersion("Rustdoc", $(Get-RustdocVersion)) |
| 140 | +$rust.AddToolVersion("Rustup", $(Get-RustupVersion)) |
| 141 | + |
| 142 | +$rustPackages = $rust.AddHeader("Packages") |
| 143 | +$rustPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion)) |
| 144 | +$rustPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion)) |
| 145 | + |
| 146 | +# PowerShell |
| 147 | +$powerShell = $installedSoftware.AddHeader("PowerShell Tools") |
| 148 | +$powerShell.AddToolVersion("PowerShell", $(Get-PowershellVersion)) |
| 149 | + |
| 150 | +$powerShellModules = $powerShell.AddHeader("PowerShell Modules") |
| 151 | +$powerShellModules.AddNodes($(Get-PowerShellModules)) |
| 152 | + |
| 153 | +# Xcode section |
| 154 | +$xcode = $installedSoftware.AddHeader("Xcode") |
| 155 | +# First run doesn't provide full data about devices and runtimes |
| 156 | +Get-XcodeInfoList | Out-Null |
| 157 | + |
| 158 | +$xcodeInfo = Get-XcodeInfoList |
| 159 | +$xcode.AddTable($(Build-XcodeTable $xcodeInfo)) |
| 160 | + |
| 161 | +$installedSdks = $xcode.AddHeader("Installed SDKs") |
| 162 | +$installedSdks.AddTable($(Build-XcodeSDKTable $xcodeInfo)) |
| 163 | + |
| 164 | +$installedSimulators = $xcode.AddHeader("Installed Simulators") |
| 165 | +$installedSimulators.AddTable($(Build-XcodeSimulatorsTable $xcodeInfo)) |
| 166 | + |
| 167 | +# Android section |
| 168 | +$android = $installedSoftware.AddHeader("Android") |
| 169 | +$androidTable = Build-AndroidTable |
| 170 | +$android.AddTable($androidTable) |
| 171 | + |
| 172 | +$androidEnv = $android.AddHeader("Environment variables") |
| 173 | +$androidEnv.AddTable($(Build-AndroidEnvironmentTable)) |
| 174 | + |
| 175 | +if (($os.IsSonoma -or $os.IsSequoia -or $os.IsTahoe)) { |
| 176 | + $miscellaneous = $installedSoftware.AddHeader("Miscellaneous") |
| 177 | + $miscellaneous.AddToolVersion("Tcl/Tk", $(Get-TclTkVersion)) |
| 178 | +} |
| 179 | + |
| 180 | +if (($os.IsSonomaX64 -or $os.IsSequoiaX64)) { |
| 181 | + |
| 182 | + Write-Host "Adding environment variables for parallels" |
| 183 | + |
| 184 | + $miscellaneousEnv = $miscellaneous.AddHeader("Environment variables") |
| 185 | + $miscellaneousEnv.AddTable($(Build-MiscellaneousEnvironmentTable)) |
| 186 | + |
| 187 | + $notes = @' |
| 188 | +If you want to use Parallels Desktop you should download a package from URL stored in |
| 189 | +PARALLELS_DMG_URL environment variable. A system extension is allowed for this version. |
| 190 | +'@ |
| 191 | + $miscellaneousEnvNotes = $miscellaneousEnv.AddHeader("Notes") |
| 192 | + $miscellaneousEnvNotes.AddNote($notes) |
| 193 | +} |
| 194 | + |
| 195 | +if (-not (Test-Path $OutputDirectory)) { New-Item -Path $OutputDirectory -ItemType Directory | Out-Null } |
| 196 | + |
| 197 | +# |
| 198 | +# Write final reports |
| 199 | +# |
| 200 | +Write-Host $markdownExtended |
| 201 | +$softwareReport.ToJson() | Out-File -FilePath "${OutputDirectory}/software-report.json" -Encoding UTF8NoBOM |
| 202 | +$softwareReport.ToMarkdown() | Out-File -FilePath "${OutputDirectory}/software-report.md" -Encoding UTF8NoBOM |
0 commit comments