generated from Wind-Explorer/blank-tauri-app-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle-sidecar.ps1
45 lines (35 loc) · 1.04 KB
/
bundle-sidecar.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$extension = ".exe"
$sidecarName = "GPauseCore"
function Main {
try {
$projectPath = "..\$($sidecarName)\$($sidecarName)\$($sidecarName).csproj"
$outputPath = "src-tauri\binaries\"
$publishArgs = @(
"publish",
$projectPath,
"-c", "Release",
"-f", "net8.0",
"-r", "win-x64",
"--self-contained", "true",
"-p:PublishSingleFile=true",
"-p:DebugType=None",
"-o", $outputPath
)
$output = & dotnet $publishArgs
Write-Output $output
}
catch {
Write-Error "Error: $_"
}
$rustInfo = & rustc -vV
$targetTriple = ($rustInfo | Select-String -Pattern 'host: (\S+)' -AllMatches).Matches[0].Groups[1].Value
if (-not $targetTriple) {
Write-Error "Failed to determine platform target triple"
}
# Ensure paths are treated correctly
$originalPath = "$($outputPath)$($sidecarName)$extension"
$newPath = "$($outputPath)$($sidecarName)-$($targetTriple)$extension"
# Use Move-Item instead of Rename-Item
Move-Item -Path $originalPath -Destination $newPath -Force
}
Main