From 344225a9646ca34495f6489e8ed70fa22cf51ff4 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 7 Jul 2020 12:16:42 +0300 Subject: [PATCH 1/4] add cargo dep --- images/win/scripts/Installers/Install-Rust.ps1 | 2 +- images/win/scripts/Installers/Validate-Rust.ps1 | 10 ++++++++++ .../SoftwareReport/SoftwareReport.Common.psm1 | 15 +++++++++++++++ .../SoftwareReport/SoftwareReport.Generator.ps1 | 8 ++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-Rust.ps1 b/images/win/scripts/Installers/Install-Rust.ps1 index 96f9618b3..bbb259a0e 100644 --- a/images/win/scripts/Installers/Install-Rust.ps1 +++ b/images/win/scripts/Installers/Install-Rust.ps1 @@ -22,7 +22,7 @@ $env:Path = Get-MachinePath # Install common tools rustup component add rustfmt clippy -cargo install bindgen cbindgen +cargo install bindgen cbindgen cargo-audit cargo-outdated # Run script at startup for all users $cmdRustSymScript = @" diff --git a/images/win/scripts/Installers/Validate-Rust.ps1 b/images/win/scripts/Installers/Validate-Rust.ps1 index 116f33cf5..22699adff 100644 --- a/images/win/scripts/Installers/Validate-Rust.ps1 +++ b/images/win/scripts/Installers/Validate-Rust.ps1 @@ -17,3 +17,13 @@ else Write-Host "rustc is not on the path" exit 1 } + +if (-Not (Get-Command -Name 'cargo audit')){ + Write-Host "cargo audit is not on the path" + exit 1 +} + +if (-Not (Get-Command -Name 'cargo outdated')){ + Write-Host "cargo outdated is not on the path" + exit 1 +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 829ac4657..45f728d0b 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -37,6 +37,21 @@ function Get-RustVersion { return "Rust ${rustVersion}" } +function Get-BindgenVersion { + return & bindgen --version +} + +function Get-CbindgenVersion { + return & cbindgen --version +} + +function Get-CargoauditVersion { + return & cargo audit --version +} + +function Get-CargooutdatedVersion { + return & cargo outdated --version +} function Get-PythonVersion { return & python --version } diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 6e643fcf0..7795c1390 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -38,6 +38,14 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-NodeVersion) ) +$markdown += New-MDHeader "Rust packages:" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-BindgenVersion), + (Get-CbindgenVersion), + (Get-CargoauditVersion), + (Get-CargooutdatedVersion) +) + $markdown += New-MDHeader "Package Management" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-ChocoVersion), From ea72c5424944af6d6c131e470e1ba3815cbcd733 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 8 Jul 2020 00:35:51 +0300 Subject: [PATCH 2/4] fix validate tests --- images/win/scripts/Installers/Validate-Rust.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Validate-Rust.ps1 b/images/win/scripts/Installers/Validate-Rust.ps1 index 22699adff..88968a21c 100644 --- a/images/win/scripts/Installers/Validate-Rust.ps1 +++ b/images/win/scripts/Installers/Validate-Rust.ps1 @@ -18,12 +18,12 @@ else exit 1 } -if (-Not (Get-Command -Name 'cargo audit')){ +if (-Not (Get-Command -Name 'cargo-audit')){ Write-Host "cargo audit is not on the path" exit 1 } -if (-Not (Get-Command -Name 'cargo outdated')){ +if (-Not (Get-Command -Name 'cargo-outdated')){ Write-Host "cargo outdated is not on the path" exit 1 } \ No newline at end of file From 0d95b3387cd2e3c3350c21c262a687d517f7284e Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 8 Jul 2020 15:25:42 +0300 Subject: [PATCH 3/4] remove & and add extra line --- .../scripts/SoftwareReport/SoftwareReport.Common.psm1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 45f728d0b..1dd6a137c 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -38,20 +38,21 @@ function Get-RustVersion { } function Get-BindgenVersion { - return & bindgen --version + return bindgen --version } function Get-CbindgenVersion { - return & cbindgen --version + return cbindgen --version } function Get-CargoauditVersion { - return & cargo audit --version + return cargo audit --version } function Get-CargooutdatedVersion { - return & cargo outdated --version + return cargo outdated --version } + function Get-PythonVersion { return & python --version } From d3c035c980792c15a1514db9effdbc75dd3be427 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 9 Jul 2020 10:53:31 +0300 Subject: [PATCH 4/4] fix place and naming --- .../SoftwareReport/SoftwareReport.Common.psm1 | 4 ++-- .../SoftwareReport/SoftwareReport.Generator.ps1 | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 1dd6a137c..8e1560eef 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -45,11 +45,11 @@ function Get-CbindgenVersion { return cbindgen --version } -function Get-CargoauditVersion { +function Get-CargoAuditVersion { return cargo audit --version } -function Get-CargooutdatedVersion { +function Get-CargoOutdatedVersion { return cargo outdated --version } diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 7795c1390..ef4af8f3b 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -38,14 +38,6 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-NodeVersion) ) -$markdown += New-MDHeader "Rust packages:" -Level 3 -$markdown += New-MDList -Style Unordered -Lines @( - (Get-BindgenVersion), - (Get-CbindgenVersion), - (Get-CargoauditVersion), - (Get-CargooutdatedVersion) -) - $markdown += New-MDHeader "Package Management" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-ChocoVersion), @@ -114,6 +106,14 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-GoogleCloudSDKVersion) ) +$markdown += New-MDHeader "Rust packages:" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-BindgenVersion), + (Get-CbindgenVersion), + (Get-CargoAuditVersion), + (Get-CargoOutdatedVersion) +) + $markdown += New-MDHeader "Browsers and webdrivers" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-BrowserVersion -Browser "chrome"),