-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
112 lines (91 loc) · 4.25 KB
/
Copy pathbuild.ps1
File metadata and controls
112 lines (91 loc) · 4.25 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<#
.SYNOPSIS
Builds the SampleRap Relativity Application Package (RAP).
.DESCRIPTION
Restores NuGet and npm packages, compiles the solution with MSBuild,
and packages the output into a RAP file using the relsvr-rap CLI.
.PARAMETER AssemblyVersion
The three-part version number to embed in the assembly versions (e.g. "1.0.0").
Defaults to "1.0.0". Note that this version is independent of the RAP version.
This means that the assemblies in the RAP can have a different version number than the RAP itself, if desired.
Separating this versions can be useful if the RAP repository is also being used to build libraries
that are consumed by other projects, as it allows the library versions to be updated without changing the RAP version.
.PARAMETER RAPVersion
The four-part version number to embed in the RAP (e.g. "1.0.0.0").
Defaults to "1.0.0.0". Note that this version is independent of the assembly versions in the project files.
.PARAMETER RelativityServerRelease
The Relativity Server release year the RAP is targeting.
Must be one of: "2024", "2025", "2026".
Defaults to "2024".
.PARAMETER Configuration
The MSBuild build configuration to use (e.g. "Debug" or "Release").
Defaults to "Release".
.EXAMPLE
.\build.ps1
.EXAMPLE
.\build.ps1 -RAPVersion "2.0.0.0" -RelativityServerRelease "2025" -Configuration "Debug"
#>
[CmdletBinding()]
param(
[string]$AssemblyVersion = "1.0.0",
[string]$RAPVersion = "1.0.0.0",
[ValidateSet("2024", "2025", "2026")]
[string]$RelativityServerRelease = "2024",
[string]$Configuration = "Release"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$ArtifactsDir = Join-Path $PSScriptRoot "Artifacts"
$LogsDir = Join-Path $ArtifactsDir "Logs"
$LogFilePath = Join-Path $LogsDir "buildsummary.log"
$ErrorLogFilePath = Join-Path $LogsDir "builderrors.log"
function Step([string]$Message) {
Write-Host ""
Write-Host "==> $Message" -ForegroundColor Cyan
}
# ---------------------------------------------------------------------------
# Verify prerequisites
# ---------------------------------------------------------------------------
Step "Verifying relsvr-rap.exe is available"
$RelsvrRapPath = Get-Command relsvr-rap.exe -ErrorAction SilentlyContinue
if (-not $RelsvrRapPath) {
throw "relsvr-rap.exe not found. Please ensure it is installed and available in your PATH."
}
# ---------------------------------------------------------------------------
# 1. Restore NuGet and npm packages
# ---------------------------------------------------------------------------
Step "Restoring NuGet packages for SampleRap.sln"
dotnet restore "$PSScriptRoot\Source\SampleRap.sln"
if ($LASTEXITCODE -ne 0) { throw "dotnet restore failed." }
Step "Restoring npm packages for SampleRap.CustomPage"
Set-Location "$PSScriptRoot\Source\SampleRap.CustomPage\"
npm install
if ($LASTEXITCODE -ne 0) { throw "npm install failed." }
Set-Location $PSScriptRoot
# ---------------------------------------------------------------------------
# 2. Build the solution
# ---------------------------------------------------------------------------
Step "Building SampleRap.sln (configuration: $Configuration)"
msbuild @("$PSScriptRoot\Source\SampleRap.sln",
("/property:Configuration=$Configuration"),
("/property:Version=$AssemblyVersion"),
("/consoleloggerparameters:Summary"),
("/property:PublishWebProjects=True"),
("/nodeReuse:False"),
("/maxcpucount"),
("/nologo"),
("/fileloggerparameters1:LogFile=$LogFilePath"),
("/fileloggerparameters2:errorsonly;LogFile=$ErrorLogFilePath"))
if ($LASTEXITCODE -ne 0) { throw "msbuild failed." }
# ---------------------------------------------------------------------------
# 3. Build the RAP
# ---------------------------------------------------------------------------
Step "Building RAP with relsvr-rap (version $RAPVersion, target $RelativityServerRelease)"
relsvr-rap.exe build `
--source "$PSScriptRoot" `
--input "DevelopmentScripts\build.xml" `
--version $RAPVersion `
--relativity-server-release $RelativityServerRelease `
--log-file "$LogsDir\rapbuild.log"
if ($LASTEXITCODE -ne 0) { throw "relsvr-rap build failed." }
Step "Done. RAP written to Artifacts\SampleRap.rap"