Skip to content

Commit cde4407

Browse files
committed
ci: create powershell script for rustflags
1 parent ac684ac commit cde4407

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ jobs:
5252
key: ${{ matrix.backend }}
5353

5454
- name: Setup rustflags
55-
run: |
56-
mkdir .cargo
57-
echo "[target.'cfg(all())']" > .cargo/config.toml
58-
echo 'rustflags = ["${{ matrix.rustflags }}"]' >> .cargo/config.toml
55+
run: pwsh ./Parse-Rustflags.ps1 ${{ matrix.rustflags }}
5956

6057
- name: Build release
6158
working-directory: zed

Parse-Rustflags.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
$rustflags = $args
2+
3+
if ($rustflags.Length -eq 0) {
4+
Write-Host "No rustflags provided"
5+
exit 0
6+
}
7+
8+
$config_path = ".cargo/config.toml"
9+
10+
New-Item -Path $config_path -Force | Out-Null
11+
12+
"[target.'cfg(all())']" | Out-File -FilePath $config_path -Append | Out-Null
13+
14+
"rustflags = [" | Out-File -FilePath $config_path -Append -NoNewLine | Out-Null
15+
foreach ($flag in $rustflags) {
16+
$line = """${flag}"", "
17+
$line | Out-File -FilePath $config_path -Append -NoNewLine | Out-Null
18+
}
19+
"]" | Out-File -FilePath $config_path -Append | Out-Null

0 commit comments

Comments
 (0)