Skip to content

Commit 20ddb7b

Browse files
author
Codesphere Developer
committed
docs: Add Build Guide and consolidate branding orchestration
- Create docs/BUILD_GUIDE.md for detailed platform instructions - Refactor patch-branding.sh/ps1 into master orchestration scripts - Modularize ci-branding.sh and enforce-branding.sh
1 parent 0e56362 commit 20ddb7b

File tree

4 files changed

+178
-242
lines changed

4 files changed

+178
-242
lines changed

ci/ci-branding.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,7 @@ if [ -f "$VSCODIUM_DIR/prepare_vscode.sh" ]; then
7575
echo " ✅ prepare_vscode.sh patched"
7676
fi
7777

78-
# Step 3: Brand Enforcement (Source Code Replacements)
79-
# This will be run AFTER get_repo.sh but we can prepare the script or patch
80-
# Since get_repo.sh hasn't run yet in the CI flow (it runs in a separate step),
81-
# we will add a hook that can be called later or just perform replacements
82-
# if the directory exists.
83-
if [ -d "vscode" ]; then
84-
echo "🔍 Enforcing brand references in source code..."
85-
cd vscode
86-
# Replace VSCodium with Codesphere in UI strings, but avoid breaking URLs
87-
# This is a basic set of replacements; more can be added
88-
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.html" -o -name "*.json" \) -not -path "*/node_modules/*" -exec perl -pi -e 's/(?<!github.com\/)VSCodium/Codesphere/g' {} +
89-
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.html" -o -name "*.json" \) -not -path "*/node_modules/*" -exec perl -pi -e 's/(?<!github.com\/)vscodium/codesphere/g' {} +
90-
echo " ✅ Source code branding enforced"
91-
cd ..
92-
fi
93-
94-
# Patch build_cli.sh to handle macOS app renaming
78+
# Step 3: Patch build_cli.sh to handle macOS app renaming
9579
if [ -f "$VSCODIUM_DIR/build_cli.sh" ]; then
9680
echo "🔧 Patching build_cli.sh for macOS app naming..."
9781
perl -pi -e 'print " if [ -d \"../../VSCode-darwin-\${VSCODE_ARCH}/VSCodium.app\" ] && [ ! -d \"../../VSCode-darwin-\${VSCODE_ARCH}/\${NAME_SHORT}.app\" ]; then mv \"../../VSCode-darwin-\${VSCODE_ARCH}/VSCodium.app\" \"../../VSCode-darwin-\${VSCODE_ARCH}/\${NAME_SHORT}.app\"; fi\n" if /cp "target\/\${VSCODE_CLI_TARGET}\/release\/code"/' "$VSCODIUM_DIR/build_cli.sh"

ci/patch-branding.ps1

Lines changed: 27 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,44 @@
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.
33

44
$ErrorActionPreference = "Stop"
55

6-
Write-Host "🚀 Starting Codesphere rebrand pipeline..." -ForegroundColor Green
7-
8-
# Define paths
96
$RepoRoot = Split-Path -Parent $PSScriptRoot
7+
$CiDir = Join-Path $RepoRoot "ci"
108
$VscodiumDir = Join-Path $RepoRoot "vendor\vscodium"
11-
$BrandingDir = Join-Path $RepoRoot "branding"
12-
$VscodeDir = Join-Path $VscodiumDir "vscode"
139

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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
2612

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")
3216

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
3520
Set-Location $VscodiumDir
36-
3721
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
4323
} 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
11825
}
11926

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")
12331

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")
13036

13137
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)"
13344
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"

ci/patch-branding.sh

Lines changed: 27 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,45 @@
11
#!/usr/bin/env bash
2-
# Codesphere Unified Branding Script (Linux/macOS)
3-
# This script orchestrates the complete rebranding pipeline
2+
# Codesphere Master Local Branding Script
3+
# This script orchestrates the complete rebranding pipeline for local development.
44

55
set -e
66

7-
echo "🚀 Starting Codesphere rebrand pipeline..."
8-
9-
# Define paths
107
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8+
CI_DIR="$REPO_ROOT/ci"
119
VSCODIUM_DIR="$REPO_ROOT/vendor/vscodium"
12-
BRANDING_DIR="$REPO_ROOT/branding"
13-
VSCODE_DIR="$VSCODIUM_DIR/vscode"
1410

15-
# Export environment variables for VSCodium build
16-
export APP_NAME="Codesphere"
17-
export APP_NAME_LC="codesphere"
18-
export BINARY_NAME="codesphere"
19-
export GH_REPO_PATH="Codesphere/codesphere"
20-
export ORG_NAME="Codesphere"
21-
export ASSETS_REPOSITORY="Codesphere/codesphere"
22-
export VSCODE_QUALITY="stable"
23-
export SHOULD_BUILD="yes"
24-
export SHOULD_BUILD_REH="no"
25-
export CI_BUILD="no"
26-
export DISABLE_UPDATE="no"
11+
echo "🚀 Starting Codesphere Master Branding Pipeline..."
12+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
2713

28-
echo "📦 Environment configured:"
29-
echo " APP_NAME: $APP_NAME"
30-
echo " BINARY_NAME: $BINARY_NAME"
31-
echo " VSCODE_QUALITY: $VSCODE_QUALITY"
32-
echo ""
14+
# Step 1: Prepare Branding & Patch Build Scripts
15+
echo "🎨 Step 1: Preparing branding environment..."
16+
"$CI_DIR/ci-branding.sh"
3317

34-
# Step 1: Fetch upstream VS Code
35-
echo "📥 Step 1: Fetching upstream VS Code..."
18+
# Step 2: Fetch VSCodium Source (if not already fetched)
19+
echo ""
20+
echo "📥 Step 2: Fetching VSCodium/VS Code Source..."
3621
cd "$VSCODIUM_DIR" || exit 1
37-
3822
if [ ! -d "vscode" ]; then
39-
echo "Running prepare_vscode.sh to fetch VS Code source..."
40-
./prepare_vscode.sh
23+
./get_repo.sh
4124
else
42-
echo "VS Code source already exists. Skipping fetch."
25+
echo " ✅ Source already exists, skipping fetch."
4326
fi
4427

45-
# Step 2: Apply Codesphere product.json
46-
echo "🎨 Step 2: Applying Codesphere product.json..."
47-
if [ -f "$BRANDING_DIR/product.json" ]; then
48-
# Merge our branding with the existing product.json
49-
cd "$VSCODE_DIR" || exit 1
50-
51-
if [ -f "product.json" ]; then
52-
# Backup original
53-
cp product.json product.json.bak
54-
55-
# Merge using jq
56-
if command -v jq &> /dev/null; then
57-
jq -s '.[0] * .[1]' product.json "$BRANDING_DIR/product.json" > product.json.tmp
58-
mv product.json.tmp product.json
59-
echo "✅ Product.json merged successfully"
60-
else
61-
# If jq is not available, just replace
62-
cp "$BRANDING_DIR/product.json" product.json
63-
echo "✅ Product.json replaced (jq not available for merge)"
64-
fi
65-
else
66-
cp "$BRANDING_DIR/product.json" product.json
67-
echo "✅ Product.json copied"
68-
fi
69-
fi
70-
71-
# Step 3: Replace icons and assets
72-
echo "🖼️ Step 3: Replacing icons and assets..."
73-
cd "$VSCODIUM_DIR" || exit 1
74-
75-
# Copy icons to the stable source directory
76-
if [ -d "src/stable/resources" ]; then
77-
echo "Copying icons to src/stable/resources..."
78-
79-
# Windows
80-
if [ -f "$BRANDING_DIR/code.ico" ]; then
81-
mkdir -p src/stable/resources/win32
82-
cp "$BRANDING_DIR/code.ico" src/stable/resources/win32/code.ico
83-
echo " ✅ Windows icon copied"
84-
fi
85-
86-
# macOS
87-
if [ -f "$BRANDING_DIR/code.icns" ]; then
88-
mkdir -p src/stable/resources/darwin
89-
cp "$BRANDING_DIR/code.icns" src/stable/resources/darwin/code.icns
90-
echo " ✅ macOS icon copied"
91-
fi
92-
93-
# Linux
94-
if [ -f "$BRANDING_DIR/code.png" ]; then
95-
mkdir -p src/stable/resources/linux
96-
cp "$BRANDING_DIR/code.png" src/stable/resources/linux/code.png
97-
echo " ✅ Linux icon copied"
98-
fi
99-
100-
# SVG
101-
if [ -f "$BRANDING_DIR/code.svg" ]; then
102-
cp "$BRANDING_DIR/code.svg" src/stable/resources/code.svg
103-
echo " ✅ SVG icon copied"
104-
fi
105-
fi
106-
107-
# Step 4: Run compliance check
108-
echo "🔍 Step 4: Running compliance check..."
109-
cd "$REPO_ROOT" || exit 1
28+
# Step 3: Enforce Source Code Branding
29+
echo ""
30+
echo "🔍 Step 3: Enforcing brand references in source code..."
31+
"$CI_DIR/enforce-branding.sh"
11032

111-
if [ -f "ci/compliance-check.sh" ]; then
112-
./ci/compliance-check.sh
113-
else
114-
echo "⚠️ Compliance check script not found, skipping..."
115-
fi
33+
# Step 4: Run Compliance Check
34+
echo ""
35+
echo "✅ Step 4: Running compliance verification..."
36+
"$CI_DIR/compliance-check.sh"
11637

11738
echo ""
118-
echo "✨ Codesphere rebrand pipeline completed successfully!"
39+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
40+
echo "✨ Codesphere branding pipeline completed successfully!"
41+
echo ""
42+
echo "Next Build Steps:"
43+
echo " 1. cd vendor/vscodium"
44+
echo " 2. ./build.sh (or run yarn gulp in the vscode directory)"
11945
echo ""
120-
echo "Next steps:"
121-
echo " 1. Review the changes in vendor/vscodium/vscode/"
122-
echo " 2. Run the build: cd vendor/vscodium && ./build.sh"
123-
echo " 3. Test the built application"

0 commit comments

Comments
 (0)