-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.library.ps1
40 lines (35 loc) · 1.38 KB
/
build.library.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
[cmdletbinding()]
param(
[ValidateSet('Debug','Release')]
[string]
$Configuration = 'Release'
)
$script:ModuleManifest = [IO.Path]::Combine($PSScriptRoot,'src','Thycotic.SecretServer.psd1')
$script:ProjectRoot = [IO.Path]::Combine($PSScriptRoot,'src','Thycotic.SecretServer')
$script:ProjectFile = [IO.Path]::Combine($ProjectRoot, 'Thycotic.SecretServer.csproj')
$script:ProjectOut = [IO.Path]::Combine($PSScriptRoot,'src','bin')
$script:ProjectLibFile = [IO.Path]::Combine($ProjectOut,'Thycotic.SecretServer.dll')
$script:Manifest = Import-PowerShellDataFile -Path $ModuleManifest
$script:Version = $Manifest.ModuleVersion
# Ensure and call the module.
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') {
$InvokeBuildVersion = '5.7.3'
$ErrorActionPreference = 'Stop'
try {
Import-Module InvokeBuild -RequiredVersion $InvokeBuildVersion
} catch {
Install-Module InvokeBuild -RequiredVersion $InvokeBuildVersion -Scope AllUsers -Force
Import-Module InvokeBuild -RequiredVersion $InvokeBuildVersion
}
Invoke-Build -Task $Tasks -File $MyInvocation.MyCommand.Path @PSBoundParameters
return
}
task Clean -Before Build {
if (Test-Path $ProjectLibFile) {
Remove-Item $ProjectLibFile
}
}
task Build {
exec { dotnet build --configuration $Configuration --output $ProjectOut /p:Version=$Version $ProjectFile }
}
task . build