demo
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AssemblyName>ExampleGreedMod.Rules</AssemblyName>
|
||||
<RootNamespace>ExampleGreedMod</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReplacedPerson.Core\ReplacedPerson.Core.csproj" />
|
||||
<Compile Include="..\..\Assets\Demos\ReplacedPerson\Mods\ExampleGreedMod\Rules\ExampleGreedRules.cs" Link="ExampleGreedRules.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,54 @@
|
||||
param(
|
||||
[string]$Configuration = 'Release',
|
||||
[string]$OutputRoot = "$PSScriptRoot\..\ReplacedPerson.ServerHost\Mods\ExampleGreedMod",
|
||||
[string]$ArtifactRoot = "$PSScriptRoot\..\..\Artifacts\ReplacedPersonMods"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$sourceRoot = Resolve-Path "$PSScriptRoot\..\..\Assets\Demos\ReplacedPerson\Mods\ExampleGreedMod"
|
||||
$project = "$PSScriptRoot\ExampleGreedMod.Rules.csproj"
|
||||
dotnet build $project -c $Configuration
|
||||
|
||||
$resolvedOutput = [System.IO.Path]::GetFullPath($OutputRoot)
|
||||
$expectedParent = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\ReplacedPerson.ServerHost\Mods")
|
||||
if (-not $resolvedOutput.StartsWith($expectedParent, [System.StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "OutputRoot must remain under $expectedParent"
|
||||
}
|
||||
if (Test-Path -LiteralPath $resolvedOutput) {
|
||||
Remove-Item -LiteralPath $resolvedOutput -Recurse -Force
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $resolvedOutput | Out-Null
|
||||
|
||||
$rulesDll = "$PSScriptRoot\bin\$Configuration\net8.0\ExampleGreedMod.Rules.dll"
|
||||
Copy-Item -LiteralPath $rulesDll -Destination "$resolvedOutput\ExampleGreedMod.Rules.dll"
|
||||
Copy-Item -LiteralPath "$sourceRoot\content.json" -Destination "$resolvedOutput\content.json"
|
||||
Copy-Item -LiteralPath "$sourceRoot\icon.png" -Destination "$resolvedOutput\icon.png"
|
||||
|
||||
$unityDll = "$PSScriptRoot\..\..\Library\ScriptAssemblies\ExampleGreedMod.Unity.dll"
|
||||
if (Test-Path -LiteralPath $unityDll) {
|
||||
Copy-Item -LiteralPath $unityDll -Destination "$resolvedOutput\ExampleGreedMod.Unity.dll"
|
||||
}
|
||||
|
||||
$files = Get-ChildItem -LiteralPath $resolvedOutput -File | Sort-Object Name | ForEach-Object {
|
||||
[ordered]@{
|
||||
path = $_.Name
|
||||
sha256 = (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
}
|
||||
}
|
||||
$manifest = [ordered]@{
|
||||
id = 'example.greedy-training'
|
||||
version = '1.0.0'
|
||||
rulesAssembly = 'ExampleGreedMod.Rules.dll'
|
||||
unityAssembly = if (Test-Path -LiteralPath "$resolvedOutput\ExampleGreedMod.Unity.dll") { 'ExampleGreedMod.Unity.dll' } else { $null }
|
||||
content = 'content.json'
|
||||
icon = 'icon.png'
|
||||
networkCompatible = $true
|
||||
files = @($files)
|
||||
}
|
||||
$manifest | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath "$resolvedOutput\manifest.json" -Encoding utf8
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $ArtifactRoot | Out-Null
|
||||
$zipPath = Join-Path $ArtifactRoot 'ExampleGreedMod-1.0.0.zip'
|
||||
if (Test-Path -LiteralPath $zipPath) { Remove-Item -LiteralPath $zipPath -Force }
|
||||
Compress-Archive -Path "$resolvedOutput\*" -DestinationPath $zipPath -CompressionLevel Optimal
|
||||
Write-Output $zipPath
|
||||
Reference in New Issue
Block a user