@@ -21,109 +21,48 @@ Analyzing code with
21
21
"@
22
22
23
23
if ($CheckWasm ) {
24
- # Temporary fix to exit immediately on failure. LogError should Write-Error
25
- # instead
26
- $command = " rustup target add wasm32-unknown-unknown"
27
- Invoke-LoggedCommand $command
28
- if ($LastExitCode ) {
29
- Write-Error " Failed to execute $command "
30
- }
24
+ Invoke-LoggedCommand " rustup target add wasm32-unknown-unknown"
31
25
}
32
26
33
27
if ($Deny ) {
34
- # Temporary fix to exit immediately on failure. LogError should Write-Error
35
- # instead
36
- $command = " cargo install cargo-deny --locked"
37
- Invoke-LoggedCommand $command
38
- if ($LastExitCode ) {
39
- Write-Error " Failed to execute $command "
40
- }
28
+ Invoke-LoggedCommand " cargo install cargo-deny --locked"
41
29
}
42
30
43
- # Temporary fix to exit immediately on failure. LogError should Write-Error
44
- # instead
45
- $command = " cargo check --package azure_core --all-features --all-targets --keep-going"
46
- Invoke-LoggedCommand $command
47
- if ($LastExitCode ) {
48
- Write-Error " Failed to execute $command "
49
- }
31
+ Invoke-LoggedCommand " cargo check --package azure_core --all-features --all-targets --keep-going"
50
32
51
- # Temporary fix to exit immediately on failure. LogError should Write-Error
52
- # instead
53
- $command = " cargo fmt --all -- --check"
54
- Invoke-LoggedCommand $command
55
- if ($LastExitCode ) {
56
- Write-Error " Failed to execute $command "
57
- }
33
+ Invoke-LoggedCommand " cargo fmt --all -- --check"
58
34
59
- # Temporary fix to exit immediately on failure. LogError should Write-Error
60
- # instead
61
- $command = " cargo clippy --workspace --all-features --all-targets --keep-going --no-deps"
62
- Invoke-LoggedCommand $command
63
- if ($LastExitCode ) {
64
- Write-Error " Failed to execute $command "
65
- }
35
+ Invoke-LoggedCommand " cargo clippy --workspace --all-features --all-targets --keep-going --no-deps"
66
36
67
37
if ($CheckWasm ) {
68
38
# Save the original RUSTFLAGS to restore later
69
39
$OriginalRustFlags = $env: RUSTFLAGS
70
40
# This is needed to ensure that the `getrandom` crate uses the `wasm_js` backend
71
41
$env: RUSTFLAGS = ${env: RUSTFLAGS} + ' --cfg getrandom_backend="wasm_js"'
72
42
73
- # Temporary fix to exit immediately on failure. LogError should Write-Error
74
- # instead
75
- $command = " cargo clippy --target=wasm32-unknown-unknown --workspace --keep-going --no-deps"
76
- Invoke-LoggedCommand $command
77
- if ($LastExitCode ) {
78
- Write-Error " Failed to execute $command "
79
- }
43
+ Invoke-LoggedCommand " cargo clippy --target=wasm32-unknown-unknown --workspace --keep-going --no-deps"
80
44
81
45
# Restore the original RUSTFLAGS, since the getrandom config option can only be set for wasm32-unknown-unknown builds.
82
46
$env: RUSTFLAGS = $OriginalRustFlags
83
47
}
84
48
85
49
if ($Deny ) {
86
- # Temporary fix to exit immediately on failure. LogError should Write-Error
87
- # instead
88
- $command = " cargo deny --all-features check"
89
- Invoke-LoggedCommand $command
90
- if ($LastExitCode ) {
91
- Write-Error " Failed to execute $command "
92
- }
50
+ Invoke-LoggedCommand " cargo deny --all-features check"
93
51
}
94
52
95
- # Temporary fix to exit immediately on failure. LogError should Write-Error
96
- # instead
97
- $command = " cargo doc --workspace --no-deps --all-features"
98
- Invoke-LoggedCommand $command
99
- if ($LastExitCode ) {
100
- Write-Error " Failed to execute $command "
101
- }
53
+ Invoke-LoggedCommand " cargo doc --workspace --no-deps --all-features"
102
54
103
55
# Verify package dependencies
104
56
$verifyDependenciesScript = Join-Path $RepoRoot ' eng' ' scripts' ' verify-dependencies.rs' - Resolve
105
57
106
58
if (! $SkipPackageAnalysis ) {
107
59
if (! (Test-Path $PackageInfoDirectory )) {
108
60
Write-Host " Analyzing workspace`n "
109
- # Temporary fix to exit immediately on failure. LogError should Write-Error
110
- # instead
111
- $command = " &$verifyDependenciesScript $RepoRoot /Cargo.toml"
112
- $result = Invoke-LoggedCommand $command
113
- if ($LastExitCode ) {
114
- Write-Error " Failed to execute $command "
115
- }
116
- return $result
61
+ return Invoke-LoggedCommand " &$verifyDependenciesScript $RepoRoot /Cargo.toml"
117
62
}
118
63
119
64
if ($Toolchain -eq ' nightly' ) {
120
- # Temporary fix to exit immediately on failure. LogError should Write-Error
121
- # instead
122
- $command = " cargo install --locked cargo-docs-rs"
123
- Invoke-LoggedCommand $command
124
- if ($LastExitCode ) {
125
- Write-Error " Failed to execute $command "
126
- }
65
+ Invoke-LoggedCommand " cargo install --locked cargo-docs-rs"
127
66
}
128
67
129
68
$packagesToTest = Get-ChildItem $PackageInfoDirectory - Filter " *.json" - Recurse
@@ -132,22 +71,10 @@ if (!$SkipPackageAnalysis) {
132
71
133
72
foreach ($package in $packagesToTest ) {
134
73
Write-Host " Analyzing package '$ ( $package.Name ) ' in directory '$ ( $package.DirectoryPath ) '`n "
135
- # Temporary fix to exit immediately on failure. LogError should Write-Error
136
- # instead
137
- $command = " &$verifyDependenciesScript $ ( $package.DirectoryPath ) /Cargo.toml"
138
- Invoke-LoggedCommand $command
139
- if ($LastExitCode ) {
140
- Write-Error " Failed to execute $command "
141
- }
74
+ Invoke-LoggedCommand " &$verifyDependenciesScript $ ( $package.DirectoryPath ) /Cargo.toml"
142
75
143
76
if ($Toolchain -eq ' nightly' ) {
144
- # Temporary fix to exit immediately on failure. LogError should Write-Error
145
- # instead
146
- $command = " cargo +nightly docs-rs --package $ ( $package.Name ) "
147
- Invoke-LoggedCommand $command
148
- if ($LastExitCode ) {
149
- Write-Error " Failed to execute $command "
150
- }
77
+ Invoke-LoggedCommand " cargo +nightly docs-rs --package $ ( $package.Name ) "
151
78
}
152
79
}
153
80
}
0 commit comments