-
Notifications
You must be signed in to change notification settings - Fork 169
/
build.ps1
44 lines (38 loc) · 1.58 KB
/
build.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
<#
.Synopsis
Build script for AL-Go projects
.Description
This script will run localDevEnv.ps1 in the specified AL-Go project
.Parameter ALGoProject
The name of the AL-Go project
.Parameter AutoFill
If specified, the script will generate a random password and use that for the credential
.Example
.\build.ps1 -ALGoProject "System Application"
.\build.ps1 -ALGoProject "Test Stability Tools" -AutoFill
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'local build')]
param
(
[Parameter(Mandatory=$true)]
[string] $ALGoProject,
[switch] $AutoFill
)
$ErrorActionPreference = "Stop"
if (-not (Get-Module -ListAvailable -Name "BCContainerHelper")) {
Write-Host "BCContainerHelper module not found. Installing..."
Install-Module -Name "BCContainerHelper" -Scope CurrentUser -AllowPrerelease -Force
}
if ($AutoFill) {
Add-Type -AssemblyName System.Web
[securestring] $securePassword = ConvertTo-SecureString -String $([System.Web.Security.Membership]::GeneratePassword(20, 5)) -AsPlainText -Force
$credential = New-Object -TypeName pscredential -ArgumentList admin, $securePassword
$licenseFileUrl = 'none'
$containerName = "bcserver"
$auth = "UserPassword"
}
$scriptPath = Join-Path $PSScriptRoot "build\projects\$ALGoProject\.AL-Go\localDevEnv.ps1" -Resolve
& $scriptPath -containerName $containerName -auth $auth -credential $credential -licenseFileUrl $licenseFileUrl
if ($LASTEXITCODE -ne 0) {
throw "Failed to build"
}