Skip to content

Commit ca0a979

Browse files
authored
LT-22432: Update CD workflows to use build.ps1 (#705)
* Pass MSBuild arguments through to installer builds * Add -BuildPatch option for building patch installers * Remove WriteNonLocalDevelopmentPropertiesFile; this has long been unnecessary. * Check for .NET 4.8 before building CD workflows * Check for logs in the root directory * Add WiX to the PATH at the beginning of build.ps1 * Revert a change to CustomComponents.wxi Also * Force all Installer builds to be Release builds * Pass logging variables to installer builds * Remove unused Target BuildInstallerWix3 * Organize ReadMe and fix a dead link * Fix whitespace in Setup-Developer-Machine.ps1 * Clarify Setup-Developer-Machine.ps1 * change Base build offset to 1000: 1000 makes easier mental math than 1100, and we've burned 100 build numbers since our last release, so now is the time to reduce it. FUTURE WORK (see LT-22446:) * Prevent log file collisions from -LogPath and /bl * Prevent redundant builds
1 parent ebfa1ed commit ca0a979

30 files changed

Lines changed: 2559 additions & 282 deletions

.github/workflows/base-installer-cd.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Compute build number
5656
id: build_number
5757
run: |
58-
$lastJenkins = 1100 # The last base build from jenkins, rounded to the next hundred
58+
$lastJenkins = 1000 # The last base build from jenkins, rounded to the nearest thousand
5959
$githubRun = $env:GITHUB_RUN_NUMBER
6060
$combined = $lastJenkins + $githubRun
6161
echo "Calculated build number: $combined"
@@ -103,17 +103,35 @@ jobs:
103103
fetch-depth: 0
104104
path: 'Localizations/LCM'
105105

106-
- name: Download .NET 461 targeting pack
107-
uses: suisei-cn/actions-download-file@9f75b8c2dad5ccced7509c44a3b881c5613abde2 # 1.6.1
108-
id: downloadfile # Remember to give an ID if you need the output filename
109-
with:
110-
url: "https://download.microsoft.com/download/F/1/D/F1DEB8DB-D277-4EF9-9F48-3A65D4D8F965/NDP461-DevPack-KB3105179-ENU.exe"
111-
target: public/
106+
- name: Ensure .NET Framework 4.8 targeting pack
107+
shell: pwsh
108+
run: |
109+
# Check registry Release key for .NET Framework 4.8 (Release >= 528040 indicates 4.8)
110+
$targetRelease = 528040
111+
try {
112+
$releaseKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -Name Release -ErrorAction Stop).Release
113+
} catch {
114+
$releaseKey = $null
115+
}
112116
113-
- name: Install .NET 461 targeting pack
114-
shell: cmd
115-
working-directory: public
116-
run: NDP461-DevPack-KB3105179-ENU.exe /q
117+
if (-not $releaseKey -or $releaseKey -lt $targetRelease) {
118+
Write-Host "Detected .NET release $releaseKey. Installing .NET Framework 4.8 Developer Pack..."
119+
$installerUrl = "https://download.microsoft.com/download/9/5/0/9500E0A8-3C76-45F9-8D4B-8D2A7F2C1A3A/NDP48-DevPack-KB4486153-ENU.exe"
120+
$installer = Join-Path $env:RUNNER_TEMP "NDP48-DevPack-KB4486153-ENU.exe"
121+
122+
Invoke-WebRequest -Uri $installerUrl -OutFile $installer -UseBasicParsing -TimeoutSec 120
123+
124+
Write-Host "Starting installer..."
125+
$proc = Start-Process -FilePath $installer -ArgumentList "/quiet","/norestart" -Wait -PassThru
126+
if ($proc.ExitCode -ne 0) {
127+
Write-Error "Failed to install .NET 4.8 Developer Pack. ExitCode: $($proc.ExitCode)"
128+
exit $proc.ExitCode
129+
}
130+
Write-Host ".NET 4.8 Developer Pack installation finished."
131+
}
132+
else {
133+
Write-Host ".NET Framework 4.8 (Release=$releaseKey) already present. Skipping install."
134+
}
117135
118136
- name: Setup dotnet
119137
uses: actions/setup-dotnet@v4
@@ -134,24 +152,14 @@ jobs:
134152
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
135153
if: github.event_name != 'pull_request'
136154

137-
- name: Prepare for build
138-
shell: cmd
139-
working-directory: Build
140-
run: build64.bat /t:WriteNonlocalDevelopmentPropertiesFile
141-
142155
- name: Build and run tests
143156
id: build_installer
144157
shell: powershell
145158
run: |
146-
cd Build
147-
.\build64.bat /t:BuildBaseInstaller "/property:config=release;action=test;desktopNotAvailable=true" /v:d /bl ^| tee-object -FilePath build.log
148-
cd ..
149-
cd BuildDir
150-
md5sum *.exe > md5.txt
159+
.\build.ps1 -BuildInstaller -Configuration Release -MsBuildArgs @("/p:action=test;desktopNotAvailable=true","/v:d","/bl") | Tee-Object -FilePath build.log
151160
152161
- name: Scan Build Output
153162
shell: powershell
154-
working-directory: Build
155163
run: |
156164
$results = Select-String -Path "build.log" -Pattern "^\s*[1-9][0-9]* Error\(s\)"
157165
if ($results) {
@@ -298,5 +306,5 @@ jobs:
298306
if-no-files-found: warn
299307
name: build-logs
300308
path: |
301-
Build/*.log
302-
Build/*.binlog
309+
*.log
310+
*.binlog

.github/workflows/patch-installer-cd.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name: Patch Installer
88

99
on:
1010
push:
11-
branches: ["main"]
11+
branches: ["main", "release/**"]
1212
schedule:
1313
# Runs every Monday at 03:30 UTC (which is 8:30pm MST/PDT Sunday evening)
1414
- cron: "30 3 * * 1"
@@ -118,17 +118,35 @@ jobs:
118118
fetch-depth: 0
119119
path: 'Localizations/LCM'
120120

121-
- name: Download .NET 461 targeting pack
122-
uses: suisei-cn/actions-download-file@9f75b8c2dad5ccced7509c44a3b881c5613abde2 # 1.6.1
123-
id: downloadfile # Remember to give an ID if you need the output filename
124-
with:
125-
url: "https://download.microsoft.com/download/F/1/D/F1DEB8DB-D277-4EF9-9F48-3A65D4D8F965/NDP461-DevPack-KB3105179-ENU.exe"
126-
target: public/
121+
- name: Ensure .NET Framework 4.8 targeting pack
122+
shell: pwsh
123+
run: |
124+
# Check registry Release key for .NET Framework 4.8 (Release >= 528040 indicates 4.8)
125+
$targetRelease = 528040
126+
try {
127+
$releaseKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -Name Release -ErrorAction Stop).Release
128+
} catch {
129+
$releaseKey = $null
130+
}
127131
128-
- name: Install .NET 461 targeting pack
129-
shell: cmd
130-
working-directory: public
131-
run: NDP461-DevPack-KB3105179-ENU.exe /q
132+
if (-not $releaseKey -or $releaseKey -lt $targetRelease) {
133+
Write-Host "Detected .NET release $releaseKey. Installing .NET Framework 4.8 Developer Pack..."
134+
$installerUrl = "https://download.microsoft.com/download/9/5/0/9500E0A8-3C76-45F9-8D4B-8D2A7F2C1A3A/NDP48-DevPack-KB4486153-ENU.exe"
135+
$installer = Join-Path $env:RUNNER_TEMP "NDP48-DevPack-KB4486153-ENU.exe"
136+
137+
Invoke-WebRequest -Uri $installerUrl -OutFile $installer -UseBasicParsing -TimeoutSec 120
138+
139+
Write-Host "Starting installer..."
140+
$proc = Start-Process -FilePath $installer -ArgumentList "/quiet","/norestart" -Wait -PassThru
141+
if ($proc.ExitCode -ne 0) {
142+
Write-Error "Failed to install .NET 4.8 Developer Pack. ExitCode: $($proc.ExitCode)"
143+
exit $proc.ExitCode
144+
}
145+
Write-Host ".NET 4.8 Developer Pack installation finished."
146+
}
147+
else {
148+
Write-Host ".NET Framework 4.8 (Release=$releaseKey) already present. Skipping install."
149+
}
132150
133151
- name: Setup dotnet
134152
uses: actions/setup-dotnet@v4
@@ -183,10 +201,8 @@ jobs:
183201
Expand-Archive -Path "base-artifacts/ProcRunner.zip" -DestinationPath $procTarget -Force
184202
Write-Host "Expanded ProcRunner.zip -> $procTarget"
185203
186-
# Write out the properties file (a first build on a system requires a prompt response otherwise)
187-
# and set an OS feature in the registry that will allow Wix v3 to use temporary files without error
204+
# Set an OS feature in the registry that will allow Wix v3 to use temporary files without error
188205
- name: Prepare for build
189-
working-directory: Build
190206
run: |
191207
# Define paths and the key/value to set
192208
$regPaths = @(
@@ -203,22 +219,16 @@ jobs:
203219
}
204220
New-ItemProperty -Path $path -Name $valueName -Value $expectedValue -Type String -Force
205221
}
206-
207-
.\build64.bat /t:WriteNonlocalDevelopmentPropertiesFile
208222
209223
- name: Build Debug and run tests
210224
id: build_installer
211225
shell: powershell
212226
run: |
213227
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\AppContext"
214-
cd Build
215-
.\build64.bat /t:BuildPatchInstaller "/property:config=release;action=test;desktopNotAvailable=true" /v:d /bl ^| tee-object -FilePath build.log
216-
cd ..
217-
cd BuildDir
228+
.\build.ps1 -BuildPatch -Configuration Release -MsBuildArgs @("/p:action=test;desktopNotAvailable=true","/v:d","/bl") | Tee-Object -FilePath build.log
218229
219230
- name: Scan Debug Build Output
220231
shell: powershell
221-
working-directory: Build
222232
run: |
223233
$results = Select-String -Path "build.log" -Pattern "^\s*[1-9][0-9]* Error\(s\)"
224234
if ($results) {
@@ -281,5 +291,5 @@ jobs:
281291
if-no-files-found: warn
282292
name: build-logs
283293
path: |
284-
Build/*.log
285-
Build/*.binlog
294+
*.log
295+
*.binlog

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ x64
5454
*.user
5555
*.ncrunchsolution
5656
*.ncb
57-
FW.sln
5857
*.suo
5958
*.o
6059
*_ReSharper*
@@ -89,6 +88,7 @@ buildi686/
8988
buildx86_64/
9089
installi686/
9190
installx86_64/
91+
msbuild.binlog
9292
test-results/
9393
trash/
9494
UpgradeLog*.XML

Build/Installer.Wix3.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
</Target>
2929

3030
<Target Name="BuildInstaller" DependsOnTargets="VerifyWix3Inputs;BuildBaseInstaller" />
31-
<Target Name="BuildInstallerWix3" DependsOnTargets="VerifyWix3Inputs;BuildBaseInstaller" />
31+
<Target Name="BuildPatch" DependsOnTargets="VerifyWix3Inputs;BuildPatchInstaller" />
3232
</Project>

Build/Installer.legacy.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
Condition="'$(Platform)' != 'x64'"
101101
/>
102102
<Error
103-
Text="Installer must be run for release builds [config=$(config)]"
104-
Condition="'$(config)' != 'release'"
103+
Text="Installer must be run for release builds [config=$(config); Configuration=$(Configuration)]"
104+
Condition="'$(config)' != 'release' or '$(Configuration)' != 'Release'"
105105
/>
106106
</Target>
107107
<!--

Build/InstallerBuild.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<PropertyGroup>
1717
<Platform Condition="'$(Platform)'==''">x64</Platform>
18-
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
18+
<Configuration Condition="'$(Configuration)'==''">Release</Configuration>
1919
<InstallerToolset Condition="'$(InstallerToolset)'==''">Wix3</InstallerToolset>
2020
</PropertyGroup>
2121

Build/Localize.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
<GoldEticDir>$(ListsDirectory)/GramCats</GoldEticDir>
3737
<MessagesPot>$(L10nsBaseDir)/messages.pot</MessagesPot>
3838
<LcmSrcDir>$(LcmRootDir)/src</LcmSrcDir>
39+
<WarnForMissingDD Condition="'$(DownloadsDir)'==''">true</WarnForMissingDD>
40+
<DownloadsDir>$(fwrt)/Downloads</DownloadsDir><!-- TODO (Hasso) 2026.02: figure out why this isn't getting set elsewhere -->
3941
<CrowdinZip>$(DownloadsDir)/Crowdin.zip</CrowdinZip>
4042
<CrowdinApiKey>$(CROWDIN_API_KEY)</CrowdinApiKey>
4143
<DisableLocalization Condition="'$(DisableLocalization)'=='' and '$(CrowdinApiKey)'==''">true</DisableLocalization>
@@ -114,6 +116,7 @@ To update localizations, liblcm must be cloned locally to the location specified
114116
DependsOnTargets="ValidateCrowdinApiKey;InstallOvercrowdin"
115117
>
116118
<ForceDelete Files="$(L10nsDirectory)" />
119+
<Warn Condition="'$(WarnForMissingDD)'=='true'" Text="WARNING: DownloadsDir was not set when $(MSBuildThisFile) was loaded"/>
117120
<MakeDir Directories="$(DownloadsDir)" />
118121
<Exec
119122
WorkingDirectory="$(fwrt)"

Build/SetupInclude.targets

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
</PropertyGroup>
1616
<PropertyGroup>
1717
<IcuVersion>70</IcuVersion>
18-
<!-- Only compute fwrt if not already set (e.g., by NativeBuild.csproj) -->
19-
<fwrt Condition="'$(fwrt)' == ''"
20-
>$([System.IO.Directory]::GetParent($(MSBuildProjectDirectory)))</fwrt
21-
>
18+
<!-- Compute fwrt only if not already set (e.g., by NativeBuild.csproj) -->
19+
<fwrt Condition="'$(fwrt)' == ''">$([System.IO.Directory]::GetParent($(MSBuildProjectDirectory)))</fwrt>
2220
<fwrt Condition="'$(fwrt)' == ''">$(MSBuildThisFileDirectory)..</fwrt>
21+
<DownloadsDir>$(fwrt)/Downloads</DownloadsDir>
2322
</PropertyGroup>
2423
<!--
2524
Configuration Synchronization:

FLExInstaller/CustomComponents.wxi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<?if $(var.BuildArch) = x64 ?>
2+
<?if $(sys.BUILDARCH) = x64 ?>
33
<?define EncodingConvertersPath = "..\..\packages\encoding-converters-core\0.9.7\runtimes\EcDistFiles\MergeModules\x64\Release" ?>
44
<?else?>
55
<?define EncodingConvertersPath = "..\..\packages\encoding-converters-core\0.9.7\runtimes\EcDistFiles\MergeModules\x86\Release" ?>
@@ -110,7 +110,7 @@
110110
</ComponentGroup>
111111

112112
<DirectoryRef Id='APPFOLDER'>
113-
<?if $(var.BuildArch) = x64 ?>
113+
<?if $(sys.BUILDARCH) = x64 ?>
114114
<Merge Id="CC_DLL" Language="1033" SourceFile="$(var.EncodingConvertersPath)\CcDLLs64bitMM.msm" DiskId="1"/>
115115
<Merge Id="EncConverters_Common" Language="1033" SourceFile="$(var.EncodingConvertersPath)\EC_40_64bit_MM.msm" DiskId="1"/>
116116
<Merge Id="PerlEC" Language="1033" SourceFile="$(var.EncodingConvertersPath)\PerlEc64bitMM.msm" DiskId="1"/>

ReadMe.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,30 @@ New to FieldWorks development? Start here:
1313

1414
For first-time setup on a Windows development machine:
1515

16+
- Install required software:
17+
- Visual Studio 2022 with .NET desktop and C++ desktop workloads
18+
- Git for Windows
19+
- Run the setup script:
1620
```powershell
1721
# Run as Administrator (or User for user-level PATH)
1822
.\Setup-Developer-Machine.ps1
1923
```
2024

21-
This configures a dev machine for builds and tests (verifies prerequisites and configures PATH). Prerequisites:
22-
- Visual Studio 2022 with .NET desktop and C++ desktop workloads
23-
- Git for Windows
25+
This configures a dev machine for builds and tests (verifies prerequisites and configures PATH).
26+
27+
## Building FieldWorks
28+
29+
FieldWorks uses the **MSBuild Traversal SDK** for declarative, dependency-ordered builds:
30+
31+
**Windows (PowerShell):**
32+
```powershell
33+
.\build.ps1 # Debug build
34+
.\build.ps1 -Configuration Release
35+
```
36+
37+
For detailed build instructions, see [.github/instructions/build.instructions.md](.github/instructions/build.instructions.md).
38+
39+
## Building Installers (WiX 3 default, WiX 6 opt-in)
2440

2541
Installer builds default to **WiX 3** (legacy batch pipeline) using inputs in `FLExInstaller/` and `PatchableInstaller/`. The **Visual Studio WiX Toolset v3 extension** is required so `Wix.CA.targets` is available under the MSBuild extensions path. Use `-InstallerToolset Wix6` to opt into the WiX 6 SDK-style path (restored via NuGet).
2642

@@ -37,35 +53,17 @@ Required:
3753
- Add the toolset root to `PATH` (or rerun `Setup-Developer-Machine.ps1` to do it for you).
3854
- Install the **Visual Studio WiX Toolset v3 extension** so `Wix.CA.targets` is available to MSBuild.
3955

40-
## Building FieldWorks
41-
42-
FieldWorks uses the **MSBuild Traversal SDK** for declarative, dependency-ordered builds:
43-
44-
**Windows (PowerShell):**
45-
```powershell
46-
.\build.ps1 # Debug build
47-
.\build.ps1 -Configuration Release
48-
```
49-
50-
For detailed build instructions, see [.github/instructions/build.instructions.md](.github/instructions/build.instructions.md).
51-
52-
## Building Installers (WiX 3 default, WiX 6 opt-in)
56+
### Running installer builds
5357

5458
Installer builds include the additional utilities (UnicodeCharEditor, LCMBrowser, MigrateSqlDbs, etc.).
5559
To skip them, pass `-BuildAdditionalApps:$false`.
5660

5761
```powershell
58-
# Build the installer (Debug, WiX 3 default)
62+
# Build the installer (WiX 3 default)
5963
.\build.ps1 -BuildInstaller
6064
61-
# Build the installer (Debug, WiX 6)
65+
# Build the installer (WiX 6)
6266
.\build.ps1 -BuildInstaller -InstallerToolset Wix6
63-
64-
# Build the installer (Release, WiX 3 default)
65-
.\build.ps1 -BuildInstaller -Configuration Release
66-
67-
# Build the installer (Release, WiX 6)
68-
.\build.ps1 -BuildInstaller -Configuration Release -InstallerToolset Wix6
6967
```
7068

7169
WiX 3 artifacts are produced under `FLExInstaller/bin/x64/<Config>/` (MSI under `en-US/`).

0 commit comments

Comments
 (0)