33
44param (
55 [switch ]$Release ,
6- [ValidateSet (' none ' , ' aarch64-pc-windows-msvc' , ' x86_64-pc-windows-msvc' )]
7- $architecture = ' none ' ,
6+ [ValidateSet (' current ' , ' aarch64-pc-windows-msvc' , ' x86_64-pc-windows-msvc' , ' aarch64-apple-darwin ' , ' x86_64-apple-darwin ' , ' aarch64-unknown-linux-gnu ' , ' aarch64-unknown-linux-musl ' , ' x86_64-unknown-linux-gnu ' , ' x86_64-unknown-linux-musl ' )]
7+ $architecture = ' current ' ,
88 [switch ]$Clippy ,
99 [switch ]$Test
1010)
@@ -73,21 +73,22 @@ if ($IsWindows -and !(Get-Command 'link.exe' -ErrorAction Ignore)) {
7373
7474# # Create the output folder
7575$configuration = $Release ? ' release' : ' debug'
76- $target = Join-Path $PSScriptRoot ' bin' $configuration
77- if (Test-Path $target ) {
78- Remove-Item $target - Recurse - ErrorAction Stop
79- }
80- New-Item - ItemType Directory $target > $null
81-
8276$flags = @ ($Release ? ' -r' : $null )
83- if ($architecture -ne ' none' ) {
77+ if ($architecture -eq ' current' ) {
78+ $path = " .\target\$configuration "
79+ $target = Join-Path $PSScriptRoot ' bin' $configuration
80+ }
81+ else {
8482 $flags += ' --target'
8583 $flags += $architecture
8684 $path = " .\target\$architecture \$configuration "
85+ $target = Join-Path $PSScriptRoot ' bin' $architecture $configuration
8786}
88- else {
89- $path = " .\target\$configuration "
87+
88+ if (Test-Path $target ) {
89+ Remove-Item $target - Recurse - ErrorAction Stop
9090}
91+ New-Item - ItemType Directory $target > $null
9192
9293$windows_projects = @ (" pal" , " ntreg" , " ntstatuserror" , " ntuserinfo" , " registry" )
9394$projects = @ (" dsc_lib" , " dsc" , " osinfo" , " test_group_resource" , " y2j" , " powershellgroup" )
@@ -100,7 +101,7 @@ if ($IsWindows) {
100101$failed = $false
101102foreach ($project in $projects ) {
102103 # # Build format_json
103- Write-Host - ForegroundColor Cyan " Building $project ..."
104+ Write-Host - ForegroundColor Cyan " Building $project ... for $architecture "
104105 try {
105106 Push-Location " $PSScriptRoot /$project " - ErrorAction Stop
106107
@@ -146,6 +147,8 @@ if ($failed) {
146147 exit 1
147148}
148149
150+ Copy-Item $PSScriptRoot / tools/ add-path.ps1 $target - Force - ErrorAction Ignore
151+
149152$relative = Resolve-Path $target - Relative
150153Write-Host - ForegroundColor Green " `n EXE's are copied to $target ($relative )"
151154
0 commit comments