Monorepo for Aesthetic.Computer
aesthetic.computer
1# Setup Perforce for SpiderLily on Windows
2# Run this first to sync the project before building
3
4param(
5 [string]$WorkspacePath = "C:\Perforce\SpiderLily"
6)
7
8Write-Host "=========================================" -ForegroundColor Cyan
9Write-Host "Perforce Setup for SpiderLily" -ForegroundColor Cyan
10Write-Host "=========================================" -ForegroundColor Cyan
11Write-Host ""
12
13# Check if p4 is installed
14if (!(Get-Command p4 -ErrorAction SilentlyContinue)) {
15 Write-Host "[ERROR] Perforce (p4) not found!" -ForegroundColor Red
16 Write-Host ""
17 Write-Host "Please install Perforce P4V client from:"
18 Write-Host " https://www.perforce.com/downloads/helix-visual-client-p4v"
19 Write-Host ""
20 Write-Host "Or install p4 command line:"
21 Write-Host " https://www.perforce.com/downloads/helix-command-line-client-p4"
22 Write-Host ""
23 exit 1
24}
25
26Write-Host "[OK] Found p4 command" -ForegroundColor Green
27Write-Host ""
28
29# Set Perforce environment
30$P4PORT = "ssl:falsework.helixcore.io:1666"
31$env:P4PORT = $P4PORT
32
33Write-Host "Perforce Server: $P4PORT" -ForegroundColor Cyan
34Write-Host ""
35
36# Prompt for credentials
37$P4USER = Read-Host "Enter your Perforce username"
38$P4PASSWORD = Read-Host "Enter your Perforce password" -AsSecureString
39$P4PASSWORD_Plain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
40 [Runtime.InteropServices.Marshal]::SecureStringToBSTR($P4PASSWORD)
41)
42
43$env:P4USER = $P4USER
44$env:P4PASSWD = $P4PASSWORD_Plain
45
46# Test connection
47Write-Host "Testing connection to $P4PORT..." -ForegroundColor Yellow
48p4 info
49if ($LASTEXITCODE -ne 0) {
50 Write-Host ""
51 Write-Host "[ERROR] Could not connect to Perforce server!" -ForegroundColor Red
52 Write-Host "Please check:"
53 Write-Host " - Server address: $P4PORT"
54 Write-Host " - Your username and password"
55 Write-Host " - Network/firewall settings"
56 Write-Host ""
57 exit 1
58}
59
60Write-Host ""
61Write-Host "[OK] Connected to Perforce!" -ForegroundColor Green
62Write-Host ""
63
64# Create workspace directory
65if (!(Test-Path $WorkspacePath)) {
66 Write-Host "Creating workspace directory: $WorkspacePath" -ForegroundColor Yellow
67 New-Item -ItemType Directory -Path $WorkspacePath -Force | Out-Null
68}
69
70# List available workspaces/clients
71Write-Host "Your Perforce workspaces:" -ForegroundColor Cyan
72p4 clients -u $P4USER
73
74Write-Host ""
75Write-Host "=========================================" -ForegroundColor Cyan
76Write-Host ""
77Write-Host "Next steps:" -ForegroundColor Yellow
78Write-Host "1. Create or select a Perforce workspace/client for SpiderLily"
79Write-Host "2. Set your workspace root to: $WorkspacePath"
80Write-Host "3. Sync the project: p4 sync"
81Write-Host ""
82Write-Host "Or use P4V GUI:"
83Write-Host " - Connection: $P4PORT"
84Write-Host " - User: $P4USER"
85Write-Host " - Create workspace mapping to: $WorkspacePath"
86Write-Host ""
87Write-Host "After syncing, update build-false-work.ps1:"
88Write-Host " Set ProjectRoot = `"$WorkspacePath`""
89Write-Host ""
90
91# Save connection info for future use
92$p4ConfigPath = "$WorkspacePath\.p4config"
93Write-Host "Saving Perforce config to: $p4ConfigPath" -ForegroundColor Yellow
94@"
95P4PORT=$P4PORT
96P4USER=$P4USER
97"@ | Out-File -FilePath $p4ConfigPath -Encoding ASCII
98
99Write-Host "[OK] Setup complete!" -ForegroundColor Green
100Write-Host ""