|
| 1 | +# Eclipse Platform Repository - Copilot Instructions |
| 2 | + |
| 3 | +## Repository Overview |
| 4 | + |
| 5 | +This repository contains the core Eclipse Platform components that form the basis for the Eclipse IDE. It is a **large-scale Java/OSGi project** (~120MB, 5,600+ Java files across 38 Maven modules) using **Maven/Tycho** for building Eclipse RCP bundles and features. |
| 6 | + |
| 7 | +**Key Technologies:** |
| 8 | +- Language: Java (JDK 17+, targets JDK 21 in CI) |
| 9 | +- Build: Maven 3.9+ with Eclipse Tycho (OSGi/RCP build tooling) |
| 10 | +- Architecture: OSGi bundles organized as Eclipse plugins |
| 11 | +- Testing: JUnit with Tycho Surefire plugin |
| 12 | + |
| 13 | +**Main Modules:** |
| 14 | +- `runtime/` - Core runtime, jobs, expressions, content types (org.eclipse.core.runtime, org.eclipse.core.jobs) |
| 15 | +- `resources/` - Workspace, filesystem, project management (org.eclipse.core.resources, org.eclipse.core.filesystem) |
| 16 | +- `debug/` - Debug framework and UI, external tools, launch configurations |
| 17 | +- `team/` - Version control framework (CVS examples) |
| 18 | +- `ua/` - User assistance: help system, cheatsheets, tips |
| 19 | +- `ant/` - Ant integration and UI |
| 20 | +- `terminal/` - Terminal view |
| 21 | +- `platform/` - SDK packaging |
| 22 | + |
| 23 | +## Critical Build Information |
| 24 | + |
| 25 | +**⚠️ IMPORTANT: This repository CANNOT be built in isolation.** It depends on a parent POM (`eclipse-platform-parent`) from the [eclipse.platform.releng.aggregator](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator) repository. |
| 26 | + |
| 27 | +### Individual Bundle Builds |
| 28 | + |
| 29 | +Individual bundles CAN be built using the pre-configured profile if you have network access to Eclipse repositories: |
| 30 | + |
| 31 | +```bash |
| 32 | +cd <bundle-directory> # e.g., runtime/bundles/org.eclipse.core.runtime |
| 33 | +mvn clean verify -Pbuild-individual-bundles |
| 34 | +``` |
| 35 | + |
| 36 | +The `-Pbuild-individual-bundles` profile (configured in `.mvn/maven.config`) enables the bundle to fetch the parent POM from https://repo.eclipse.org/content/repositories/eclipse/. |
| 37 | + |
| 38 | +**Note:** If network access to Eclipse repositories is blocked, individual bundle builds will fail. In such environments, code exploration and analysis can still be performed, but build verification is not possible. |
| 39 | + |
| 40 | +### Full Platform Build |
| 41 | + |
| 42 | +For full platform builds, use the aggregator repository which includes this repo as a Git submodule. The CI workflows in this repository delegate to workflows in the aggregator repository. |
| 43 | + |
| 44 | +### Build Profiles Used in CI |
| 45 | + |
| 46 | +The Jenkinsfile shows the complete build command: |
| 47 | +```bash |
| 48 | +mvn clean verify --batch-mode --fail-at-end \ |
| 49 | + -Pbree-libs -Papi-check -Pjavadoc \ |
| 50 | + -Dmaven.test.failure.ignore=true \ |
| 51 | + -Dcompare-version-with-baselines.skip=false \ |
| 52 | + -Dmaven.compiler.failOnWarning=false |
| 53 | +``` |
| 54 | + |
| 55 | +Key profiles: |
| 56 | +- `-Pbree-libs` - Bundle Runtime Execution Environment libraries |
| 57 | +- `-Papi-check` - API baseline comparison (detects breaking changes) |
| 58 | +- `-Pjavadoc` - Generate Javadoc |
| 59 | + |
| 60 | +## Testing |
| 61 | + |
| 62 | +**Test Organization:** |
| 63 | +- Tests are in `<module>/tests/` subdirectories (e.g., `runtime/tests/`, `resources/tests/`) |
| 64 | +- Test bundles follow naming: `org.eclipse.<area>.tests.<component>` |
| 65 | +- Tests use JUnit 4/5 with Tycho Surefire |
| 66 | + |
| 67 | +**Running Tests:** |
| 68 | +```bash |
| 69 | +# Run tests for a specific bundle |
| 70 | +cd <test-bundle-directory> |
| 71 | +mvn clean verify -Pbuild-individual-bundles |
| 72 | + |
| 73 | +# Tests are automatically run during 'mvn verify' |
| 74 | +# Test results: target/surefire-reports/TEST-*.xml |
| 75 | +``` |
| 76 | + |
| 77 | +**Important Test Notes:** |
| 78 | +- Some tests require graphical display (use Xvnc in CI - see Jenkinsfile) |
| 79 | +- Tests in `debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java` require user terminal and should NOT run on build machines |
| 80 | +- Test failures are allowed in CI (`-Dmaven.test.failure.ignore=true`) |
| 81 | + |
| 82 | +## Validation & CI Checks |
| 83 | + |
| 84 | +### GitHub Actions Workflows |
| 85 | + |
| 86 | +All workflows delegate to the aggregator repository: |
| 87 | + |
| 88 | +1. **PR Checks** (`.github/workflows/pr-checks.yml`): |
| 89 | + - Freeze period verification |
| 90 | + - No merge commits check |
| 91 | + - Version increment verification (uses PDE API Tools) |
| 92 | + |
| 93 | +2. **Continuous Integration** (`.github/workflows/ci.yml`): |
| 94 | + - Delegates to `mavenBuild.yml` in aggregator |
| 95 | + - Runs full build with all profiles |
| 96 | + |
| 97 | +3. **CodeQL** (`.github/workflows/codeql.yml`): |
| 98 | + - Security scanning for Java code |
| 99 | + |
| 100 | +### Local Validation Steps |
| 101 | + |
| 102 | +Before committing, verify your changes: |
| 103 | + |
| 104 | +```bash |
| 105 | +# 1. Build the affected bundle |
| 106 | +cd <bundle-directory> |
| 107 | +mvn clean verify -Pbuild-individual-bundles |
| 108 | + |
| 109 | +# 2. Check for API issues (PDE API Tools) |
| 110 | +# API baseline checks run automatically with -Papi-check |
| 111 | +# Results in: target/apianalysis/*.xml |
| 112 | + |
| 113 | +# 3. Check for compiler warnings |
| 114 | +# Results in: target/compilelogs/*.xml |
| 115 | +``` |
| 116 | + |
| 117 | +### API Tools & Version Management |
| 118 | + |
| 119 | +**Critical:** Eclipse uses semantic versioning with API tooling enforcement: |
| 120 | +- Major version: Breaking API changes |
| 121 | +- Minor version: Binary compatible API additions, significant changes |
| 122 | +- Service version: Bug fixes (increments: +1 for maintenance, +100 for next release) |
| 123 | +- Qualifier: Build timestamp |
| 124 | + |
| 125 | +**Version Change Rules:** |
| 126 | +1. API breaking change → Increment major version, reset minor/service to 0 |
| 127 | +2. API addition (binary compatible) → Increment minor version, reset service to 0 |
| 128 | +3. Bug fix in maintenance → Increment service by 1 |
| 129 | +4. Bug fix in next release → Increment service by 100 |
| 130 | + |
| 131 | +**PDE API Tools automatically detects API changes and enforces version increments.** |
| 132 | + |
| 133 | +See `docs/VersionNumbering.md` and `docs/Evolving-Java-based-APIs.md` for complete details. |
| 134 | + |
| 135 | +## Project Structure |
| 136 | + |
| 137 | +### Root Files |
| 138 | +- `pom.xml` - Main reactor POM (defines modules) |
| 139 | +- `Jenkinsfile` - Jenkins CI pipeline configuration |
| 140 | +- `.mvn/maven.config` - Default Maven options (includes `-Pbuild-individual-bundles`) |
| 141 | +- `.gitignore` - Excludes `target/`, `bin/`, `*.class`, etc. |
| 142 | + |
| 143 | +### Key Configuration Files |
| 144 | + |
| 145 | +**Per Bundle:** |
| 146 | +- `pom.xml` - Maven coordinates and build config |
| 147 | +- `META-INF/MANIFEST.MF` - OSGi bundle manifest (Bundle-SymbolicName, Bundle-Version, dependencies) |
| 148 | +- `build.properties` - Tycho/PDE build configuration (source folders, bin.includes) |
| 149 | +- `.project` - Eclipse project descriptor |
| 150 | +- `.classpath` - Eclipse classpath (typically generated) |
| 151 | + |
| 152 | +**Coding Standards:** |
| 153 | +- `docs/Coding_Conventions.md` - Java coding style (follows Oracle conventions with modifications) |
| 154 | +- `docs/Naming_Conventions.md` - Package/class naming rules |
| 155 | +- Indent with tabs (4 spaces wide) |
| 156 | +- Encoding: UTF-8 (see `.settings/org.eclipse.core.resources.prefs`) |
| 157 | + |
| 158 | +## Common Pitfalls & Solutions |
| 159 | + |
| 160 | +### 1. Parent POM Resolution Failure |
| 161 | +**Error:** `Non-resolvable parent POM for org.eclipse.platform:eclipse.platform` |
| 162 | + |
| 163 | +**Solution:** Always use `-Pbuild-individual-bundles` profile when building individual bundles. This profile is pre-configured in `.mvn/maven.config` but may be needed explicitly in some contexts. |
| 164 | + |
| 165 | +### 2. Missing Dependencies During Build |
| 166 | +**Error:** Cannot resolve bundle dependencies |
| 167 | + |
| 168 | +**Solution:** |
| 169 | +- Individual bundles fetch dependencies from Eclipse repositories |
| 170 | +- Ensure https://repo.eclipse.org is accessible |
| 171 | +- Clean local Maven cache if corrupted: `rm -rf ~/.m2/repository/org/eclipse` |
| 172 | + |
| 173 | +### 3. Test Failures Requiring Display |
| 174 | +**Error:** Tests fail with "No display available" |
| 175 | + |
| 176 | +**Solution:** |
| 177 | +- Tests requiring GUI run automatically on CI (Xvnc configured in Jenkinsfile) |
| 178 | +- For local testing, use Xvfb: `xvfb-run mvn verify` |
| 179 | +- Or skip tests: `mvn verify -DskipTests` |
| 180 | + |
| 181 | +### 4. API Tools Errors |
| 182 | +**Error:** "API baseline errors found" |
| 183 | + |
| 184 | +**Solution:** |
| 185 | +- Review changes in `target/apianalysis/*.xml` |
| 186 | +- If API changed, update bundle version in `META-INF/MANIFEST.MF` |
| 187 | +- Follow version increment rules (see docs/VersionNumbering.md) |
| 188 | +- For intentional API breaks, update baseline comparison |
| 189 | + |
| 190 | +### 5. Build Timeouts |
| 191 | +Maven operations can take considerable time: |
| 192 | +- Clean build of single bundle: 1-3 minutes |
| 193 | +- Full platform build (aggregator): 30-60 minutes |
| 194 | +- Test execution: Variable, some test suites take 10+ minutes |
| 195 | + |
| 196 | +**Set adequate timeouts when building (default 120s may not be enough):** |
| 197 | +```bash |
| 198 | +mvn verify -Pbuild-individual-bundles # May need 180-300 seconds |
| 199 | +``` |
| 200 | + |
| 201 | +## Making Changes |
| 202 | + |
| 203 | +### Typical Change Workflow |
| 204 | + |
| 205 | +1. **Locate the Bundle:** |
| 206 | + - Runtime/core services → `runtime/bundles/` |
| 207 | + - Resource/workspace → `resources/bundles/` |
| 208 | + - Debug/launch → `debug/` |
| 209 | + - Help/documentation → `ua/` |
| 210 | + |
| 211 | +2. **Make Code Changes:** |
| 212 | + - Edit Java sources in bundle's `src/` directory |
| 213 | + - Follow coding conventions (see `docs/Coding_Conventions.md`) |
| 214 | + - Add/update Javadoc for public APIs |
| 215 | + |
| 216 | +3. **Update MANIFEST.MF if needed:** |
| 217 | + - Changed API? Update `Bundle-Version` following semantic versioning |
| 218 | + - New dependencies? Add to `Require-Bundle` or `Import-Package` |
| 219 | + |
| 220 | +4. **Build and Test:** |
| 221 | + ```bash |
| 222 | + cd <bundle-directory> |
| 223 | + mvn clean verify -Pbuild-individual-bundles |
| 224 | + ``` |
| 225 | + |
| 226 | +5. **Verify No API Issues:** |
| 227 | + - Check `target/apianalysis/*.xml` for API baseline errors |
| 228 | + - Address any version increment requirements |
| 229 | + |
| 230 | +6. **Commit:** |
| 231 | + - Write clear commit message |
| 232 | + - Reference issue number if applicable |
| 233 | + |
| 234 | +## File Locations Reference |
| 235 | + |
| 236 | +**Documentation:** All in `docs/` |
| 237 | +- `docs/Coding_Conventions.md` - Code style |
| 238 | +- `docs/API_Central.md` - API guidelines hub |
| 239 | +- `docs/VersionNumbering.md` - Version management |
| 240 | +- `docs/FAQ/` - 200+ FAQ markdown files |
| 241 | + |
| 242 | +**Build Configuration:** |
| 243 | +- `.mvn/maven.config` - Maven CLI defaults |
| 244 | +- `Jenkinsfile` - CI build definition (60 min timeout) |
| 245 | +- `.github/workflows/*.yml` - GitHub Actions (all delegate to aggregator) |
| 246 | + |
| 247 | +**Key Bundle Directories:** |
| 248 | +- `runtime/bundles/org.eclipse.core.runtime` - Core Platform Runtime |
| 249 | +- `runtime/bundles/org.eclipse.core.jobs` - Jobs and scheduling |
| 250 | +- `resources/bundles/org.eclipse.core.resources` - Workspace API |
| 251 | +- `resources/bundles/org.eclipse.core.filesystem` - Filesystem abstraction |
| 252 | + |
| 253 | +## Working Efficiently |
| 254 | + |
| 255 | +**Trust these instructions first.** This repository has a complex build setup that cannot be fully explored from the repository alone. The information above captures the essential knowledge needed to: |
| 256 | +- Understand build requirements and limitations |
| 257 | +- Make targeted changes without breaking CI |
| 258 | +- Navigate the codebase effectively |
| 259 | +- Avoid common build pitfalls |
| 260 | + |
| 261 | +Only search beyond these instructions if: |
| 262 | +- Specific API behavior needs clarification (check `docs/FAQ/`) |
| 263 | +- Detailed versioning rules are needed (check `docs/VersionNumbering.md`) |
| 264 | +- You need examples of existing code patterns (search Java sources) |
| 265 | +- CI is failing with an error not covered here (check Jenkinsfile and workflow YAMLs) |
| 266 | + |
| 267 | +**When in doubt:** Build at the bundle level with `-Pbuild-individual-bundles` profile and verify tests pass locally before pushing changes. |
0 commit comments