You've already forked CC-Framework.BriskGameServer
Add package sync workflow
This commit is contained in:
69
Tools/Sync-BriskPackage.ps1
Normal file
69
Tools/Sync-BriskPackage.ps1
Normal file
@@ -0,0 +1,69 @@
|
||||
param(
|
||||
[string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Assert-PathExists {
|
||||
param(
|
||||
[string]$Path,
|
||||
[string]$Description
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $Path)) {
|
||||
throw "$Description not found: $Path"
|
||||
}
|
||||
}
|
||||
|
||||
function Reset-Directory {
|
||||
param([string]$Path)
|
||||
|
||||
if (Test-Path -LiteralPath $Path) {
|
||||
Remove-Item -LiteralPath $Path -Recurse -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $Path | Out-Null
|
||||
}
|
||||
|
||||
function Copy-DirectoryContents {
|
||||
param(
|
||||
[string]$Source,
|
||||
[string]$Destination
|
||||
)
|
||||
|
||||
Assert-PathExists -Path $Source -Description "Source directory"
|
||||
Reset-Directory -Path $Destination
|
||||
|
||||
Get-ChildItem -LiteralPath $Source -Force | ForEach-Object {
|
||||
Copy-Item -LiteralPath $_.FullName -Destination $Destination -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
$packageRoot = Join-Path $ProjectRoot "PackageSource/com.foldcc.cc-framework.BriskGameServer"
|
||||
$runtimeSource = Join-Path $ProjectRoot "Assets/BriskSdk/Runtime"
|
||||
$samplesSource = Join-Path $ProjectRoot "Assets/BriskSdk/Samples/QuickStart"
|
||||
$sceneSource = Join-Path $ProjectRoot "Assets/Scenes/BriskQuickStartScene.unity"
|
||||
$sceneMetaSource = Join-Path $ProjectRoot "Assets/Scenes/BriskQuickStartScene.unity.meta"
|
||||
|
||||
Assert-PathExists -Path $packageRoot -Description "Package root"
|
||||
Assert-PathExists -Path $runtimeSource -Description "Runtime source"
|
||||
Assert-PathExists -Path $samplesSource -Description "Sample source"
|
||||
Assert-PathExists -Path $sceneSource -Description "Sample scene"
|
||||
Assert-PathExists -Path $sceneMetaSource -Description "Sample scene meta"
|
||||
|
||||
$runtimeTarget = Join-Path $packageRoot "Runtime"
|
||||
$samplesTarget = Join-Path $packageRoot "Samples~/QuickStart"
|
||||
$samplesRootTarget = Join-Path $packageRoot "Samples~"
|
||||
|
||||
Copy-DirectoryContents -Source $runtimeSource -Destination $runtimeTarget
|
||||
|
||||
if (-not (Test-Path -LiteralPath $samplesRootTarget)) {
|
||||
New-Item -ItemType Directory -Path $samplesRootTarget | Out-Null
|
||||
}
|
||||
|
||||
Copy-DirectoryContents -Source $samplesSource -Destination $samplesTarget
|
||||
Copy-Item -LiteralPath $sceneSource -Destination $samplesTarget -Force
|
||||
Copy-Item -LiteralPath $sceneMetaSource -Destination $samplesTarget -Force
|
||||
|
||||
Write-Host "Brisk package source synced."
|
||||
Write-Host "Package root: $packageRoot"
|
||||
Reference in New Issue
Block a user