Monorepo for Aesthetic.Computer
aesthetic.computer
1# Create a new Perforce workspace for local Windows builds
2# Simplified version with hardcoded depot mapping
3
4$ErrorActionPreference = "Stop"
5
6Write-Host "=========================================" -ForegroundColor Cyan
7Write-Host "Create Perforce Workspace for SpiderLily" -ForegroundColor Cyan
8Write-Host "=========================================" -ForegroundColor Cyan
9Write-Host ""
10
11# Set Perforce environment
12$env:P4PORT = "ssl:falsework.helixcore.io:1666"
13$env:P4USER = "machine"
14
15# Get computer name for unique workspace
16$hostname = $env:COMPUTERNAME.ToLower()
17$workspaceName = "spiderlily_windows_$hostname"
18$workspaceRoot = "C:\Perforce\SpiderLily"
19
20Write-Host "Server: $env:P4PORT" -ForegroundColor Cyan
21Write-Host "User: $env:P4USER" -ForegroundColor Cyan
22Write-Host "New Workspace: $workspaceName" -ForegroundColor Cyan
23Write-Host "Root Directory: $workspaceRoot" -ForegroundColor Cyan
24Write-Host ""
25
26# Create workspace directory
27if (!(Test-Path $workspaceRoot)) {
28 Write-Host "Creating directory: $workspaceRoot" -ForegroundColor Yellow
29 New-Item -ItemType Directory -Path $workspaceRoot -Force | Out-Null
30}
31
32# Check if workspace already exists
33$existingClient = p4 clients -e $workspaceName 2>$null
34if ($existingClient) {
35 Write-Host "[OK] Workspace '$workspaceName' already exists" -ForegroundColor Green
36 $env:P4CLIENT = $workspaceName
37 Write-Host ""
38 Write-Host "Ready to sync! Run:" -ForegroundColor Cyan
39 Write-Host " p4 sync" -ForegroundColor White
40 Write-Host ""
41 Write-Host "Or continue with the build process." -ForegroundColor Yellow
42 exit 0
43}
44
45Write-Host "Creating new workspace..." -ForegroundColor Yellow
46Write-Host ""
47
48# Create workspace spec with standard SpiderLily mapping
49$clientSpec = @"
50Client: $workspaceName
51
52Owner: $env:P4USER
53
54Host: $hostname
55
56Description:
57 Local Windows build workspace for SpiderLily
58
59Root: $workspaceRoot
60
61Options: noallwrite noclobber nocompress unlocked nomodtime normdir
62
63SubmitOptions: submitunchanged
64
65LineEnd: local
66
67View:
68 //SpiderLily/... //$workspaceName/...
69"@
70
71# Create client using piped input
72$clientSpec | p4 client -i
73
74if ($LASTEXITCODE -ne 0) {
75 Write-Host ""
76 Write-Host "[ERROR] Failed to create workspace!" -ForegroundColor Red
77 Write-Host ""
78 Write-Host "Try creating manually with P4V:" -ForegroundColor Yellow
79 Write-Host " 1. Open P4V" -ForegroundColor Gray
80 Write-Host " 2. Connection -> New Workspace" -ForegroundColor Gray
81 Write-Host " 3. Name: $workspaceName" -ForegroundColor Gray
82 Write-Host " 4. Root: $workspaceRoot" -ForegroundColor Gray
83 Write-Host " 5. Add view: //SpiderLily/... //$workspaceName/..." -ForegroundColor Gray
84 exit 1
85}
86
87Write-Host ""
88Write-Host "[OK] Workspace created successfully!" -ForegroundColor Green
89Write-Host ""
90Write-Host "Workspace: $workspaceName" -ForegroundColor Cyan
91Write-Host "Root: $workspaceRoot" -ForegroundColor Cyan
92Write-Host ""
93Write-Host "Next: Sync the files" -ForegroundColor Yellow
94Write-Host " Run: " -ForegroundColor Gray
95Write-Host " `$env:P4CLIENT = '$workspaceName'" -ForegroundColor White
96Write-Host " p4 sync" -ForegroundColor White
97Write-Host ""
98
99# Set for this session
100$env:P4CLIENT = $workspaceName
101Write-Host "[OK] Environment configured for this session" -ForegroundColor Green
102Write-Host ""