Skip to content

Commit e0b9619

Browse files
committed
Use FieldWorks.proj for main file
Add local mulit-agent capability
1 parent dee74e1 commit e0b9619

32 files changed

+1417
-399
lines changed

.github/BUILD_REQUIREMENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ If you only need to build C# projects and already have native artifacts from a p
3232

3333
```powershell
3434
# Build only managed projects (skips native C++)
35-
msbuild dirs.proj /p:Configuration=Debug /p:Platform=x64
35+
msbuild FieldWorks.proj /p:Configuration=Debug /p:Platform=x64
3636
```
3737

3838
## CI Builds
@@ -76,7 +76,7 @@ Both `build.ps1` and `build.sh` now include:
7676
1. **Automatic FwBuildTasks bootstrap**: Builds build infrastructure before main build
7777
2. **Environment validation**: Warns if Developer environment is not detected
7878
3. **Package restoration**: Restores NuGet packages before build
79-
4. **Traversal build**: Uses MSBuild Traversal SDK (dirs.proj) for correct dependency ordering
79+
4. **Traversal build**: Uses MSBuild Traversal SDK (FieldWorks.proj) for correct dependency ordering
8080

8181
## Visual Studio Requirements
8282

.github/copilot-instructions.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ Before submitting a PR:
173173

174174
--------------------------------------------------------------------------------
175175

176+
## Multi-agent worktree builds (containers)
177+
178+
CRITICAL: When working in a worktree folder (path contains '\worktrees\agent-'), ALWAYS build inside the matching Docker container. Extract the agent number from the path and use: `docker exec fw-agent-N powershell -NoProfile -c "msbuild <solution> /m /p:Configuration=Debug"`
179+
180+
To identify which container to use: if workspace path is '...\worktrees\agent-2\...', use container 'fw-agent-2'
181+
182+
For agent worktrees, NEVER run msbuild directly on the host. COM/registry operations must happen in the isolated container.
183+
184+
In agent worktrees, prefer using VS Code tasks ('Terminal > Run Task > Restore + Build Debug') which are pre-configured for the correct container.
185+
186+
For the main repository (not in worktrees), build directly with: `.\build.ps1 -Configuration Debug` or `msbuild dirs.proj`
187+
188+
Read-only operations (git, Get-Content, ls, dir) always run on the host, regardless of worktree.
189+
190+
--------------------------------------------------------------------------------
191+
176192
## Where to make changes
177193

178194
- Core source: Src/ contains the primary C# and C++ projects. Mirror existing patterns for new code.

.github/instructions/build.instructions.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: "FieldWorks build guidelines and inner-loop tips"
66

77
## Quick Start
88

9-
FieldWorks uses the **MSBuild Traversal SDK** for declarative build ordering. All builds use `dirs.proj`.
9+
FieldWorks uses the **MSBuild Traversal SDK** for declarative build ordering. All builds use `FieldWorks.proj`.
1010

1111
### Windows (PowerShell)
1212
```powershell
@@ -36,13 +36,13 @@ FieldWorks uses the **MSBuild Traversal SDK** for declarative build ordering. Al
3636
- Declarative dependency ordering (110+ projects organized into 21 phases)
3737
- Automatic parallel builds where safe
3838
- Better incremental build performance
39-
- Works with `dotnet build dirs.proj`
39+
- Works with `dotnet build FieldWorks.proj`
4040
- Clear error messages when prerequisites missing
4141

4242
## Build Architecture
4343

4444
### Traversal Build Phases
45-
The `dirs.proj` file defines a declarative build order:
45+
The `FieldWorks.proj` file defines a declarative build order:
4646

4747
1. **Phase 1**: FwBuildTasks (build infrastructure)
4848
2. **Phase 2**: Native C++ components (via `allCppNoTest` target)
@@ -78,9 +78,9 @@ Run: msbuild Build\Src\NativeBuild\NativeBuild.csproj
7878
- Generated code out of sync (delete `Src/Common/ViewsInterfaces/Views.cs`)
7979

8080
### Choose the right path
81-
- **Full system build**: `.\build.ps1` or `./build.sh` (uses dirs.proj traversal)
82-
- **Direct MSBuild**: `msbuild dirs.proj /p:Configuration=Debug /p:Platform=x64 /m`
83-
- **Dotnet CLI**: `dotnet build dirs.proj` (requires .NET SDK)
81+
- **Full system build**: `.\build.ps1` or `./build.sh` (uses FieldWorks.proj traversal)
82+
- **Direct MSBuild**: `msbuild FieldWorks.proj /p:Configuration=Debug /p:Platform=x64 /m`
83+
- **Dotnet CLI**: `dotnet build FieldWorks.proj` (requires .NET SDK)
8484
- **Single project**: `msbuild Src/<Path>/<Project>.csproj` (for quick iterations)
8585
- **Native only**: `msbuild Build\Src\NativeBuild\NativeBuild.csproj` (Phase 2 of traversal)
8686
- **Installer**: See `Build/Installer.targets` for installer build targets (requires WiX Toolset)
@@ -114,18 +114,18 @@ msbuild Build\Src\NativeBuild\NativeBuild.csproj /p:Configuration=Debug /p:Platf
114114
### Build Order Issues
115115
**Symptom**: Project X fails because it can't find assembly from project Y
116116

117-
**Solution**: The traversal build handles this automatically through `dirs.proj`:
117+
**Solution**: The traversal build handles this automatically through `FieldWorks.proj`:
118118
- Check that the dependency is listed in an earlier phase than the dependent
119-
- Verify both projects are included in `dirs.proj`
120-
- If you find a missing dependency, update `dirs.proj` phase ordering
119+
- Verify both projects are included in `FieldWorks.proj`
120+
- If you find a missing dependency, update `FieldWorks.proj` phase ordering
121121

122122
### Parallel Build Race Conditions
123123
**Symptom**: Random failures in parallel builds
124124

125125
**Solution**:
126126
- Traversal SDK respects dependencies and avoids races
127127
- If you encounter race conditions, reduce parallelism: `.\build.ps1 -MsBuildArgs @('/m:1')`
128-
- Report race conditions so dependencies can be added to `dirs.proj`
128+
- Report race conditions so dependencies can be added to `FieldWorks.proj`
129129

130130
### Clean Build Required
131131
```powershell
@@ -150,39 +150,39 @@ msbuild Build\Src\NativeBuild\NativeBuild.csproj /p:Configuration=Debug /p:Platf
150150
### Direct MSBuild Invocation
151151
```powershell
152152
# Traversal build with MSBuild
153-
msbuild dirs.proj /p:Configuration=Debug /p:Platform=x64 /m
153+
msbuild FieldWorks.proj /p:Configuration=Debug /p:Platform=x64 /m
154154
155155
# With tests
156-
msbuild dirs.proj /p:Configuration=Debug /p:Platform=x64 /p:action=test /m
156+
msbuild FieldWorks.proj /p:Configuration=Debug /p:Platform=x64 /p:action=test /m
157157
```
158158

159159
### Building Specific Project Groups
160160
```powershell
161161
# Native C++ only (Phase 2 of traversal)
162162
msbuild Build\Src\NativeBuild\NativeBuild.csproj
163163
164-
# Specific phase from dirs.proj (not typically needed)
164+
# Specific phase from FieldWorks.proj (not typically needed)
165165
# The traversal build handles ordering automatically
166166
```
167167

168168
### Dotnet CLI (Traversal Only)
169169
```powershell
170-
# Works with dirs.proj
171-
dotnet build dirs.proj
170+
# Works with FieldWorks.proj
171+
dotnet build FieldWorks.proj
172172
173173
# Restore packages
174-
dotnet restore dirs.proj --packages packages/
174+
dotnet restore FieldWorks.proj --packages packages/
175175
```
176176

177177
## Don't modify build files lightly
178-
- **`dirs.proj`**: Traversal build order; verify changes don't create circular dependencies
178+
- **`FieldWorks.proj`**: Traversal build order; verify changes don't create circular dependencies
179179
- **`Build/mkall.targets`**: Native C++ build orchestration; changes affect all developers
180180
- **`Build/SetupInclude.targets`**: Environment setup; touch only when absolutely needed
181181
- **`Directory.Build.props`**: Shared properties for all projects; changes affect everyone
182182

183183
## References
184184
- **CI/CD**: `.github/workflows/` for CI steps
185185
- **Build Infrastructure**: `Build/` for targets/props and build infrastructure
186-
- **Traversal Project**: `dirs.proj` for declarative build order
186+
- **Traversal Project**: `FieldWorks.proj` for declarative build order
187187
- **Shared Properties**: `Directory.Build.props` for all projects
188188
- **Native Build**: `Build/mkall.targets` for C++ build orchestration

.vscode/settings.json

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,51 @@
77
"speckit.implement": true
88
},
99
"chat.tools.terminal.autoApprove": {
10+
// Specify scripts
1011
".specify/scripts/bash/": true,
11-
".specify/scripts/powershell/": true
12+
".specify/scripts/powershell/": true,
13+
// Read-only operations
14+
"Get-Content": true,
15+
"cat": true,
16+
"type": true,
17+
"Get-ChildItem": true,
18+
"ls": true,
19+
"dir": true,
20+
"tree": true,
21+
"Test-Path": true,
22+
"Get-Location": true,
23+
"pwd": true,
24+
"Get-Item": true,
25+
"Get-ItemProperty": true,
26+
// Git operations (read-only)
27+
"git status": true,
28+
"git log": true,
29+
"git diff": true,
30+
"git show": true,
31+
"git branch": true,
32+
"git worktree list": true,
33+
// Docker read-only operations
34+
"docker ps": true,
35+
"docker images": true,
36+
"docker logs": true,
37+
"docker info": true,
38+
"docker inspect": true,
39+
// Docker exec - ONLY for agent containers (safe, isolated)
40+
"docker exec fw-agent-": true,
41+
// Build operations (host-based for main repo)
42+
"msbuild": true,
43+
"dotnet build": true,
44+
"dotnet restore": true,
45+
".\\build.ps1": true,
46+
".\\build.sh": true,
47+
// Test operations
48+
"dotnet test": true,
49+
"vstest.console": true,
50+
"nunit3-console": true,
51+
// Agent workflow scripts
52+
".\\scripts\\spin-up-agents.ps1": true,
53+
".\\scripts\\tear-down-agents.ps1": true,
54+
".\\scripts\\check-agents.ps1": true
1255
},
1356
"cmake.ignoreCMakeListsMissing": true
1457
}

BUILD_CHALLENGES_ANALYSIS.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
The SDK migration faced **~80 compilation errors** across multiple attempts to get the build working. The key success factor was **systematic error resolution** - fixing one category completely before moving to the next. However, analysis reveals **some inconsistencies** in approach across different project types and phases that should be reconciled.
2020

2121
### Key Success Patterns
22-
**Automated bulk conversion** (convertToSDK.py) handled 115 projects consistently
23-
**Wildcard package versions** (e.g., `11.0.0-*`) for SIL packages prevented version conflicts
24-
**Explicit test exclusion** pattern established and applied consistently
25-
**x64 enforcement** via Directory.Build.props propagated to all projects
22+
**Automated bulk conversion** (convertToSDK.py) handled 115 projects consistently
23+
**Wildcard package versions** (e.g., `11.0.0-*`) for SIL packages prevented version conflicts
24+
**Explicit test exclusion** pattern established and applied consistently
25+
**x64 enforcement** via Directory.Build.props propagated to all projects
2626

2727
### Divergent Approaches Found
28-
⚠️ **GenerateAssemblyInfo handling** - Mixed true/false across projects without clear rationale
29-
⚠️ **SDK type selection** - Some WPF projects initially used wrong SDK (Microsoft.NET.Sdk vs. WindowsDesktop)
30-
⚠️ **Package reference patterns** - Inconsistent use of PrivateAssets and Exclude attributes
31-
⚠️ **Platform target** - Some projects have explicit x64, others rely on inherited property
28+
⚠️ **GenerateAssemblyInfo handling** - Mixed true/false across projects without clear rationale
29+
⚠️ **SDK type selection** - Some WPF projects initially used wrong SDK (Microsoft.NET.Sdk vs. WindowsDesktop)
30+
⚠️ **Package reference patterns** - Inconsistent use of PrivateAssets and Exclude attributes
31+
⚠️ **Platform target** - Some projects have explicit x64, others rely on inherited property
3232

3333
---
3434

@@ -173,7 +173,7 @@ CS0103: The name 'InitializeComponent' does not exist in the current context
173173
```xml
174174
<!-- Before -->
175175
<Project Sdk="Microsoft.NET.Sdk">
176-
176+
177177
<!-- After -->
178178
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
179179
<PropertyGroup>
@@ -193,7 +193,7 @@ CS0103: The name 'InitializeComponent' does not exist in the current context
193193

194194
**Error**:
195195
```
196-
CS0436: The type 'MasterItem' in 'MGA/MasterItem.cs' conflicts with
196+
CS0436: The type 'MasterItem' in 'MGA/MasterItem.cs' conflicts with
197197
the imported type 'MasterItem' in 'MGA, Version=0.0.0.0'
198198
```
199199

@@ -232,7 +232,7 @@ Projects use different exclusion patterns:
232232

233233
**Error**:
234234
```
235-
CS0535: 'NullThreadedProgress' does not implement interface member
235+
CS0535: 'NullThreadedProgress' does not implement interface member
236236
'IThreadedProgress.Canceling'
237237
```
238238

@@ -333,7 +333,7 @@ Projects fall into 3 categories:
333333
- Category 2: Redundant but harmless, explicitly states x64 ⚠️
334334
- Category 3: Build tools that may run on different platforms (FwBuildTasks) ✅
335335

336-
**Recommendation**:
336+
**Recommendation**:
337337
- Remove explicit `<PlatformTarget>x64</PlatformTarget>` from Category 2 projects
338338
- Rely on Directory.Build.props for consistency
339339
- Keep explicit only for special cases (build tools)
@@ -383,7 +383,7 @@ Only some EXE projects import RegFree.targets:
383383
- ❌ LexText.exe (not yet integrated)
384384
- ❌ Other utility EXEs
385385

386-
**Recommendation**:
386+
**Recommendation**:
387387
- Identify all EXE projects that use COM
388388
- Add RegFree.targets import to all of them
389389
- Document which EXEs need manifests
@@ -409,35 +409,35 @@ Only some EXE projects import RegFree.targets:
409409
#### Challenge 5.1: Build Order Dependencies
410410
**Problem**: 110+ projects need correct build order
411411

412-
**Approach**: Implemented MSBuild Traversal SDK with dirs.proj
412+
**Approach**: Implemented MSBuild Traversal SDK with FieldWorks.proj
413413

414414
**Decision Matrix**:
415415

416-
| Approach | Pros | Cons | Chosen |
417-
|----------|------|------|--------|
418-
| Manual MSBuild dependencies | Fine-grained control | Hard to maintain ||
419-
| Solution build order | Simple | No declarative dependencies ||
420-
| Traversal SDK | Declarative phases | Learning curve ||
416+
| Approach | Pros | Cons | Chosen |
417+
| --------------------------- | -------------------- | --------------------------- | ------ |
418+
| Manual MSBuild dependencies | Fine-grained control | Hard to maintain | |
419+
| Solution build order | Simple | No declarative dependencies | |
420+
| Traversal SDK | Declarative phases | Learning curve | |
421421

422422
**Implementation**:
423423
```xml
424-
<!-- dirs.proj -->
424+
<!-- FieldWorks.proj -->
425425
<Project Sdk="Microsoft.Build.Traversal/4.1.0">
426426
<ItemGroup Label="Phase 1: Build Tasks">
427427
<ProjectReference Include="Build\Src\FwBuildTasks\FwBuildTasks.csproj" />
428428
</ItemGroup>
429-
429+
430430
<ItemGroup Label="Phase 2: Native C++">
431431
<ProjectReference Include="Build\Src\NativeBuild\NativeBuild.csproj" />
432432
</ItemGroup>
433-
433+
434434
<!-- ... 21 phases total -->
435435
</Project>
436436
```
437437

438438
**Success Factor**: Declarative ordering makes dependencies explicit and maintainable
439439

440-
**Consistency**: ✅ All projects referenced in dirs.proj in correct phase
440+
**Consistency**: ✅ All projects referenced in FieldWorks.proj in correct phase
441441

442442
**Decision Documentation**: 21 phases documented with clear rationale
443443

@@ -606,7 +606,7 @@ Criteria for GenerateAssemblyInfo=true (default):
606606
- ✅ Wildcards for pre-release (e.g., 11.0.0-*) - SUCCESS
607607
- ✅ Fixed for stable (e.g., 4.4.0) - No conflicts
608608

609-
**Final Decision**:
609+
**Final Decision**:
610610
- Pre-release packages: Use wildcards (`*`)
611611
- Stable packages: Use fixed versions
612612

@@ -639,7 +639,7 @@ Criteria for GenerateAssemblyInfo=true (default):
639639

640640
**Tried**:
641641
- ⚠️ Enhanced mkall.targets - Works but complex
642-
- ✅ MSBuild Traversal SDK with dirs.proj - Declarative, maintainable
642+
- ✅ MSBuild Traversal SDK with FieldWorks.proj - Declarative, maintainable
643643

644644
**Final Decision**: Full Traversal SDK implementation
645645

@@ -751,6 +751,6 @@ The SDK migration was largely successful, with **systematic approaches** yieldin
751751

752752
---
753753

754-
*Analysis Date: 2025-11-08*
755-
*Based on: 93 commits from 8e508dab to HEAD*
754+
*Analysis Date: 2025-11-08*
755+
*Based on: 93 commits from 8e508dab to HEAD*
756756
*Method: Deep commit analysis + pattern detection + consistency audit*

Build/Installer.targets

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,14 @@
127127
Properties="Configuration=Release;Platform=x86"
128128
/>
129129
</Target>
130-
131130
<!-- Modern traversal build for installer (replaces legacy remakefw) -->
132-
<Target Name="BuildFieldWorks" DependsOnTargets="CleanAll;Initialize;CopyDlls;setRegistryValues;GeneratePartsAndLayoutFiles">
131+
<Target
132+
Name="BuildFieldWorks"
133+
DependsOnTargets="CleanAll;Initialize;CopyDlls;setRegistryValues;GeneratePartsAndLayoutFiles"
134+
>
133135
<Message Text="Building FieldWorks using MSBuild Traversal SDK..." Importance="High" />
134136
<MSBuild
135-
Projects="$(fwrt)/dirs.proj"
137+
Projects="$(fwrt)/FieldWorks.proj"
136138
Properties="Configuration=$(Configuration);Platform=$(Platform);action=$(action);desktopNotAvailable=$(desktopNotAvailable)"
137139
/>
138140
<Message Text="FieldWorks build complete." Importance="High" />

Build/Orchestrator.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<!-- Default Build target: orchestrate full traversal build -->
3131
<Target Name="Build">
3232
<Message Text="Building FieldWorks via MSBuild Traversal SDK" Importance="high" />
33-
<MSBuild Projects="$(MSBuildThisFileDirectory)..\dirs.proj" Properties="Configuration=$(Configuration);Platform=$(Platform)" />
33+
<MSBuild Projects="$(MSBuildThisFileDirectory)..\FieldWorks.proj" Properties="Configuration=$(Configuration);Platform=$(Platform)" />
3434
</Target>
3535

3636
<!-- Installer targets are imported from Installer.targets -->

Build/Src/NativeBuild/NativeBuild.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!--
88
NativeBuild: Build orchestrator for native C++ component builds
99
10-
This project serves as a bridge between the MSBuild Traversal SDK (dirs.proj)
10+
This project serves as a bridge between the MSBuild Traversal SDK (FieldWorks.proj)
1111
and the native build system (mkall.targets). It allows the traversal
1212
build to properly sequence native component builds before managed projects.
1313

Build/mkall.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
Native C++ Build Orchestration for FieldWorks
55
66
This file coordinates building native C++ components (DebugProcs, GenericLib, FwKernel, Views)
7-
and their associated test executables. It is called by the MSBuild Traversal SDK via dirs.proj.
7+
and their associated test executables. It is called by the MSBuild Traversal SDK via FieldWorks.proj.
88
99
Modern Build Path (MSBuild Traversal SDK):
10-
dirs.proj → Build/Src/NativeBuild/NativeBuild.csproj → This file
10+
FieldWorks.proj → Build/Src/NativeBuild/NativeBuild.csproj → This file
1111
1212
Responsibilities:
1313
1. Native C++ component builds (DebugProcs, GenericLib, FwKernel, Views)

0 commit comments

Comments
 (0)