forked from takayuki/Erlang.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherlang.net.build.ps1
More file actions
58 lines (49 loc) · 1.58 KB
/
erlang.net.build.ps1
File metadata and controls
58 lines (49 loc) · 1.58 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
48
49
50
51
52
53
54
55
56
57
58
param(
[switch]$rebuild
)
$ErrorActionPreference = "Stop"
$InformationPreference = "Continue"
$name = "Erlang.NET"
$MSBuild = Resolve-MSBuild
task . Compile
task Premake -If { $rebuild -or !(Test-Path "$name.sln") } {
.\premake5.exe vs2019
}
task Compile Premake, {
if ($rebuild) { $action = 'Rebuild' }
else { $action = 'Build' }
RunMSBuild $action Debug
RunMSBuild $action Release
}
task Clean {
RunMSBuild Clean Debug
RunMSBuild Clean Release
Get-ChildItem .\ -Filter obj -Directory -Recurse | ForEach-Object { Remove-Item $_.FullName -Recurse -Force -ErrorAction SilentlyContinue }
Get-ChildItem .\ -Filter bin -Directory -Recurse | ForEach-Object { Remove-Item $_.FullName -Recurse -Force -ErrorAction SilentlyContinue }
}
task InstallEpmd {
$InstallUtil = FindInstallUtil
& $InstallUtil .\bin\Release\epmd.exe
}
task UninstallEpmd {
$InstallUtil = FindInstallUtil
& $InstallUtil /u .\bin\Release\epmd.exe
}
function RunMSBuild()
{
param(
$action,
$configuration
)
Write-Host "$action $configuration" -ForegroundColor Yellow
exec { & $MSBuild "$name.sln" "-t:$action" "-clp:ErrorsOnly" -m -nologo "-p:Configuration=$configuration" }
}
function FindInstallUtil()
{
$SearchPath = "$env:windir\Microsoft.NET\Framework\"
$Result = (Get-Childitem -Path $SearchPath -Recurse -force -ErrorAction SilentlyContinue -include InstallUtil.exe) | Sort-Object -Descending | Select-Object -First 1
if ($null -eq $Result) {
Write-Error "Cannot locate InstallUtil.exe in $SearchPath"
}
return $Result
}