Repository navigation
Expand file tree
/
Copy pathCONTRIBUTING.md
More file actions
426 lines (338 loc) · 23.8 KB
/
Copy pathCONTRIBUTING.md
File metadata and controls
426 lines (338 loc) · 23.8 KB
Edit and raw actions
OlderNewer
1
# Contributing to Eclipse Platform
2
3
Thank you for your interest in this project.
4
5
## Developer Resources
6
7
The project issues and source code are maintained in [multiple GitHub repositories](https://github.com/orgs/eclipse-platform/repositories):
8
9
- https://github.com/eclipse-platform/eclipse.platform
10
- https://github.com/eclipse-platform/eclipse.platform.swt
11
- https://github.com/eclipse-platform/eclipse.platform.ui
12
- https://github.com/eclipse-platform/eclipse.platform.releng.aggregator
13
14
Please search for existing issues before you create a new one.
15
16
## Setting up Your Eclipse and GitHub Account
17
18
All contributors must have an Eclipse account with an associated Eclipse Contributor Agreement.
19
20
<details>
21
<summary>Details…</summary>
22
23
Create an [Eclipse account](https://accounts.eclipse.org/) if you don't already have one.
24
See the ["Eclipse Foundation Account" section](https://www.eclipse.org/projects/handbook/#contributing-account) in the Eclipse Committer Handbook.
25
26
All contributors who are not committers on this Eclipse project must electronically sign the [Eclipse Contributor Agreement (ECA)](https://www.eclipse.org/legal/ECA.php) via their [Eclipse account](https://accounts.eclipse.org/).
27
For more information,
28
please see the [Eclipse Committer Handbook](https://www.eclipse.org/projects/handbook/#contributing).
29
30
To verify the Eclipse Contributor Agreement,
31
GitHub contributions must use the same email address as your [Eclipse account](https://accounts.eclipse.org/).
32
If your GitHub account was registered with a different address,
33
you can [add your Eclipse email address to the account](https://github.com/settings/emails) instead.
34
35
Also add your GitHub account name to your [Eclipse account](https://accounts.eclipse.org/) to enable automated management of access rights for Eclipse project members.
36
You can do this by logging into your Eclipse account,
37
choosing ["Edit Profile"](https://accounts.eclipse.org/user/edit),
38
and add your GitHub account name in the social media links section.
39
40
If you are a committer in any of the Eclipse projects,
41
you should receive an email containing an invite to join that project's GitHub organisation within 2 hours.
42
You should accept the invite to maintain committer status in the GitHub organisation.
43
44
It is recommended to [add SSH public keys to your GitHub account](https://github.com/settings/keys).
45
</details>
46
47
## Creating an Eclipse Development Environment
48
49
You can set up a pre-configured IDE for development of the Eclipse SDK using the following link.
50
51
[](https://www.eclipse.org/setups/installer/?url=https://raw.githubusercontent.com/eclipse-platform/eclipse.platform.releng.aggregator/master/oomph/PlatformSDKConfiguration.setup&show=true "Click to open Eclipse-Installer Auto Launch or drag onto your running installer's title area")
52
53
## Recommended Workflow
54
55
Every change must be made by creating a pull request from a fork of the main project repository;
56
see [fork and pull model](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/about-collaborative-development-models#fork-and-pull-model)
57
as well as [working with forks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks) in the GitHub documentation.
58
59
### Creating and Managing a Fork
60
61
You will need a fork for each repository to which you wish to contribute.
62
63
<details>
64
<summary>Details…</summary>
65
66
Use the _Fork_ button (top right) on the GitHub repository page and choose _Create a new fork_ to create a forked repository under your GitHub account.
67
Whenever changes are pushed to the main project repository,
68
you can click _Sync fork_ in the forked repository to get the latest source code from the main project repository.
69
70
Then you have two options:
71
72
1. Clone the main project repository and add the forked repository as an additional remote
73
74
_With this option, you can easily retrieve the most recent changes from the main project repository by simply pulling the `master` branch, as your default remote repository will be the main project._
75
76
Clone the main repository to your Eclipse workspace or,
77
if you use the Eclipse installer as explained in [Creating an Eclipse Development Environment](#creating-an-eclipse-development-environment),
78
the repository is already cloned that way.
79
The repository URL can be found by clicking the _<> Code_ button on the top right of the _<> Code_ tab within the GitHub page for the main project repository.
80
When you clone the repository,
81
it will automatically be added as the "origin" remote to your local clone.
82
83
You then have to add your fork as an additional remote to push your changes to a branch of that fork.
84
To this end,
85
add the forked repository as an additional remote called "fork" (or whatever you like):
86
* Go to your fork on GitHub.
87
* Click the _<> Code_ button on the top right of the _<> Code_ tab and copy the URL.
88
* Add the URL as the "fork" remote to your local clone.
89
90
Whenever the `master` branch of the main project repository changes,
91
pulling the `master` branch of your local clone will give you the current state.
92
In case you have created a branch and committed changes to it,
93
you can rebase it onto the updated `master` branch.
94
95
2. Clone the forked repository and add the main repository as an additional remote
96
97
_With this option, you can easily create new branches for committed changes in your fork, as the default remote repository will be your forked repository._
98
99
Clone the forked repository to your Eclipse workspace or,
100
if you use the Eclipse installer as explained in [Creating an Eclipse Development Environment](#creating-an-eclipse-development-environment),
101
you have to change the URL for the repository during the setup.
102
The repository URL can be found by clicking the _<> Code_ button on the top right of the _<> Code_ tab within the GitHub page for the forked repository.
103
When you clone the forked repository,
104
it will automatically be added as the "origin" remote to your local clone.
105
106
You then have to add the main project repository as an additional remote.
107
To this end,
108
add the main project repository as an additional remote called "upstream":
109
* Go to the main project repository on GitHub.
110
* Click the _<> Code_ button on the top right of the _<> Code_ tab and copy the URL.
111
* Add the URL as the "upstream" remote to your local clone.
112
113
Whenever the `master` branch of the main project repository changes,
114
you have to synchronize the `master` branch of your fork.
115
Go to the GitHub page of your forked repository and click _Sync fork_.
116
You can then pull the `master` branch of your local clone to retrieve the current state.
117
In case you have created a branch and committed changes to it,
118
you can rebase it onto the updated `master` branch.
119
</details>
120
121
### Creating a Pull Request
122
123
You will need to create a pull request in order to contribute.
124
125
<details>
126
<summary>Details…</summary>
127
128
When you have set up a fork of a repository to which you wish contribute and prepared a local clone for it,
129
you can make changes,
130
commit them,
131
and propose them via a pull request according to the standard ["pull requests from a fork" workflow](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
132
In the following,
133
the workflow is sketched with some specific information for the Eclipse platform projects.
134
135
1. **Preparing the PR:** Create a branch in your fork and apply the desired changes to it.
136
Push the branch with the changes to your forked repository (not to the original upstream project repository).
137
- Make multiple commits if necessary as history can be retained,
138
but note that you will usually be asked to combine your changes to a single commit per pull request.
139
So keep changes as small as possible and try to split them up.
140
141
2. **Creating the PR:** Open the page of the forked repository in your browser,
142
switch to the branch where the fix is developed.
143
Click the _Contribute_ button to start the _Open Pull Request_ workflow.
144
- On the new page verify the target branch is the `master` branch of the main project repository.
145
- Verify that the list of commits contains the changes you intend to merge.
146
- If you are a committer,
147
you can add reviewers if you want certain people to review a change.
148
If you leave this empty,
149
anyone from the project team will review.
150
151
3. **Updating the PR:** To update your pull request,
152
you can push more commits to the same branch in your fork.
153
They automatically get added to the pull request (and trigger a new round of builds and reviews).
154
You can also amend your previous commits and force push them to your branch.
155
- You will usually be asked to squash your commits to a single one before a PR will be merged.
156
- Exception: when you bump versions in the Manifest/POM files,
157
you could provide 2 separate commits in the same PR:
158
one with the functional changes (i.e., in the code) and one with the version bump (i.e., in the Manifest/POM files).
159
This is not a rule but,
160
if necessary,
161
it would help cherry-picking commits when merging your PR,
162
and avoids problems if there is ever a need to revert the code changes.
163
164
4. **Validating and verifying the PR:**
165
- Reviewers can review the pull request on the GitHub website or fetch the PR using the _Fetch GitHub PR_ menu entry in the _Git Repositories_ view inside the Eclipse IDE.
166
- Every PR is automatically verified to check that contributors have a [valid Eclipse Contributor Agreement (ECA)](#setting-up-your-eclipse-and-github-account).
167
- What does a valid PR look like? (Checklist)
168
These are the basic criteria that need to be fulfilled for a PR to be considered valid.
169
- All checks need to pass.
170
- If tests are broken, they should either be fixed or documented, i.e., create a new issue or reference an existing issue.
171
- The code must compile.
172
- The versions of the affected bundles should be properly bumped.
173
- There should be no new API warnings.
174
If a warning can’t be fixed, suppress it and write a comment explaining why.
175
- If there are other (obscure) errors in the checks,
176
please find them (read the logs) and actively ask what is happening and how to fix them.
177
- The commit text should be well-written (see [Commit Message Recommendations](#commit-message-recommendations)).
178
- If tests were added,
179
they should meet the following criteria:
180
- They should **run**: check the logs and make sure they are being executed.
181
- They should **pass**: do not add broken tests.
182
- If the PR has been reviewed and the reviewer left some comments,
183
address them and clearly document what you did.
184
If you have simply done the obvious thing recommended by the reviewer,
185
a "thumbs up" emoji is sufficient and helps avoid unnecessary notifications.
186
Please resolve each review comment when it has been addressed by a follow up commit.
187
188
5. **Merging the PR:** Once the PR is approved,
189
it can be merged by a committer.
190
- One of two options can be selected,
191
based on what fits best given these criteria:
192
- _Rebase and Merge_: retains all commits separately; useful when developing a feature consisting of multiple independent commits.
193
- _Squash and Merge_: all commits in the PR get squashed into a single commit; useful to avoid separate "fix comments" commits.
194
- After the PR is merged,
195
the source branch used for the PR in the fork can be deleted.
196
- Your fork is now _out-of-date_ with the main (upstream) project repository.
197
In case the "origin" remote of your local clone is the forked repository,
198
you should get it back in sync.
199
You can either use the _Sync Fork_ function on GitHub to update the fork and pull the `master` branch to your local clone,
200
or pull the latest changes from "upstream" (the main project repository) into your local repository.
201
</details>
202
203
### Using Draft Pull Requests
204
205
GitHub allows you to mark a pull request as a [draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests).
206
Please describe the purpose and current state of the contribution.
207
208
<details>
209
<summary>What to do…</summary>
210
211
A draft PR indicates that:
212
- The changes are **not yet ready for submission/merging**,
213
e.g., work is still in progress, tests are incomplete, or functionality is not fully working.
214
- You are **seeking early feedback** from the community on your approach,
215
design decisions,
216
or implementation.
217
**Important:** Clearly state in the PR description what kind of feedback you are seeking,
218
as draft PRs may be overlooked until marked as ready for review.
219
- You may need **help or guidance** to resolve specific issues or to complete the work.
220
- You want to **share your progress** with others who might be interested or affected by the changes.
221
</details>
222
223
<details>
224
<summary>What not to do…</summary>
225
226
A draft PR is **not**:
227
- A place to dump incomplete or unclear changes without context.
228
Every PR, including drafts, should have a clear purpose and description.
229
- A shield against comments or reviews.
230
Marking a PR as draft does not mean "leave me alone" – it means you welcome early feedback and collaboration.
231
- A substitute for local development or working in a private branch.
232
If you're not ready to share your work or discuss it with others,
233
keep it in your local repository or in a branch of your fork without creating a PR.
234
</details>
235
236
<details>
237
<summary>Best practices…</summary>
238
239
Even when marked as a draft,
240
your PR should meet these basic requirements:
241
242
- **Clear intent and description**: Explain what you are trying to achieve,
243
why the changes are being made,
244
and what the current state is.
245
- **Understandable changes**: Others should be able to understand what you have done so far and what remains to be done.
246
Consider using a task list in the description to track progress.
247
- **Specific questions or requests**: If you need help or feedback on particular aspects,
248
clearly state what you need,
249
e.g., "I'm unsure about the approach in XYZ.java" or "Tests for feature X are still missing".
250
- **Reasonable completeness**: While not everything needs to be finished,
251
the PR should represent a coherent chunk of work that others can review and comment on meaningfully.
252
253
When your draft PR is ready for final review,
254
convert it to a regular PR using the "Ready for review" button.
255
At that point it should meet all the criteria from the checklist above.
256
</details>
257
258
## Commit Message Recommendations
259
260
Please use a commit message with a concise summary,
261
a description,
262
and a link to an issue,
263
if there is an associated issue.
264
265
<details>
266
<summary>Details…</summary>
267
268
```
269
<issue title>
270
271
Short description/summary as to why this change is being made
272
273
Fixes https://github.com/<Full URL to issues/issue #>
274
```
275
276
Example:
277
278
```
279
Make memory view cell editor visible on Linux GTK3
280
281
Since SWT changed from GTK2 to GTK3 as its backend the cell
282
editing in the memory view has not worked properly
283
with the cell editor not visible. This change uses explicit
284
setVisible rather than adjusting Z-order of the controls.
285
286
Fixes https://github.com/eclipse-platform/eclipse.platform.debug/issues/132
287
```
288
289
The issue title must be a concise summary of the change.
290
A more detailed description is provided in the body.
291
Please do not forget to add the issue URL to the commit message.
292
This is used to link with the GitHub issue.
293
</details>
294
295
## Using Generative AI for Contributions
296
297
Please review the Eclipse Project Handbook for details: [Generative Artificial Intelligence Usage Guidelines for Eclipse Committers](https://www.eclipse.org/projects/handbook/#genai).
298
299
## Using GitHub Copilot
300
301
Using the [GitHub Copilot Agent](https://docs.github.com/en/copilot/concepts/agents/coding-agent/about-coding-agent) can boost your productivity and provide interesting insights as it allows to fire up automated agents.
302
303
<details>
304
<summary>Details…</summary>
305
Due to current limitations, using this directly against the base repository has some drawbacks:
306
307
- Copilot cannot currently use a fork,
308
so the branch is created directly on the repository which is against the recommended fork-based workflow.
309
- Copilot currently cannot squash and force push a branch.
310
- GitHub does not support filtering of individual notifications,
311
due to the high cadence and the incremental work mode in some cases,
312
this can easily flood the inbox of subscribers of the repository.
313
- If the task is not properly written or the problem is too complex,
314
it can result in creating something off the track that needs to be discarded and then iterate again which results in more churn.
315
316
Because of this we recommend the following workflow:
317
318
- Let Copilot work on your fork.
319
For this you should sync the fork which can be done through the [web UI](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork).
320
- Instead of assigning Copilot an issue,
321
simply reference the issue in the prompt,
322
e.g., `Analyze and propose a fix for <link to the original issue>`.
323
- If you are happy with the result or would like to further refine it yourself,
324
just fetch the branch from your fork,
325
squash all commits,
326
remove unnecessary files and force push the result to a new branch,
327
e.g., usually Copilot creates `copilot/fix-for-issue-123` so just push it as `fix-for-issue-123` and then open a PR against the repo as usual.
328
This has the advantage that you can even ask Copilot to refine some things later and then just merge the results into your local branch by a simple fetch.
329
- Usually you want to leave Copilot as the author and you as the committer,
330
unless you have significantly rewritten the results,
331
e.g., if it was mostly a research task and you did the actual implementation.
332
</details>
333
334
## Validating Changes and AI Feedback
335
336
Please respect the time and attention of the humans involved in the review process,
337
and reduce the load on the shared build infrastructure that verifies each commit.
338
Use your fork for drafting a pull request and for initial copilot reviews.
339
Create a pull request only after you have personally verified the quality.
340
341
<details>
342
<summary>Details…</summary>
343
Typically a pull request should not be opened while the content is effectively a draft.
344
It should be fully reviewed by you as a human author,
345
and you should have high confidence that the work is complete and ready for the review of another human being.
346
Content that is still being refined,
347
or is still being reviewed in source form by automated (non-human) reviewers,
348
should not be pushed to the upstream repository.
349
350
The goal is to reduce notifications to the repository followers and to avoid thrashing the shared build infrastructure.
351
Every push to an upstream PR triggers the verification builds and notifies all subscribers.
352
The number of concurrent jobs on GitHub-hosted runners is [limited](https://docs.github.com/en/actions/reference/limits#job-concurrency-limits-for-github-hosted-runners),
353
so intermediate states queue up builds for everyone.
354
Actions on standard runners are [free for public repositories](https://docs.github.com/en/billing/concepts/product-billing/github-actions),
355
so the motivation is less noise and particularly less shared ci.eclipse.org load.
356
Therefore it is generally preferable to get AI feedback before you open the PR against the upstream repository:
357
358
1. **Locally (preferred):**
359
Run the [build on the command line](#command-line-builds) and use the local review features of your AI tool,
360
e.g., the [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/overview) offers the `/review` command to run a code review agent on your local changes.
361
Other tools provide similar features.
362
This might have less coverage than the full build matrix,
363
but it is a quick feedback loop.
364
If something does not work locally,
365
please let us know.
366
2. **On your fork:**
367
Push to your fork to run the GitHub Actions workflows there.
368
This does not run the Jenkins build on ci.eclipse.org but gives good initial confidence.
369
Workflows [don't run in forked repositories by default](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflows-in-forked-repositories),
370
you must enable GitHub Actions in the **Actions** tab of your fork.
371
3. **Pull request on your fork:**
372
If you want to use web-integrated tools like [Copilot code review](https://docs.github.com/en/copilot/concepts/agents/code-review),
373
you can open a PR against your own fork.
374
When you are satisfied,
375
close it and open a new one against the upstream repository.
376
4. **Combine them:**
377
Iterate locally first,
378
then push to your fork,
379
and open the PR against the upstream repository only at the end.
380
</details>
381
382
## Command Line Builds
383
384
It is sometimes beneficial to build on the command line as this is how we also execute the verification builds.
385
Moreover some tests might not run at all in the IDE if they require a very specific setup.
386
If you want to produce an update site from your changes or want to have local build artifacts of your changes,
387
you will need to do this on the command line.
388
389
<details>
390
<summary>Required tools…</summary>
391
392
We are using [Apache Maven](https://maven.apache.org/index.html) for building the sources,
393
usually it is fine to just use the [latest release](https://maven.apache.org/download.cgi) you can use whatever [install method](https://maven.apache.org/install.html) that is sufficient for your system.
394
</details>
395
396
<details>
397
<summary>Running the build…</summary>
398
399
Most project repositories are already set up so that you can run `mvn clean verify` directly.
400
One exception is the [aggregator build](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/) that builds all projects together and requires [special attention](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/?tab=readme-ov-file#how-to-build-the-eclipse-sdk).
401
</details>
402
403
<details>
404
<summary>Tips and tricks…</summary>
405
406
- If your **changes do not seem to be applied** this is usually a sign that you forgot to increment the version of the bundle,
407
or haven't committed (you don't need to push) your changes;
408
in which case the baseline replace might come into effect.
409
You will see a warning in the log like this `[WARNING] <project name>: baseline and build artifacts have same version but different contents`.
410
- If you just want to **build one specific module**,
411
this is usually possible without special consideration.
412
Just keep in mind that if the tests are separated from the module you have changed you need to build both of them or the whole reactor.
413
For example you can run the tests and the bundle under test with the command `mvn clean verify -pl :<name of the bundle under test>,:<name of the test bundle>`; one specific test can be run by adding `-Dtest=<fully qualified class name of test>`.
414
- You can perform a **quick run** to check everything compiles with `-DskipTests` in combination with `-T1C` — this can really speed things up; just keep in mind that the tests are not executed.
415
- If you want to **make sure you didn't break the API** you can specify `-Papi-check`.
416
- If you want to **check the javadoc** (JDT currently [not find all issues](https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1858) in the IDE) you can specify `-Pjavadoc` additionally `-DfailOnJavadocErrors=true` will even fail the build,
417
you can even [try to fix them](https://maven.apache.org/plugins/maven-javadoc-plugin/fix-mojo.html) automatically by adding 'javadoc:fix' to your command
418
</details>
419
420
421
## Contact
422
423
- For official announcements,
424
use the project's ["dev" mailing list](https://dev.eclipse.org/mailman/listinfo/platform-dev).
425
- To ask for help,
426
either use the current issue/PR or start a GitHub Discussion.