File size: 1,589 Bytes
bc32e7b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | <#
.SYNOPSIS
Runs the local maintenance checks for Tomato Novel Downloader.
.DESCRIPTION
This script intentionally avoids `cargo --all-features` because the project has
mutually exclusive features: `official-api` and `no-official-api`.
Run from the repository root:
pwsh ./scripts/maintain.ps1
powershell -ExecutionPolicy Bypass -File ./scripts/maintain.ps1
#>
param(
[switch]$SkipFmt,
[switch]$SkipNoOfficial,
[switch]$SkipTree
)
$ErrorActionPreference = "Stop"
function Invoke-Step {
param(
[Parameter(Mandatory = $true)]
[string]$Name,
[Parameter(Mandatory = $true)]
[scriptblock]$Script
)
Write-Host "`n==> $Name" -ForegroundColor Cyan
& $Script
}
$repoRoot = Split-Path -Parent $PSScriptRoot
Set-Location $repoRoot
Invoke-Step "Rust toolchain" {
rustc --version
cargo --version
}
if (-not $SkipFmt) {
Invoke-Step "Format check" {
cargo fmt --all -- --check
}
}
Invoke-Step "Default feature tests" {
cargo test
}
Invoke-Step "Default feature clippy" {
cargo clippy --all-targets -- -D warnings
}
if (-not $SkipNoOfficial) {
Invoke-Step "no-official-api tests" {
cargo test --no-default-features --features no-official-api
}
Invoke-Step "no-official-api clippy" {
cargo clippy --no-default-features --features no-official-api --all-targets -- -D warnings
}
}
if (-not $SkipTree) {
Invoke-Step "Duplicate dependency overview" {
cargo tree -d
}
}
Write-Host "`nAll requested maintenance checks completed." -ForegroundColor Green
|