-
Notifications
You must be signed in to change notification settings - Fork 22
/
ExampleBuild.ps1
57 lines (50 loc) · 2.34 KB
/
ExampleBuild.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
45
46
47
48
49
50
51
52
53
54
55
56
57
Param (
[Parameter(Mandatory=$false, HelpMessage="The version the mod should be compiled with")][Alias("ver")][string]$Version,
[Parameter(Mandatory=$false, HelpMessage="Switch to create a clean compilation")][Alias("rebuild")][Switch]$clean,
[Parameter(Mandatory=$false, HelpMessage="To create a release build")][Alias("publish")][Switch]$release,
[Parameter(Mandatory=$false, HelpMessage="To create a github actions build, assumes specific Environment variables are set")][Alias("github-build")][Switch]$actions
)
# The following is an example build file that overwrites the default hostname and status url
$NDKPath = Get-Content $PSScriptRoot/ndkpath.txt
$QPMpackage = "./qpm.json"
$qpmjson = Get-Content $QPMpackage -Raw | ConvertFrom-Json
$ModID = $qpmjson.info.id
$VERSION = $qpmjson.info.version
if (-not $VERSION.Contains("-Test")) {
$VERSION += "-Test"
}
& qpm package edit --version $VERSION
if ((Test-Path "./extern/includes/beatsaber-hook/shared/inline-hook/And64InlineHook.cpp", "./extern/includes/beatsaber-hook/shared/inline-hook/inlineHook.c", "./extern/includes/beatsaber-hook/shared/inline-hook/relocate.c") -contains $false) {
Write-Host "Critical: Missing inline-hook"
if (!(Test-Path "./extern/includes/beatsaber-hook/shared/inline-hook/And64InlineHook.cpp")) {
Write-Host "./extern/includes/beatsaber-hook/shared/inline-hook/And64InlineHook.cpp"
}
if (!(Test-Path "./extern/includes/beatsaber-hook/shared/inline-hook/inlineHook.c")) {
Write-Host "./extern/includes/beatsaber-hook/shared/inline-hook/inlineHook.c"
}
if (!(Test-Path "./extern/includes/beatsaber-hook/inline-hook/shared/relocate.c")) {
Write-Host "./extern/includes/beatsaber-hook/shared/inline-hook/relocate.c"
}
Write-Host "Task Failed, see output above"
exit 1;
}
echo "Building mod $ModID version $VERSION"
if ($clean.IsPresent)
{
if (Test-Path -Path "build")
{
remove-item build -R
}
}
if (($clean.IsPresent) -or (-not (Test-Path -Path "build")))
{
$out = new-item -Path build -ItemType Directory
}
cd build
# Adds your custom server and sets it as default
& cmake -G "Ninja" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DGRAPH_URL="YOUR_SERVER_GRAPH_URL" -DSTATUS_URL="http://YOUR_STATUS_URL" -DSERVER_NAME="Your Server Name" ../
& cmake --build . -j 6
$ExitCode = $LastExitCode
cd ..
exit $ExitCode
echo Done