-
Notifications
You must be signed in to change notification settings - Fork 7
/
Generate-Assets-Package.ps1
60 lines (51 loc) · 1.98 KB
/
Generate-Assets-Package.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
58
59
60
<#
.SYNOPSIS
Evergine MRTK Assets Packages generator script, (c) 2022 Evergine
.DESCRIPTION
This script generates Assets packages for the Mixed Reality Toolkit for Evergine
It's meant to have the same behavior when executed locally as when it's executed in a CI pipeline.
.EXAMPLE
<script> -version 2022.2.11.1-local
.LINK
https://evergine.com/
#>
param (
[Parameter(mandatory=$true)][string]$version,
[string]$outputFolderBase = "wepkgs",
[string]$buildVerbosity = "normal",
[string]$buildConfiguration = "Release",
[string]$assetsCsprojPath = "Source\Evergine.MRTK.Assets\Evergine.MRTK.Assets.csproj",
[string]$wespecPath = "Source\Evergine.MRTK.Assets\Evergine.MRTK.wespec"
)
# Source helper functions
. ./Helpers.ps1
# Show variables
ShowVariables $version $buildConfiguration $buildVerbosity $outputFolderBase
# Install YAML cmdlets
if (Get-Module -ListAvailable -Name powershell-yaml)
{
Write-Host "Skip: powershell-yaml already installed"
}
else
{
Write-Host "Installing powershell-yaml"
Install-Module -Name powershell-yaml -Force -Repository PSGallery -Scope CurrentUser
if (-Not $?)
{
throw "Could not install YAML module. Code: {$lastexitcode}"
}
}
# Update wespec file
Write-Host "Updating version dependency for $wespecPath"
$wespecContents = Get-Content -Raw -Path $wespecPath | ConvertFrom-Yaml -Ordered
$wespecContents.Nugets = $wespecContents.Nugets -replace "2023.0.0.0-preview$", $version
ConvertTo-Yaml -Data $wespecContents | Out-File -Encoding ascii -FilePath $wespecPath
# Create output folder
$absoluteOutputFolder = (CreateOutputFolder $outputFolderBase)
# Locate build tools and enter build environment
PrepareEnvironment
# Generate packages
LogDebug "START assets packaging process"
& msbuild -t:restore "$assetsCsprojPath" -p:RestorePackagesConfig=true
& msbuild -t:build "$assetsCsprojPath" -v:$buildVerbosity -p:Configuration=$buildConfiguration -t:CreateEvergineAddOn -p:Version=$version -p:OutputPath="$absoluteOutputFolder"
LogDebug "END assets packaging process"