refactor: move server rs workspace entries into crates
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
param(
|
||||
[Alias("h")]
|
||||
[switch]$Help,
|
||||
[string]$Package = ""
|
||||
[Alias("Package")]
|
||||
[string]$Crate = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -11,12 +12,12 @@ function Write-Usage {
|
||||
@(
|
||||
'Usage:'
|
||||
' ./server-rs/scripts/check.ps1'
|
||||
' ./server-rs/scripts/check.ps1 -Package api-server'
|
||||
' ./server-rs/scripts/check.ps1 -Crate api-server'
|
||||
''
|
||||
'Notes:'
|
||||
' 1. Run cargo fmt --all --check for the whole server-rs workspace'
|
||||
' 2. Run clippy/check/test for the whole workspace by default'
|
||||
' 3. Use -Package to target one workspace package for clippy/check/test'
|
||||
' 3. Use -Crate to target one workspace crate for clippy/check/test'
|
||||
) -join [Environment]::NewLine
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ Push-Location $serverRsDir
|
||||
try {
|
||||
cargo fmt --all --check --manifest-path $manifestPath
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Package)) {
|
||||
if ([string]::IsNullOrWhiteSpace($Crate)) {
|
||||
Write-Host "[server-rs:check] step: cargo clippy --workspace --all-targets --all-features -D warnings"
|
||||
cargo clippy --workspace --manifest-path $manifestPath --all-targets --all-features -- -D warnings
|
||||
|
||||
@@ -51,15 +52,15 @@ try {
|
||||
cargo test --workspace --manifest-path $manifestPath
|
||||
}
|
||||
else {
|
||||
Write-Host "[server-rs:check] target package: $Package"
|
||||
Write-Host "[server-rs:check] step: cargo clippy -p $Package --all-targets --all-features -D warnings"
|
||||
cargo clippy -p $Package --manifest-path $manifestPath --all-targets --all-features -- -D warnings
|
||||
Write-Host "[server-rs:check] target crate: $Crate"
|
||||
Write-Host "[server-rs:check] step: cargo clippy -p $Crate --all-targets --all-features -D warnings"
|
||||
cargo clippy -p $Crate --manifest-path $manifestPath --all-targets --all-features -- -D warnings
|
||||
|
||||
Write-Host "[server-rs:check] step: cargo check -p $Package"
|
||||
cargo check -p $Package --manifest-path $manifestPath
|
||||
Write-Host "[server-rs:check] step: cargo check -p $Crate"
|
||||
cargo check -p $Crate --manifest-path $manifestPath
|
||||
|
||||
Write-Host "[server-rs:check] step: cargo test -p $Package"
|
||||
cargo test -p $Package --manifest-path $manifestPath
|
||||
Write-Host "[server-rs:check] step: cargo test -p $Crate"
|
||||
cargo test -p $Crate --manifest-path $manifestPath
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user