From 9e8d521bef92d9823672b759bbf54fffe6995a1f Mon Sep 17 00:00:00 2001 From: Alexey-Ayupov <116575425+Alexey-Ayupov@users.noreply.github.com> Date: Tue, 4 Mar 2025 15:56:00 +0100 Subject: [PATCH] [macOS] Add Ninja (#11707) --- .../docs-gen/Generate-SoftwareReport.ps1 | 1 + .../docs-gen/SoftwareReport.Common.psm1 | 4 ++++ .../macos/scripts/tests/BasicTools.Tests.ps1 | 22 +++++++++++++++++++ images/macos/toolsets/toolset-13.json | 1 + images/macos/toolsets/toolset-14.json | 1 + images/macos/toolsets/toolset-15.json | 1 + 6 files changed, 30 insertions(+) diff --git a/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 b/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 index 03768c2cb..a099454b8 100644 --- a/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 +++ b/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 @@ -97,6 +97,7 @@ $utilities.AddToolVersion("pkgconf", $(Get-PKGConfVersion)) $utilities.AddToolVersion("Unxip", $(Get-UnxipVersion)) $utilities.AddToolVersion("yq", $(Get-YqVersion)) $utilities.AddToolVersion("zstd", $(Get-ZstdVersion)) +$utilities.AddToolVersion("Ninja", $(Get-NinjaVersion)) # Tools $tools = $installedSoftware.AddHeader("Tools") diff --git a/images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 b/images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 index db25f7e18..d3a6bddab 100644 --- a/images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 +++ b/images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 @@ -409,3 +409,7 @@ function Get-UnxipVersion { $unxipVersion = Run-Command "unxip --version" | Take-Part -Part 1 return $unxipVersion } + +function Get-NinjaVersion { + return $(ninja --version) +} diff --git a/images/macos/scripts/tests/BasicTools.Tests.ps1 b/images/macos/scripts/tests/BasicTools.Tests.ps1 index fd7613134..357e65eda 100644 --- a/images/macos/scripts/tests/BasicTools.Tests.ps1 +++ b/images/macos/scripts/tests/BasicTools.Tests.ps1 @@ -148,3 +148,25 @@ Describe "pkgconf" { "pkgconf --version" | Should -ReturnZeroExitCode } } + +Describe "Ninja" { + New-item -Path "/tmp/ninjaproject" -ItemType Directory -Force + Set-Location '/tmp/ninjaproject' +@' +cmake_minimum_required(VERSION 3.10) +project(NinjaTest NONE) +'@ | Out-File -FilePath "./CMakeLists.txt" + + It "Make a simple ninja project" { + "cmake -GNinja /tmp/ninjaproject" | Should -ReturnZeroExitCode + } + + It "build.ninja file should exist" { + $buildFilePath = Join-Path "/tmp/ninjaproject" "build.ninja" + $buildFilePath | Should -Exist + } + + It "Ninja" { + "ninja --version" | Should -ReturnZeroExitCode + } +} diff --git a/images/macos/toolsets/toolset-13.json b/images/macos/toolsets/toolset-13.json index 30c24a665..0dba4b7ee 100644 --- a/images/macos/toolsets/toolset-13.json +++ b/images/macos/toolsets/toolset-13.json @@ -81,6 +81,7 @@ "swiftformat", "tcl-tk@8", "zstd", + "ninja", "gmp", "yq", "xcbeautify", diff --git a/images/macos/toolsets/toolset-14.json b/images/macos/toolsets/toolset-14.json index 205098b29..5070a2856 100644 --- a/images/macos/toolsets/toolset-14.json +++ b/images/macos/toolsets/toolset-14.json @@ -84,6 +84,7 @@ "swiftformat", "tcl-tk@8", "zstd", + "ninja", "gmp", "yq", "unxip", diff --git a/images/macos/toolsets/toolset-15.json b/images/macos/toolsets/toolset-15.json index 0ccc3cca3..300867d00 100644 --- a/images/macos/toolsets/toolset-15.json +++ b/images/macos/toolsets/toolset-15.json @@ -77,6 +77,7 @@ "pkgconf", "swiftformat", "zstd", + "ninja", "gmp", "yq", "unxip",