Skip to content

Commit 2a82283

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
make cargo install use crates.io
1 parent 3605c8b commit 2a82283

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

build.ps1

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ param(
2323
[switch]$Verbose
2424
)
2525

26-
$env:RUSTC_LOG=$null
27-
$env:RUSTFLAGS='-Dwarnings'
28-
$usingADO = ($null -ne $env:TF_BUILD)
29-
3026
trap {
3127
Write-Error "An error occurred: $($_ | Out-String)"
3228
exit 1
3329
}
3430

31+
$env:RUSTC_LOG=$null
32+
$env:RUSTFLAGS='-Dwarnings'
33+
$usingADO = ($null -ne $env:TF_BUILD)
34+
if ($usingADO -or $UseCFSAuth) {
35+
$UseCFS = $true
36+
}
37+
3538
if ($Verbose) {
3639
$env:RUSTC_LOG='rustc_codegen_ssa::back::link=info'
3740
}
@@ -171,7 +174,7 @@ if ($null -ne (Get-Command msrustup -CommandType Application -ErrorAction Ignore
171174
if ($null -ne $packageType) {
172175
$SkipBuild = $true
173176
} else {
174-
if ($UseCFS -or $UseCFSAuth -or $usingADO) {
177+
if ($UseCFS) {
175178
Write-Host "Using CFS for cargo source replacement"
176179
${env:CARGO_SOURCE_crates-io_REPLACE_WITH} = $null
177180
$env:CARGO_REGISTRIES_CRATESIO_INDEX = $null
@@ -262,7 +265,11 @@ if ($null -ne $packageType) {
262265
## Test if tree-sitter is installed
263266
if ($null -eq (Get-Command tree-sitter -ErrorAction Ignore)) {
264267
Write-Verbose -Verbose "tree-sitter not found, installing..."
265-
cargo install tree-sitter-cli --config .cargo/config.toml
268+
if ($UseCFS) {
269+
cargo install tree-sitter-cli --config .cargo/config.toml
270+
} else {
271+
cargo install tree-sitter-cli
272+
}
266273
if ($LASTEXITCODE -ne 0) {
267274
throw "Failed to install tree-sitter-cli"
268275
}
@@ -380,7 +387,11 @@ if (!$SkipBuild) {
380387
else {
381388
if ($Audit) {
382389
if ($null -eq (Get-Command cargo-audit -ErrorAction Ignore)) {
383-
cargo install cargo-audit --features=fix --config .cargo/config.toml
390+
if ($UseCFS) {
391+
cargo install cargo-audit --features=fix --config .cargo/config.toml
392+
} else {
393+
cargo install cargo-audit --features=fix
394+
}
384395
}
385396

386397
cargo audit fix
@@ -413,7 +424,11 @@ if (!$SkipBuild) {
413424
else {
414425
if ($Audit) {
415426
if ($null -eq (Get-Command cargo-audit -ErrorAction Ignore)) {
416-
cargo install cargo-audit --features=fix --config .cargo/config.toml
427+
if ($UseCFS) {
428+
cargo install cargo-audit --features=fix --config .cargo/config.toml
429+
} else {
430+
cargo install cargo-audit --features=fix
431+
}
417432
}
418433

419434
cargo audit fix

0 commit comments

Comments
 (0)