Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions Build/Agent/Setup-InstallerBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,35 @@ if ($toolchain) {
Write-Host "`n--- Checking Helper Repositories ---" -ForegroundColor Yellow

$helperRepos = @(
@{ Name = "FwHelps"; Path = "DistFiles/Helps"; Required = $true },
@{ Name = "FwLocalizations"; Path = "Localizations"; Required = $true },
@{ Name = "liblcm"; Path = "Localizations/LCMRepo"; Required = $true }
@{ Name = "FwHelps"; Path = "DistFiles/Helps" },
@{ Name = "FwLocalizations"; Path = "Localizations" },
@{ Name = "genericinstaller"; Path = "PatchableInstaller" },
@{ Name = "liblcm"; Path = "Localizations/LCMRepo" }
)

$missingRepos = @()
foreach ($repo in $helperRepos) {
$fullPath = Join-Path $repoRoot $repo.Path
if ($repo.Name -eq 'liblcm' -and $env:LcmRootDir) {
$fullPath = $env:LcmRootDir
$displayPath = $fullPath
} else {
$fullPath = Join-Path $repoRoot $repo.Path
$displayPath = $repo.Path
}

$gitPath = Join-Path $fullPath ".git"
$isJunction = (Test-Path $fullPath) -and ((Get-Item $fullPath -Force -ErrorAction SilentlyContinue).Attributes -band [IO.FileAttributes]::ReparsePoint)

if ((Test-Path $gitPath) -or $isJunction) {
$status = if ($isJunction) { "junction" } else { "git repo" }
Write-Host "[OK] $($repo.Name): $($repo.Path) ($status)" -ForegroundColor Green
Write-Host "[OK] $($repo.Name): $displayPath ($status)" -ForegroundColor Green
} else {
Write-Host "[MISSING] $($repo.Name): $($repo.Path)" -ForegroundColor Red
Write-Host "[MISSING] $($repo.Name): $displayPath" -ForegroundColor Red
$missingRepos += $repo
if ($repo.Required) {
$issues += "Missing helper repository: $($repo.Name)"
if ($repo.Name -eq 'liblcm') {
$issues += "Missing helper repository: $($repo.Name) (expected at LcmRootDir='$env:LcmRootDir' or $($repo.Path))"
} else {
$issues += "Missing helper repository: $($repo.Name) (expected at $($repo.Path))"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Build/Localize.targets
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ListsDirectory>$(L10nsBaseDir)/lists</ListsDirectory>
<GoldEticDir>$(ListsDirectory)/GramCats</GoldEticDir>
<MessagesPot>$(L10nsBaseDir)/messages.pot</MessagesPot>
<LcmRootDir Condition="'$(LcmRootDir)'==''">$(L10nsBaseDir)/LCMRepo</LcmRootDir>
<LcmSrcDir>$(LcmRootDir)/src</LcmSrcDir>
<WarnForMissingDD Condition="'$(DownloadsDir)'==''">true</WarnForMissingDD>
<DownloadsDir>$(fwrt)/Downloads</DownloadsDir><!-- TODO (Hasso) 2026.02: figure out why this isn't getting set elsewhere -->
Expand Down
91 changes: 47 additions & 44 deletions Setup-Developer-Machine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,35 +202,44 @@ if ($InstallerDeps) {
}
}

# Special case: liblcm goes inside Localizations
$lcmTarget = Join-Path $scriptDir "Localizations/LCMRepo"
# Special case: liblcm is found via the LcmRootDir environment variable
$localizationsPath = Join-Path $scriptDir "Localizations"
if ((Test-Path $localizationsPath) -and -not (Test-Path $lcmTarget)) {
if ($isWorktree) {
$sharedLcm = Join-Path $repoRoot "liblcm"
if (-not (Test-Path $sharedLcm)) {
if ($PSCmdlet.ShouldProcess("liblcm", "Clone to $sharedLcm")) {
Write-Host "Cloning liblcm to shared location..." -ForegroundColor Cyan
git clone https://github.com/sillsdev/liblcm.git $sharedLcm 2>&1 | Out-Null
}
}
if (Test-Path $sharedLcm) {
if ($PSCmdlet.ShouldProcess("Localizations/LCMRepo", "Create junction to $sharedLcm")) {
New-Item -ItemType Junction -Path $lcmTarget -Target $sharedLcm -Force | Out-Null
Write-Host "[OK] Created junction: Localizations/LCMRepo -> $sharedLcm" -ForegroundColor Green
}
}
$lcmTarget = Join-Path $localizationsPath "LCMRepo"
if ($env:LcmRootDir -and (Test-Path (Join-Path $env:LcmRootDir ".git"))) {
Write-Host "[OK] liblcm already exists at $env:LcmRootDir" -ForegroundColor Green
} elseif (Test-Path $lcmTarget) {
$env:LcmRootDir = $lcmTarget
Write-Host "[OK] Localizations/LCMRepo already exists" -ForegroundColor Green
} elseif ($isWorktree) {
$sharedLcm = Join-Path $repoRoot "liblcm"
if ((Test-Path $sharedLcm)) {
$env:LcmRootDir = $sharedLcm
Write-Host "[OK] liblcm already exists at $sharedLcm" -ForegroundColor Green
} else {
if ($PSCmdlet.ShouldProcess("liblcm", "Clone to $lcmTarget")) {
Write-Host "Cloning liblcm..." -ForegroundColor Cyan
git clone https://github.com/sillsdev/liblcm.git $lcmTarget 2>&1 | Out-Null
if ($PSCmdlet.ShouldProcess("liblcm", "Clone to $sharedLcm")) {
Write-Host "Cloning liblcm to shared location..." -ForegroundColor Cyan
git clone https://github.com/sillsdev/liblcm.git $sharedLcm 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) {
Write-Host "[OK] Cloned liblcm to $lcmTarget" -ForegroundColor Green
$env:LcmRootDir = $sharedLcm
Write-Host "[OK] Cloned liblcm to $sharedLcm" -ForegroundColor Green
} else {
Write-Host "[ERROR] Failed to clone liblcm" -ForegroundColor Red
}
}
}
} elseif (Test-Path $lcmTarget) {
Write-Host "[OK] Localizations/LCMRepo already exists" -ForegroundColor Green
} elseif ((Test-Path $localizationsPath)) {
if ($PSCmdlet.ShouldProcess("LCMRepo", "Clone to $lcmTarget")) {
Write-Host "Cloning liblcm..." -ForegroundColor Cyan
git clone https://github.com/sillsdev/liblcm.git $lcmTarget 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) {
$env:LcmRootDir = $lcmTarget
Write-Host "[OK] Cloned liblcm to $lcmTarget" -ForegroundColor Green
} else {
Write-Host "[ERROR] Failed to clone liblcm" -ForegroundColor Red
}
}
} else {
Write-Host "[ERROR] Failed to clone liblcm because Localizations does not exist" -ForegroundColor Red
}
}

Expand Down Expand Up @@ -272,41 +281,35 @@ if ($PSCmdlet.ShouldProcess("$pathScope PATH", "Save changes")) {
$env:PATH = "$env:PATH;$($pathsToAdd -join ';')"
}

# Refresh PATH for this session
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [Environment]::GetEnvironmentVariable('PATH', 'User')

#endregion

#region Environment Variables

Write-Host "`n--- Configuring Environment Variables ---" -ForegroundColor Yellow

Write-Host "[INFO] WIX env var is not required for WiX v6 SDK builds" -ForegroundColor Gray

#endregion

#region Verification

Write-Host "`n--- Verification ---" -ForegroundColor Yellow

# Refresh PATH for this session
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [Environment]::GetEnvironmentVariable('PATH', 'User')

$allGood = $true
if ($env:LcmRootDir -and (Test-Path (Join-Path $env:LcmRootDir ".git")) -and
$PSCmdlet.ShouldProcess('LcmRootDir', 'Set LcmRootDir for the current user')) {
[Environment]::SetEnvironmentVariable('LcmRootDir', $env:LcmRootDir, 'User')
}

# WiX (v6) is acquired via NuGet restore; no PATH verification needed.
Write-Host "[OK] WiX v6: acquired via NuGet restore during build" -ForegroundColor Green
if ($PSCmdlet.ShouldProcess('FEEDBACK', 'Turn off production analytics for SIL software')) {
[Environment]::SetEnvironmentVariable('FEEDBACK', 'off', $pathScope)
}

#endregion

Write-Host "`n========================================" -ForegroundColor Cyan
if ($allGood) {
Write-Host " Setup Complete!" -ForegroundColor Green
} else {
Write-Host " Setup Complete (restart terminal for PATH changes)" -ForegroundColor Yellow
}
Write-Host " Setup Complete!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor White
Write-Host " 1. Restart VS Code (or your terminal) for PATH changes to take effect"
Write-Host " 1. Restart your IDE and your terminal (not necessary for this terminal) for PATH and environment changes to take effect"
Write-Host " 2. Build: .\build.ps1"
Write-Host ""
Write-Host "Before building installers, run: .\Setup-Developer-Machine.ps1 -InstallerDeps" -ForegroundColor Gray
if (-not $InstallerDeps) {
Write-Host "Before building installers, run: .\Setup-Developer-Machine.ps1 -InstallerDeps" -ForegroundColor Gray
}
Write-Host "For Serena MCP support, see Docs/mcp.md" -ForegroundColor Gray
Loading