Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ registry-auth = true
[registries]
powershell = { index = "sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/Cargo/index/" }

[registry]
global-credential-providers = ["cargo:token"]

# Enable Control Flow Guard (needed for OneBranch's post-build analysis).
[target.x86_64-pc-windows-msvc]
rustflags = ["-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", "-Clink-args=/DYNAMICBASE /CETCOMPAT"]

[target.aarch64-windows-msvc]
rustflags = ["-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", "-Clink-args=/DYNAMICBASE"]

# The following is only needed for release builds
[source.crates-io]
replace-with = "powershell"
37 changes: 4 additions & 33 deletions .pipelines/DSC-Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,7 @@ extends:
ob_restore_phase: true
- pwsh: |
Set-Location "$(Build.SourcesDirectory)/DSC"
Write-Host "Use 'powershell' CFS"
Add-Content -Path "./.cargo/config.toml" -Value '[source.crates-io]'
Add-Content -Path "./.cargo/config.toml" -Value 'replace-with = "powershell"'
Add-Content -Path "./.cargo/config.toml" -Value '[registry]'
Add-Content -Path "./.cargo/config.toml" -Value 'global-credential-providers = ["cargo:token"]'

./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck
./build.ps1 -Release -Architecture $(buildName) -SkipLinkCheck -UseCFS
displayName: 'Build $(buildName)'
env:
ob_restore_phase: true
Expand Down Expand Up @@ -279,13 +273,7 @@ extends:
env:
ob_restore_phase: true
- pwsh: |
Write-Host "Use 'powershell' CFS"
Add-Content -Path "./.cargo/config.toml" -Value '[source.crates-io]'
Add-Content -Path "./.cargo/config.toml" -Value 'replace-with = "powershell"'
Add-Content -Path "./.cargo/config.toml" -Value '[registry]'
Add-Content -Path "./.cargo/config.toml" -Value 'global-credential-providers = ["cargo:token"]'

./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu -UseCFS
./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
displayName: 'Build x86_64-unknown-linux-gnu'
Expand Down Expand Up @@ -325,13 +313,7 @@ extends:
env:
ob_restore_phase: true
- pwsh: |
Write-Host "Use 'powershell' CFS"
Add-Content -Path "./.cargo/config.toml" -Value '[source.crates-io]'
Add-Content -Path "./.cargo/config.toml" -Value 'replace-with = "powershell"'
Add-Content -Path "./.cargo/config.toml" -Value '[registry]'
Add-Content -Path "./.cargo/config.toml" -Value 'global-credential-providers = ["cargo:token"]'

./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu -UseCFS
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
displayName: 'Build aarch64-unknown-linux-gnu'
Expand Down Expand Up @@ -379,18 +361,7 @@ extends:
env:
ob_restore_phase: true
- pwsh: |
Write-Host "Use 'powershell' CFS"
Add-Content -Path "./.cargo/config.toml" -Value '[source.crates-io]'
Add-Content -Path "./.cargo/config.toml" -Value 'replace-with = "powershell"'
Add-Content -Path "./.cargo/config.toml" -Value '[registry]'
Add-Content -Path "./.cargo/config.toml" -Value 'global-credential-providers = ["cargo:token"]'

$c = get-content "./.cargo/config.toml" | Out-String
Write-Host $c

$env:CARGO_HTTP_DEBUG=true
$env:CARGO_LOG='network=trace'
./build.ps1 -Release -Architecture $(buildName)
./build.ps1 -Release -Architecture $(buildName) -UseCFS
./build.ps1 -PackageType tgz -Architecture $(buildName) -Release
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
Write-Host "##vso[artifact.upload containerfolder=release;artifactname=release]$(ob_outputDirectory)/DSC-$(PackageVersion)-$(buildName).tar.gz"
Expand Down
4 changes: 0 additions & 4 deletions archive/registry/.cargo/config.toml

This file was deleted.

15 changes: 14 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ param(
[switch]$Test,
[switch]$GetPackageVersion,
[switch]$SkipLinkCheck,
[switch]$UseX64MakeAppx
[switch]$UseX64MakeAppx,
[switch]$UseCFS
)

if ($GetPackageVersion) {
Expand Down Expand Up @@ -171,6 +172,17 @@ if (!$SkipBuild) {
}
New-Item -ItemType Directory $target -ErrorAction Ignore > $null

if (!$UseCFS) {
# this will override the config.toml
Write-Host "Setting CARGO_SOURCE_crates-io_REPLACE_WITH to 'crates-io'"
${env:CARGO_SOURCE_crates-io_REPLACE_WITH} = 'CRATESIO'
$env:CARGO_REGISTRIES_CRATESIO_INDEX = 'sparse+https://index.crates.io/'
} else {
Write-Host "Using CFS for cargo source replacement"
${env:CARGO_SOURCE_crates-io_REPLACE_WITH} = $null
$env:CARGO_REGISTRIES_CRATESIO_INDEX = $null
}

# make sure dependencies are built first so clippy runs correctly
$windows_projects = @("pal", "registry", "reboot_pending", "wmi-adapter")

Expand Down Expand Up @@ -240,6 +252,7 @@ if (!$SkipBuild) {

if ($LASTEXITCODE -ne 0) {
$failed = $true
break
}

$binary = Split-Path $project -Leaf
Expand Down
4 changes: 0 additions & 4 deletions dsc/.cargo/config.toml

This file was deleted.

4 changes: 0 additions & 4 deletions dsc_lib/.cargo/config.toml

This file was deleted.

4 changes: 0 additions & 4 deletions osinfo/.cargo/config.toml

This file was deleted.

4 changes: 0 additions & 4 deletions process/.cargo/config.toml

This file was deleted.

4 changes: 0 additions & 4 deletions tools/dsctest/.cargo/config.toml

This file was deleted.

4 changes: 0 additions & 4 deletions tools/test_group_resource/.cargo/config.toml

This file was deleted.

4 changes: 0 additions & 4 deletions y2j/.cargo/config.toml

This file was deleted.