Update Windows build guide for Git Bash users

Git Bash Optimizations:
- Create add-defender-exclusions.ps1 automated script
- Update guide with Git Bash-first instructions
- Add command for running PowerShell from Git Bash
- Document how to run Git Bash as Administrator

New Helper Script:
- scripts/add-defender-exclusions.ps1
- Automatically adds all necessary Defender exclusions
- Shows clear success/failure messages
- Can be run from Git Bash using powershell.exe

Documentation Updates:
- Prioritize Git Bash commands (Jake's workflow)
- Add "Quick Start for Git Bash Users" section
- Provide step-by-step Git Bash instructions
- Keep PowerShell/CMD options as alternatives

For Jake:
```bash
# From Git Bash as Administrator:
powershell.exe -ExecutionPolicy Bypass -File ./scripts/add-defender-exclusions.ps1
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-23 20:55:47 -05:00
parent 9dc946b7c0
commit 1da9317d73
2 changed files with 138 additions and 16 deletions

View File

@ -10,11 +10,14 @@ If you're experiencing very slow build times on Windows, follow these steps to d
We've updated the build scripts with performance optimizations:
```powershell
# PowerShell (Recommended)
```bash
# Git Bash (Most Windows users)
./scripts/build.sh
# PowerShell
.\scripts\build.ps1
# Or Command Prompt
# Command Prompt
.\scripts\build.bat
```
@ -29,7 +32,21 @@ We've updated the build scripts with performance optimizations:
Windows Defender scans every intermediate `.o` file during compilation, adding 2-5 minutes to build time.
#### Add These Exclusions:
#### Automated Script (Easiest - For Git Bash Users):
**From Git Bash (Run as Administrator):**
```bash
# Run the automated exclusion script
powershell.exe -ExecutionPolicy Bypass -File ./scripts/add-defender-exclusions.ps1
```
**To run Git Bash as Administrator:**
1. Search for "Git Bash" in Start Menu
2. Right-click → "Run as administrator"
3. Navigate to your VideoTools directory
4. Run the command above
#### Manual Method (GUI):
1. **Open Windows Security**
- Press `Win + I` → Update & Security → Windows Security → Virus & threat protection
@ -40,18 +57,17 @@ Windows Defender scans every intermediate `.o` file during compilation, adding 2
- `C:\Users\YourName\Projects\VideoTools` - Your project directory
- `C:\msys64` - MinGW toolchain (if using MSYS2)
#### PowerShell Command (Run as Administrator):
#### PowerShell Method (If Not Using Git Bash):
Run PowerShell as Administrator:
```powershell
# Add Go build cache
# Run the automated script
.\scripts\add-defender-exclusions.ps1
# Or add manually:
Add-MpPreference -ExclusionPath "$env:LOCALAPPDATA\go-build"
# Add Go module cache
Add-MpPreference -ExclusionPath "$env:USERPROFILE\go"
# Add project directory (adjust path as needed)
Add-MpPreference -ExclusionPath "C:\Users\$env:USERNAME\Projects\VideoTools"
# Add MinGW if using MSYS2
Add-MpPreference -ExclusionPath "C:\msys64"
```
@ -204,10 +220,33 @@ If you're still experiencing slow builds after following this guide:
- Windows version
- Antivirus software in use
## Summary: What Jake Should Do
## Summary: Quick Start for Git Bash Users
1. ✅ **Add Windows Defender exclusions** (saves 2-5 minutes)
2. ✅ **Use updated build scripts** (saves 30-60 seconds)
3. ✅ **Don't use `-Clean` flag** (saves 1-2 minutes on incremental builds)
**If you're using Git Bash on Windows (most users), do this:**
1. **Open Git Bash as Administrator**
- Right-click Git Bash → "Run as administrator"
2. **Navigate to VideoTools:**
```bash
cd ~/Projects/VideoTools # or wherever your project is
```
3. **Add Defender exclusions (ONE TIME ONLY):**
```bash
powershell.exe -ExecutionPolicy Bypass -File ./scripts/add-defender-exclusions.ps1
```
4. **Close and reopen Git Bash (normal, not admin)**
5. **Build with optimized script:**
```bash
./scripts/build.sh
```
**Expected result:** 5+ minutes → 30-90 seconds
### What Each Step Does:
1. ✅ **Add Windows Defender exclusions** (saves 2-5 minutes) - Most important!
2. ✅ **Use optimized build scripts** (saves 30-60 seconds) - Parallel compilation
3. ✅ **Avoid clean builds** (saves 1-2 minutes) - Uses Go's build cache

View File

@ -0,0 +1,83 @@
# Add Windows Defender Exclusions for VideoTools Build Performance
# This script adds build directories to Windows Defender exclusions
# Saves 2-5 minutes on build times!
# Check if running as Administrator
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Host "❌ ERROR: This script must be run as Administrator!" -ForegroundColor Red
Write-Host ""
Write-Host "To run as Administrator:" -ForegroundColor Yellow
Write-Host " 1. Right-click PowerShell" -ForegroundColor White
Write-Host " 2. Select 'Run as Administrator'" -ForegroundColor White
Write-Host " 3. Navigate to this directory" -ForegroundColor White
Write-Host " 4. Run: .\scripts\add-defender-exclusions.ps1" -ForegroundColor White
Write-Host ""
Write-Host "Or from Git Bash (as Administrator):" -ForegroundColor Yellow
Write-Host " powershell.exe -ExecutionPolicy Bypass -File ./scripts/add-defender-exclusions.ps1" -ForegroundColor White
exit 1
}
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host " Adding Windows Defender Exclusions for VideoTools" -ForegroundColor Cyan
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host ""
# Get paths
$goBuildCache = "$env:LOCALAPPDATA\go-build"
$goModCache = "$env:USERPROFILE\go"
$projectDir = Split-Path -Parent $PSScriptRoot
$msys64 = "C:\msys64"
Write-Host "Adding exclusions..." -ForegroundColor Yellow
Write-Host ""
# Add Go build cache
try {
Add-MpPreference -ExclusionPath $goBuildCache -ErrorAction Stop
Write-Host "✓ Added: $goBuildCache" -ForegroundColor Green
} catch {
Write-Host "⚠ Already excluded or failed: $goBuildCache" -ForegroundColor Yellow
}
# Add Go module cache
try {
Add-MpPreference -ExclusionPath $goModCache -ErrorAction Stop
Write-Host "✓ Added: $goModCache" -ForegroundColor Green
} catch {
Write-Host "⚠ Already excluded or failed: $goModCache" -ForegroundColor Yellow
}
# Add project directory
try {
Add-MpPreference -ExclusionPath $projectDir -ErrorAction Stop
Write-Host "✓ Added: $projectDir" -ForegroundColor Green
} catch {
Write-Host "⚠ Already excluded or failed: $projectDir" -ForegroundColor Yellow
}
# Add MSYS2 if it exists
if (Test-Path $msys64) {
try {
Add-MpPreference -ExclusionPath $msys64 -ErrorAction Stop
Write-Host "✓ Added: $msys64" -ForegroundColor Green
} catch {
Write-Host "⚠ Already excluded or failed: $msys64" -ForegroundColor Yellow
}
} else {
Write-Host "⊘ Skipped: $msys64 (not found)" -ForegroundColor Gray
}
Write-Host ""
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host "✅ EXCLUSIONS ADDED" -ForegroundColor Green
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
Write-Host ""
Write-Host "Expected build time improvement: 5+ minutes → 30-90 seconds" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host " 1. Close and reopen your terminal" -ForegroundColor White
Write-Host " 2. Run: ./scripts/build.ps1 (PowerShell) or ./scripts/build.bat" -ForegroundColor White
Write-Host " 3. Or from Git Bash: ./scripts/build.sh" -ForegroundColor White
Write-Host ""