Skip to content

Commit 7a61082

Browse files
committed
Add initial instructions
1 parent 1ed011f commit 7a61082

File tree

1 file changed

+194
-0
lines changed

1 file changed

+194
-0
lines changed

.github/copilot-instructions.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Copilot coding agent onboarding guide
2+
3+
This document gives you the shortest path to understand, build, test, and validate changes in this repository without exploratory searching. Trust these instructions; only search the repo if a step here is incomplete or produces an error.
4+
5+
--------------------------------------------------------------------------------
6+
7+
## What this repository is
8+
9+
FieldWorks (often referred to as FLEx) is a large, Windows-focused linguistics and language data management suite developed by SIL International. It includes a mix of C#/.NET managed code and native C++/C++‑CLI components, UI applications, shared libraries, installers, test assets, and localization resources.
10+
11+
High-level facts:
12+
- Project type: Large mono-repo with multiple applications/libraries and an installer
13+
- Primary OS target: Windows
14+
- Languages likely present: C#, C++/CLI, C++, XAML/WinForms, XML, WiX, scripts (PowerShell/Bash), JSON
15+
- Tooling and runtimes:
16+
- Visual Studio (C#/.NET Framework and Desktop C++ workloads)
17+
- MSBuild
18+
- WiX Toolset for installer (presence of FLExInstaller)
19+
- NUnit-style test projects are common in SIL repos (expect unit/integration tests)
20+
- Crowdin localization (crowdin.json present)
21+
22+
Documentation:
23+
- Root ReadMe directs to developer docs wiki:
24+
- Developer documentation: https://github.com/sillsdev/FwDocumentation/wiki
25+
26+
Repo size and structure:
27+
- This is a large codebase with many projects. Prefer building via the provided build scripts or top-level solutions instead of ad-hoc builds of individual projects.
28+
29+
--------------------------------------------------------------------------------
30+
31+
## Repository layout (focused)
32+
33+
Top-level items you’ll use most often:
34+
35+
- .editorconfig — code formatting rules
36+
- .github/ — GitHub workflows and configuration (CI runs from here)
37+
- Build/ — build scripts, targets, and shared build infrastructure
38+
- DistFiles/ — packaging inputs and distribution artifacts
39+
- FLExInstaller/ — WiX-based installer project
40+
- Include/ — shared headers/includes for native components
41+
- Lib/ — third-party or prebuilt libraries used by the build
42+
- Src/ — all application, library, and tooling source (see breakdown below)
43+
- TestLangProj/ — test data/projects used by tests and integration scenarios
44+
- ReadMe.md — links to developer documentation wiki
45+
- License.htm — license information
46+
- fw.code-workspace — VS Code workspace settings
47+
48+
Src/ major folders (one level down):
49+
50+
- AppCore/ — shared application core helpers and base infrastructure
51+
- CacheLight/ — lightweight caching services used by core components
52+
- Cellar/ — core data model and persistence layer (Cellar/LCM)
53+
- Common/ — cross-cutting utilities and shared managed/native code
54+
- DbExtend/ — database extensions and schema helpers
55+
- DebugProcs/ — developer diagnostics and debug helpers
56+
- DocConvert/ — document and data conversion tools
57+
- FdoUi/ — UI components for FieldWorks Data Objects
58+
- FwCoreDlgs/ — common dialogs used across FieldWorks apps
59+
- FwParatextLexiconPlugin/ — Paratext lexicon integration plugin
60+
- FwResources/ — shared resources (images, strings, assets) for apps/libraries
61+
- FXT/ — FieldWorks transform assets and related tooling
62+
- GenerateHCConfig/ — build-time configuration generation utilities
63+
- Generic/ — generic/shared components that don’t fit a single app
64+
- InstallValidator/ — utilities to validate installation prerequisites
65+
- Kernel/ — low-level core services and infrastructure
66+
- LCMBrowser/ — LCM/Cellar model browser tooling
67+
- LexText/ — Lexicon/Dictionary application and related components
68+
- ManagedLgIcuCollator/ — managed wrapper for ICU collation
69+
- ManagedVwDrawRootBuffered/ — managed view rendering primitives
70+
- ManagedVwWindow/ — managed view window components
71+
- MigrateSqlDbs/ — database migration and upgrade tooling
72+
- Paratext8Plugin/ — integration plugin for Paratext 8
73+
- ParatextImport/ — import pipeline for Paratext data
74+
- ProjectUnpacker/ — utilities for unpacking FieldWorks projects
75+
- Transforms/ — transformation assets (e.g., XSLT) and helpers
76+
- UnicodeCharEditor/ — Unicode character editor tool
77+
- Utilities/ — misc utilities used across the repo
78+
- views/ — C++ view-layer components and UI view infrastructure
79+
- XCore/ — cross-cutting framework base used by multiple apps
80+
- xWorks/ — primary FieldWorks application (shell and modules)
81+
82+
Tip: Use the top-level solution or build scripts instead of building projects individually; this avoids dependency misconfiguration.
83+
84+
--------------------------------------------------------------------------------
85+
86+
## Build, test, run, lint
87+
88+
Always start from a clean environment, then follow the steps below. If a step fails, do not probe randomly; re-read this section and the developer docs wiki linked above.
89+
90+
Prerequisites (Windows development machine):
91+
- Visual Studio 2022 (or 2019 if indicated by the developer docs) with workloads:
92+
- .NET desktop development
93+
- Desktop development with C++
94+
- MSBuild Tools
95+
- Windows 10/11 SDK
96+
- WiX Toolset 3.11.x (required for installer under FLExInstaller)
97+
- Git
98+
- Crowdin CLI is not required to build but is used for localization sync
99+
100+
Bootstrap:
101+
1) Open a “Developer Command Prompt for VS” to ensure MSBuild/SDKs are on PATH.
102+
2) Ensure any required environment variables are set. When using script-based builds, source the appropriate environment file:
103+
- For Bash: source ./environ
104+
- Some build targets may require: source ./environ-xulrunner or ./environ-other
105+
3) Restore dependencies:
106+
- Managed code: NuGet restore is usually handled automatically by MSBuild for SDK-style projects. If needed: nuget restore <Solution>.sln
107+
- Native deps: Ensure Lib/ and Include/ contents are present (committed in repo).
108+
109+
Build (preferred approaches):
110+
- Scripted CI-style build (repeatable, fewer surprises):
111+
- Bash (CI/local Bash on Windows such as Git Bash):
112+
- source ./environ
113+
- bash ./agent-build-fw.sh
114+
- Notes:
115+
- This script encapsulates the CI build. Use it to mirror CI locally.
116+
- If it references other scripts under Build/ or Bld/, allow them to run unchanged.
117+
- Visual Studio/MSBuild build:
118+
- Open the main solution in Visual Studio (look for FW.sln at repo root or solutions under Src).
119+
- Build Configurations: Debug or Release for x86/x64 as needed.
120+
- Command line:
121+
- msbuild <PathToSolution.sln> /m /p:Configuration=Debug
122+
- msbuild <PathToSolution.sln> /m /p:Configuration=Release
123+
124+
Testing:
125+
- Unit/integration tests are typically under Src/… with names ending in .Tests or similar.
126+
- In Visual Studio: Test Explorer -> Run All
127+
- Command line (typical patterns):
128+
- If tests are SDK-style: dotnet test <PathToSolutionOrTestProj> -c Debug
129+
- If NUnit 3 is used with .NET Framework, run via NUnit Console:
130+
- packages/NUnit.ConsoleRunner*/tools/nunit3-console.exe <TestAssembly>.dll
131+
- Prefer running tests through the same mechanism used by CI (see .github/workflows).
132+
133+
Run (local application debug):
134+
- Launchable applications reside in Src/ under app projects. Set the desired app as startup project in Visual Studio and F5.
135+
- Some apps may depend on native components; ensure the environment (PATH) includes Bin/ and relevant build outputs.
136+
137+
Lint/format/style:
138+
- .editorconfig enforces formatting; configure VS to respect it.
139+
- JetBrains settings (FW.sln.DotSettings) define ReSharper rules; follow warnings.
140+
- If any Roslyn analyzers are included in csproj, build will surface them.
141+
142+
Known gotchas and guidance:
143+
- Always run the environment setup (source ./environ) before script-based builds; missing env vars are a common cause of msbuild/wix failures.
144+
- Installer/packaging (FLExInstaller) requires WiX; skip installer builds for quick iteration unless changing installer logic.
145+
- Localization: crowdin.json indicates strings are synchronized externally. Avoid hardcoding user-visible strings; follow existing localization patterns.
146+
- Native code link errors often indicate missing Include/ or Lib/ configuration—build via the top-level scripts/solutions to ensure correct paths/props are loaded.
147+
148+
Timing:
149+
- This is a large solution; first-time builds can be lengthy. Prefer incremental builds for inner-loop development. Avoid cleaning unless necessary.
150+
151+
--------------------------------------------------------------------------------
152+
153+
## CI and validation
154+
155+
- GitHub Actions are defined under .github/workflows/. Pull Requests trigger validation builds and tests.
156+
- To replicate CI locally:
157+
- Use: source ./environ && bash ./agent-build-fw.sh
158+
- Or run the same msbuild/test steps referenced by the workflow YAMLs.
159+
- Pre-merge checklist the CI approximates:
160+
- Successful build for all targeted configurations
161+
- Unit tests pass
162+
- Packaging (if part of CI)
163+
- Lint/analyzer warnings within policy thresholds
164+
165+
Before submitting a PR:
166+
- Build locally using the CI-style script if possible.
167+
- Run unit tests relevant to your changes.
168+
- If you touched installer/config files, verify the installer build (requires WiX).
169+
- Ensure formatting follows .editorconfig; fix obvious analyzer/lint issues.
170+
171+
--------------------------------------------------------------------------------
172+
173+
## Where to make changes
174+
175+
- Core source: Src/ contains the primary C# and C++ projects. Mirror existing patterns for new code.
176+
- Tests: Keep tests close to the code they cover (e.g., Src/<Component>.Tests). Add or update tests with behavioral changes.
177+
- Installer changes: FLExInstaller/.
178+
- Shared headers/libs: Include/ and Lib/ (be cautious and avoid committing large binaries unless policy allows).
179+
- Localization: Follow existing string resource usage; do not modify crowdin.json.
180+
181+
Dependencies and hidden coupling:
182+
- Some components bridge managed and native layers (C# ↔ C++/CLI ↔ C++). When changing type definitions or interfaces at these boundaries, expect to update both managed and native code and ensure marshaling or COM interop stays correct.
183+
- Build props/targets in Build/ and Bld/ may inject include/lib paths and compiler options; avoid bypassing these by building projects in isolation.
184+
185+
--------------------------------------------------------------------------------
186+
187+
## Confidence checklist for agents
188+
189+
- Prefer the top-level build flow (agent-build-fw.sh or solution-wide MSBuild) over piecemeal project builds.
190+
- Always initialize environment via ./environ before script-based builds.
191+
- Validate with tests in Visual Studio or via the same runners CI uses.
192+
- Keep coding style consistent (.editorconfig, ReSharper settings).
193+
- Touch installer/localization only when necessary, and validate those paths explicitly.
194+
- Trust this guide; only search the repo if a command here fails or a path is missing.

0 commit comments

Comments
 (0)