|
1 | | -# Codesphere Unified Branding Script (Windows) |
2 | | -# This script orchestrates the complete rebranding pipeline |
| 1 | +# Codesphere Master Local Branding Script (Windows) |
| 2 | +# This script orchestrates the complete rebranding pipeline for local development. |
3 | 3 |
|
4 | 4 | $ErrorActionPreference = "Stop" |
5 | 5 |
|
6 | | -Write-Host "🚀 Starting Codesphere rebrand pipeline..." -ForegroundColor Green |
7 | | - |
8 | | -# Define paths |
9 | 6 | $RepoRoot = Split-Path -Parent $PSScriptRoot |
| 7 | +$CiDir = Join-Path $RepoRoot "ci" |
10 | 8 | $VscodiumDir = Join-Path $RepoRoot "vendor\vscodium" |
11 | | -$BrandingDir = Join-Path $RepoRoot "branding" |
12 | | -$VscodeDir = Join-Path $VscodiumDir "vscode" |
13 | 9 |
|
14 | | -# Export environment variables for VSCodium build |
15 | | -$env:APP_NAME = "Codesphere" |
16 | | -$env:APP_NAME_LC = "codesphere" |
17 | | -$env:BINARY_NAME = "codesphere" |
18 | | -$env:GH_REPO_PATH = "Codesphere/codesphere" |
19 | | -$env:ORG_NAME = "Codesphere" |
20 | | -$env:ASSETS_REPOSITORY = "Codesphere/codesphere" |
21 | | -$env:VSCODE_QUALITY = "stable" |
22 | | -$env:SHOULD_BUILD = "yes" |
23 | | -$env:SHOULD_BUILD_REH = "no" |
24 | | -$env:CI_BUILD = "no" |
25 | | -$env:DISABLE_UPDATE = "no" |
| 10 | +Write-Host "🚀 Starting Codesphere Master Branding Pipeline..." -ForegroundColor Green |
| 11 | +Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" |
26 | 12 |
|
27 | | -Write-Host "📦 Environment configured:" -ForegroundColor Cyan |
28 | | -Write-Host " APP_NAME: $($env:APP_NAME)" |
29 | | -Write-Host " BINARY_NAME: $($env:BINARY_NAME)" |
30 | | -Write-Host " VSCODE_QUALITY: $($env:VSCODE_QUALITY)" |
31 | | -Write-Host "" |
| 13 | +# Step 1: Prepare Branding & Patch Build Scripts |
| 14 | +Write-Host "🎨 Step 1: Preparing branding environment..." -ForegroundColor Cyan |
| 15 | +& bash (Join-Path $CiDir "ci-branding.sh") |
32 | 16 |
|
33 | | -# Step 1: Fetch upstream VS Code |
34 | | -Write-Host "📥 Step 1: Fetching upstream VS Code..." -ForegroundColor Yellow |
| 17 | +# Step 2: Fetch VSCodium Source (if not already fetched) |
| 18 | +Write-Host "" |
| 19 | +Write-Host "📥 Step 2: Fetching VSCodium/VS Code Source..." -ForegroundColor Yellow |
35 | 20 | Set-Location $VscodiumDir |
36 | | - |
37 | 21 | if (-Not (Test-Path "vscode")) { |
38 | | - Write-Host "Running prepare_vscode.sh to fetch VS Code source..." |
39 | | - & bash ./prepare_vscode.sh |
40 | | - if ($LASTEXITCODE -ne 0) { |
41 | | - throw "Failed to prepare VS Code source" |
42 | | - } |
| 22 | + & bash ./get_repo.sh |
43 | 23 | } else { |
44 | | - Write-Host "VS Code source already exists. Skipping fetch." |
45 | | -} |
46 | | - |
47 | | -# Step 2: Apply Codesphere product.json |
48 | | -Write-Host "🎨 Step 2: Applying Codesphere product.json..." -ForegroundColor Yellow |
49 | | -$ProductJsonPath = Join-Path $BrandingDir "product.json" |
50 | | - |
51 | | -if (Test-Path $ProductJsonPath) { |
52 | | - Set-Location $VscodeDir |
53 | | - |
54 | | - if (Test-Path "product.json") { |
55 | | - # Backup original |
56 | | - Copy-Item "product.json" "product.json.bak" -Force |
57 | | - |
58 | | - # Check if jq is available |
59 | | - $jqPath = Get-Command jq -ErrorAction SilentlyContinue |
60 | | - |
61 | | - if ($jqPath) { |
62 | | - # Merge using jq |
63 | | - $mergedJson = & jq -s '.[0] * .[1]' "product.json" $ProductJsonPath |
64 | | - $mergedJson | Out-File -FilePath "product.json" -Encoding utf8 -Force |
65 | | - Write-Host "✅ Product.json merged successfully" -ForegroundColor Green |
66 | | - } else { |
67 | | - # If jq is not available, just replace |
68 | | - Copy-Item $ProductJsonPath "product.json" -Force |
69 | | - Write-Host "✅ Product.json replaced (jq not available for merge)" -ForegroundColor Green |
70 | | - } |
71 | | - } else { |
72 | | - Copy-Item $ProductJsonPath "product.json" -Force |
73 | | - Write-Host "✅ Product.json copied" -ForegroundColor Green |
74 | | - } |
75 | | -} |
76 | | - |
77 | | -# Step 3: Replace icons and assets |
78 | | -Write-Host "🖼️ Step 3: Replacing icons and assets..." -ForegroundColor Yellow |
79 | | -Set-Location $VscodiumDir |
80 | | - |
81 | | -$StableResourcesDir = "src\stable\resources" |
82 | | -if (Test-Path $StableResourcesDir) { |
83 | | - Write-Host "Copying icons to $StableResourcesDir..." |
84 | | - |
85 | | - # Windows |
86 | | - $windowsIcon = Join-Path $BrandingDir "code.ico" |
87 | | - if (Test-Path $windowsIcon) { |
88 | | - $win32Dir = Join-Path $StableResourcesDir "win32" |
89 | | - New-Item -ItemType Directory -Force -Path $win32Dir | Out-Null |
90 | | - Copy-Item $windowsIcon (Join-Path $win32Dir "code.ico") -Force |
91 | | - Write-Host " ✅ Windows icon copied" -ForegroundColor Green |
92 | | - } |
93 | | - |
94 | | - # macOS |
95 | | - $macosIcon = Join-Path $BrandingDir "code.icns" |
96 | | - if (Test-Path $macosIcon) { |
97 | | - $darwinDir = Join-Path $StableResourcesDir "darwin" |
98 | | - New-Item -ItemType Directory -Force -Path $darwinDir | Out-Null |
99 | | - Copy-Item $macosIcon (Join-Path $darwinDir "code.icns") -Force |
100 | | - Write-Host " ✅ macOS icon copied" -ForegroundColor Green |
101 | | - } |
102 | | - |
103 | | - # Linux |
104 | | - $linuxIcon = Join-Path $BrandingDir "code.png" |
105 | | - if (Test-Path $linuxIcon) { |
106 | | - $linuxDir = Join-Path $StableResourcesDir "linux" |
107 | | - New-Item -ItemType Directory -Force -Path $linuxDir | Out-Null |
108 | | - Copy-Item $linuxIcon (Join-Path $linuxDir "code.png") -Force |
109 | | - Write-Host " ✅ Linux icon copied" -ForegroundColor Green |
110 | | - } |
111 | | - |
112 | | - # SVG |
113 | | - $svgIcon = Join-Path $BrandingDir "code.svg" |
114 | | - if (Test-Path $svgIcon) { |
115 | | - Copy-Item $svgIcon (Join-Path $StableResourcesDir "code.svg") -Force |
116 | | - Write-Host " ✅ SVG icon copied" -ForegroundColor Green |
117 | | - } |
| 24 | + Write-Host " ✅ Source already exists, skipping fetch." -ForegroundColor Green |
118 | 25 | } |
119 | 26 |
|
120 | | -# Step 4: Run compliance check |
121 | | -Write-Host "🔍 Step 4: Running compliance check..." -ForegroundColor Yellow |
122 | | -Set-Location $RepoRoot |
| 27 | +# Step 3: Enforce Source Code Branding |
| 28 | +Write-Host "" |
| 29 | +Write-Host "🔍 Step 3: Enforcing brand references in source code..." -ForegroundColor Cyan |
| 30 | +& bash (Join-Path $CiDir "enforce-branding.sh") |
123 | 31 |
|
124 | | -$complianceScript = Join-Path "ci" "compliance-check.ps1" |
125 | | -if (Test-Path $complianceScript) { |
126 | | - & $complianceScript |
127 | | -} else { |
128 | | - Write-Host "⚠️ Compliance check script not found, skipping..." -ForegroundColor Yellow |
129 | | -} |
| 32 | +# Step 4: Run Compliance Check |
| 33 | +Write-Host "" |
| 34 | +Write-Host "✅ Step 4: Running compliance verification..." -ForegroundColor Yellow |
| 35 | +& powershell (Join-Path $CiDir "compliance-check.ps1") |
130 | 36 |
|
131 | 37 | Write-Host "" |
132 | | -Write-Host "✨ Codesphere rebrand pipeline completed successfully!" -ForegroundColor Green |
| 38 | +Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Green |
| 39 | +Write-Host "✨ Codesphere branding pipeline completed successfully!" -ForegroundColor Green |
| 40 | +Write-Host "" |
| 41 | +Write-Host "Next Build Steps:" |
| 42 | +Write-Host " 1. cd vendor\vscodium" |
| 43 | +Write-Host " 2. bash build.sh (or run yarn gulp in the vscode directory)" |
133 | 44 | Write-Host "" |
134 | | -Write-Host "Next steps:" |
135 | | -Write-Host " 1. Review the changes in vendor\vscodium\vscode\" |
136 | | -Write-Host " 2. Run the build: cd vendor\vscodium && bash build.sh" |
137 | | -Write-Host " 3. Test the built application" |
0 commit comments