-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.ps1
More file actions
47 lines (36 loc) · 1.34 KB
/
build.ps1
File metadata and controls
47 lines (36 loc) · 1.34 KB
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
46
47
$ErrorActionPreference = "Stop"
$platform="Windows"
# Make sure the source is up to date
&git submodule init
&git submodule update
if ($LASTEXITCODE -ne 0)
{
Write-Error "Git failed"
exit -1
}
# Get a version of NuGet
if (!(Test-Path .\nuget.exe))
{
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile nuget.exe
}
# Clean up the output directory first
if (Test-Path "contents") {
Remove-Item -Force -Recurse -ErrorAction Continue contents
}
function BuildForRid([string] $rid, [string] $toolchain, [string] $buildscript)
{
Write-Host "compiling for $rid using $toolchain"
&rustup default $toolchain
&cmd /c $buildscript
# create a folder for the package to reside in
&mkdir -p runtimes/$rid/native/
Copy-Item rure/target/release/rure* runtimes/$rid/native/
}
BuildForRid "win-x86" "stable-i686" "buildi686.bat"
BuildForRid "win-x64" "stable-x86_64" "buildx86_64.bat"
# Set the buildCiRunNumber and buildCiSuffix variables
$buildCiRunNumber = if ($args.Count -ge 1) { $args[0] } else { "0" }
$buildCiSuffix = if ($args.Count -ge 2) { $args[1] } else { "" }
$buildCiSuffix = $buildCiSuffix -replace '[^a-zA-Z]+', '-'
# Pack it all up
dotnet pack IronRure.Batteries-Windows.csproj -c Release -o bin\artifacts /p:BuildCiRunNumber=$buildCiRunNumber /p:BuildCiBranchSuffix=$buildCiSuffix