Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 126 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,143 @@
# Contributing to JetBrains IDEs Open Source
# Contributing

Thanks for your interest in contributing to the JetBrains IDEs open-source repository!
## AI Code Policy

## What kinds of contributions we welcome
This project does not accept any AI generated code.

- **Bug fixes (preferred).** Most contributions we accept are fixes for reproducible issues. Tests should supply those fixes if possible.
- **Features (by prior agreement only).** If you want to add a feature, please discuss it with us first. We accept features only when they
align with our roadmap for the relevant subsystem.
- **“Patch welcome” issues.** We maintain a list of feature requests and improvements that we warmly welcome from the community:
https://youtrack.jetbrains.com/issues?q=%23patch_welcome
Please also refrain from unnecessarily padding out your issues, comments or PR descriptions using LLMs. Though you may use AI to assist with translations if you aren't fluent in English.

Before you start, make sure you:
If you are interested in the motivation behind this decision, [see here](https://detachhead.codeberg.page/workproperly/blog/2026/07/21/i-dont-like-ai/).

- Have an existing YouTrack ticket for the issue you plan to work on (or create one if needed): https://youtrack.jetbrains.com/
- Have read:
- [IntelliJ Coding Guidelines](https://plugins.jetbrains.com/docs/intellij/intellij-coding-guidelines.html)
- [Contribute Code](https://www.jetbrains.com/opensource/idea/)
- Follow the recommended [commit message format](#commit-message-format)
## Getting the Source Code

## Commit message format
This section will guide you through getting the project sources and help avoid common issues in git config and other steps before opening it in the IDE.

We strongly recommend following this commit message format:
#### Prerequisites
- [Git](https://git-scm.com/) installed
- Install [IntelliJ IDEA 2023.2](https://www.jetbrains.com/idea/download) or higher.
- For **Windows** set these git config to avoid common issues during cloning:
```
git config --global core.longpaths true
git config --global core.autocrlf input
```

#### Clone Main Repository

Rebased is available from the [GitHub repository](https://github.com/detachhead/rebased).
The **master** (_default_) branch contains the source code which is periodically merged with upstream, however Rebased tracks upstream IntelliJ Community releases in [separate release branches](https://github.com/DetachHead/rebased/pulls?q=is%3Apr+label%3A%22release+branch%22). Releases are always published from the latest release branch instead of the master branch.

You can [clone this project](https://www.jetbrains.com/help/idea/manage-projects-hosted-on-github.html#clone-from-GitHub) directly using IntelliJ IDEA.

Alternatively, follow the steps below in a terminal:

```
<YouTrack ticket ID>( <YouTrack ticket ID>)* (<subsystem>: )? <subject>

<detailed description>?
git clone https://github.com/detachhead/rebased.git
cd rebased
```

E.g.:
> [!TIP]
> - **For faster download**: If the complete repository history isn't needed, create [shallow clone](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthdepth)
> To download only the latest revision of the repository, add `--depth 1` option after `clone`.
> - Cloning in IntelliJ IDEA also supports creating shallow clone.

```
IDEA-125730 Groovy: declare explicit type
---
## Building Rebased

Broken template should revert all its changes and move the caret back to the original position
```
These instructions will help you build Rebased from source code, which is based on the IntelliJ community edition.
IntelliJ IDEA '**2023.2**' or newer is required.

> [!IMPORTANT]
>
> IntelliJ IDEA project is currently being migrated to the [Bazel](https://bazel.build/) build system.
> The migration is still in progress, so you may encounter some rough edges or temporary issues along the way, mostly related to IDE integration.
> * Building the project using only IDE built-in capabilities is not supported anymore, so make sure the [Bazel plugin](https://plugins.jetbrains.com/plugin/22977-bazel) is installed and enabled.
> * Known issue: some tests are not yet possible to be run with Bazel. In case of any issues, please depend on the `tests.cmd` script mentioned in the [Running IntelliJ IDEA in CI/CD environment](#running-intellij-idea-in-cicd-environment) section.

### Opening the Rebased Source Code in the IDE
Using the latest IntelliJ IDEA, click '**File | Open**', select the `<IDEA_HOME>` directory.
If IntelliJ IDEA displays a message about a missing or out-of-date required plugin (e.g. Kotlin),
[enable, upgrade, or install that plugin](https://www.jetbrains.com/help/idea/managing-plugins.html) and restart IntelliJ IDEA.


### Build Configuration Steps
1. **JDK Setup**

- Use JetBrains Runtime 25 (without JCEF) to compile
- IDE will prompt to download it on the first build
> [!IMPORTANT]
>
> JetBrains Runtime **without** JCEF is required. If `jbr-25` SDK points to JCEF version, change it to the non-JCEF version:
> - Add `idea.is.internal=true` to `idea.properties` and restart the IDE.
> - Go to '**Project Structure | SDKs**'
> - Click 'Browse' → 'Download...'
> - Select version 25 and vendor 'JetBrains Runtime'
> - To confirm if the JDK is correct, navigate to the SDK page with jbr-25 selected. Search for `jcef`, it should **_NOT_** yield a result.

2. **Maven Configuration** : If the **Maven** plugin is disabled, [add the path variable](https://www.jetbrains.com/help/idea/absolute-path-variables.html) "**MAVEN_REPOSITORY**" pointing to `<USER_HOME>/.m2/repository` directory.

3. **Memory Settings**
- Ensure a minimum **8GB** RAM on your computer.
- With the minimum RAM, disable "**Compile independent modules in parallel**" in '**Settings | Build, Execution, Deployment | Compiler**'.
- With notably higher available RAM, Increase "**User-local heap size**" to `3000`.


### Building the Rebased Application from Source

**To build Rebased from source**, choose '**Build | Build Project**' from the main menu.

**To build installation packages**, run the [installers.cmd](installers.cmd) script in `<IDEA_HOME>` directory. `installers.cmd` will work on both Windows and Unix systems.
Options to build installers are passed as system properties to `installers.cmd` command.
You may find the list of available properties in [BuildOptions.kt](platform/build-scripts/src/org/jetbrains/intellij/build/BuildOptions.kt)

Pass --debug to suspend and wait for debugger at port 5005

Installer build examples:
```bash
# Build installers only for current operating system:
./installers.cmd -Dintellij.build.target.os=current
```

> [!TIP]
>
> The `installers.cmd` is used to run [OpenSourceCommunityInstallersBuildTarget](build/src/OpenSourceCommunityInstallersBuildTarget.kt) from the command line.
> You can also call it directly from IDEA, using run configuration `Build Rebased Installers (current OS)`.


#### Dockerized Build Environment
To build installation packages inside a Docker container with preinstalled dependencies and tools, run the following command in `<IDEA_HOME>` directory (on Windows, use PowerShell):
```bash
docker build . --target intellij_idea --tag intellij_idea_env
docker run --rm --user "$(id -u)" --volume "${PWD}:/community" intellij_idea_env
```
> [!NOTE]
>
> Please remember to specify the `--user "$(id -u)"` argument for the container's user to match the host's user.
> This prevents issues with permissions for the checked-out repository, the build output, if any.

---
## Running Rebased
To run the version of Rebased that was built from source, choose '**Run | Run**' from the main menu. This will use the preconfigured run configuration `Rebased`.

To run tests on the build, apply these settings to the '**Run | Edit Configurations... | Templates | JUnit**' configuration tab:
* Working dir: `<IDEA_HOME>/bin`
* VM options: `-ea`


### Running Rebased in CI/CD environment

Avoid including links to any discussions in commit messages (Slack, https://platform.jetbrains.com/, etc.). Instead, summarize the
discussion right in the commit message, or create a YouTrack ticket and summarize it there.
To run tests outside of IntelliJ IDEA, run the `tests.cmd` command in `<IDEA_HOME>` directory.`tests.cmd` can be used in both Windows and Unix systems.
Options to run tests are passed as system properties to `tests.cmd` command.
You may find the list of available properties in [TestingOptions.kt](platform/build-scripts/src/org/jetbrains/intellij/build/TestingOptions.kt)

## Building the IDE
```bash
./tests.cmd --module intellij.idea.community.main.tests
```
```bash
# Run a specific test:
./tests.cmd --module intellij.idea.community.main.tests --test com.intellij.util.ArrayUtilTest
```

Please read the [README.md](README.md) in order to understand how to build or
run the IDE on your machine.
to debug tests use: `-Dintellij.build.test.debug.suspend=true -Dintellij.build.test.debug.port=5005`

`tests.cmd` is used just to run [CommunityRunTestsBuildTarget](build/src/CommunityRunTestsBuildTarget.kt) from the command line.
You can also call it directly from IDEA, see run configuration `tests` for an example.
151 changes: 8 additions & 143 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ brew install detachhead/tap/rebased
<details>
<summary>Manual installation</summary>

Download the `.dmg` from [GitHub releases](https://github.com/DetachHead/rebased/releases)
Download the `.dmg` from [GitHub releases](https://github.com/DetachHead/rebased/releases)

After copying `Rebased.app` to your Applications folder, you may see the following error message:
> "Rebased.app" is damaged and can't be opened. You should move it to the Bin.
After copying `Rebased.app` to your Applications folder, you may see the following error message:
> "Rebased.app" is damaged and can't be opened. You should move it to the Bin.

**This is Apple lying to you.** Nothing is "damaged", it's just not code-signed with an Apple Developer certificate. To fix it, run the following command:
**This is Apple lying to you.** Nothing is "damaged", it's just not code-signed with an Apple Developer certificate. To fix it, run the following command:
```bash
xattr -rd com.apple.quarantine /Applications/Rebased.app
```
Expand Down Expand Up @@ -89,146 +89,11 @@ One of the goals of Rebased is to prevent users from having to install bloated p

(currently only one language, but feel free to open an [issue](https://github.com/DetachHead/rebased/issues/new/choose) or [PR](https://github.com/DetachHead/rebased/compare) for others)

## Credits

- https://github.com/obiscr/intellij-community - a previous attempt at creating a JetBrains git client that I cherrypicked some commits from
- JetBrains (obviously)

## Contributing

> [!NOTE]
> This section is mostly unchanged from the upstream intellij-community repo, but with a few small tweaks to match the changes I've made to the build process.

### Getting the Source Code

This section will guide you through getting the project sources and help avoid common issues in git config and other steps before opening it in the IDE.

##### Prerequisites
- [Git](https://git-scm.com/) installed
- Install [IntelliJ IDEA 2023.2](https://www.jetbrains.com/idea/download) or higher.
- For **Windows** set these git config to avoid common issues during cloning:
```
git config --global core.longpaths true
git config --global core.autocrlf input
```

##### Clone Main Repository

Rebased is available from the [GitHub repository](https://github.com/detachhead/rebased).
The **master** (_default_) branch contains the source code which is periodically merged with upstream, however Rebased tracks upstream IntelliJ Community releases in [separate release branches](https://github.com/DetachHead/rebased/pulls?q=is%3Apr+label%3A%22release+branch%22). Releases are always published from the latest release branch instead of the master branch.

You can [clone this project](https://www.jetbrains.com/help/idea/manage-projects-hosted-on-github.html#clone-from-GitHub) directly using IntelliJ IDEA.

Alternatively, follow the steps below in a terminal:

```
git clone https://github.com/detachhead/rebased.git
cd rebased
```

> [!TIP]
> - **For faster download**: If the complete repository history isn't needed, create [shallow clone](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthdepth)
> To download only the latest revision of the repository, add `--depth 1` option after `clone`.
> - Cloning in IntelliJ IDEA also supports creating shallow clone.

---
### Building Rebased

These instructions will help you build Rebased from source code, which is based on the IntelliJ community edition.
IntelliJ IDEA '**2023.2**' or newer is required.

> [!IMPORTANT]
>
> IntelliJ IDEA project is currently being migrated to the [Bazel](https://bazel.build/) build system.
> The migration is still in progress, so you may encounter some rough edges or temporary issues along the way, mostly related to IDE integration.
> * Building the project using only IDE built-in capabilities is not supported anymore, so make sure the [Bazel plugin](https://plugins.jetbrains.com/plugin/22977-bazel) is installed and enabled.
> * Known issue: some tests are not yet possible to be run with Bazel. In case of any issues, please depend on the `tests.cmd` script mentioned in the [Running IntelliJ IDEA in CI/CD environment](#running-intellij-idea-in-cicd-environment) section.

#### Opening the Rebased Source Code in the IDE
Using the latest IntelliJ IDEA, click '**File | Open**', select the `<IDEA_HOME>` directory.
If IntelliJ IDEA displays a message about a missing or out-of-date required plugin (e.g. Kotlin),
[enable, upgrade, or install that plugin](https://www.jetbrains.com/help/idea/managing-plugins.html) and restart IntelliJ IDEA.


#### Build Configuration Steps
1. **JDK Setup**

- Use JetBrains Runtime 25 (without JCEF) to compile
- IDE will prompt to download it on the first build
> [!IMPORTANT]
>
> JetBrains Runtime **without** JCEF is required. If `jbr-25` SDK points to JCEF version, change it to the non-JCEF version:
> - Add `idea.is.internal=true` to `idea.properties` and restart the IDE.
> - Go to '**Project Structure | SDKs**'
> - Click 'Browse' → 'Download...'
> - Select version 25 and vendor 'JetBrains Runtime'
> - To confirm if the JDK is correct, navigate to the SDK page with jbr-25 selected. Search for `jcef`, it should **_NOT_** yield a result.

2. **Maven Configuration** : If the **Maven** plugin is disabled, [add the path variable](https://www.jetbrains.com/help/idea/absolute-path-variables.html) "**MAVEN_REPOSITORY**" pointing to `<USER_HOME>/.m2/repository` directory.

3. **Memory Settings**
- Ensure a minimum **8GB** RAM on your computer.
- With the minimum RAM, disable "**Compile independent modules in parallel**" in '**Settings | Build, Execution, Deployment | Compiler**'.
- With notably higher available RAM, Increase "**User-local heap size**" to `3000`.

See [`CONTRIBUTING.md`](./CONTRIBUTING.md)

#### Building the Rebased Application from Source

**To build Rebased from source**, choose '**Build | Build Project**' from the main menu.

**To build installation packages**, run the [installers.cmd](installers.cmd) script in `<IDEA_HOME>` directory. `installers.cmd` will work on both Windows and Unix systems.
Options to build installers are passed as system properties to `installers.cmd` command.
You may find the list of available properties in [BuildOptions.kt](platform/build-scripts/src/org/jetbrains/intellij/build/BuildOptions.kt)

Pass --debug to suspend and wait for debugger at port 5005

Installer build examples:
```bash
# Build installers only for current operating system:
./installers.cmd -Dintellij.build.target.os=current
```

> [!TIP]
>
> The `installers.cmd` is used to run [OpenSourceCommunityInstallersBuildTarget](build/src/OpenSourceCommunityInstallersBuildTarget.kt) from the command line.
> You can also call it directly from IDEA, using run configuration `Build Rebased Installers (current OS)`.


##### Dockerized Build Environment
To build installation packages inside a Docker container with preinstalled dependencies and tools, run the following command in `<IDEA_HOME>` directory (on Windows, use PowerShell):
```bash
docker build . --target intellij_idea --tag intellij_idea_env
docker run --rm --user "$(id -u)" --volume "${PWD}:/community" intellij_idea_env
```
> [!NOTE]
>
> Please remember to specify the `--user "$(id -u)"` argument for the container's user to match the host's user.
> This prevents issues with permissions for the checked-out repository, the build output, if any.

---
### Running Rebased
To run the version of Rebased that was built from source, choose '**Run | Run**' from the main menu. This will use the preconfigured run configuration `Rebased`.

To run tests on the build, apply these settings to the '**Run | Edit Configurations... | Templates | JUnit**' configuration tab:
* Working dir: `<IDEA_HOME>/bin`
* VM options: `-ea`


#### Running Rebased in CI/CD environment

To run tests outside of IntelliJ IDEA, run the `tests.cmd` command in `<IDEA_HOME>` directory.`tests.cmd` can be used in both Windows and Unix systems.
Options to run tests are passed as system properties to `tests.cmd` command.
You may find the list of available properties in [TestingOptions.kt](platform/build-scripts/src/org/jetbrains/intellij/build/TestingOptions.kt)

```bash
./tests.cmd --module intellij.idea.community.main.tests
```
```bash
# Run a specific test:
./tests.cmd --module intellij.idea.community.main.tests --test com.intellij.util.ArrayUtilTest
```

to debug tests use: `-Dintellij.build.test.debug.suspend=true -Dintellij.build.test.debug.port=5005`
## Credits

`tests.cmd` is used just to run [CommunityRunTestsBuildTarget](build/src/CommunityRunTestsBuildTarget.kt) from the command line.
You can also call it directly from IDEA, see run configuration `tests` for an example.
- https://github.com/obiscr/intellij-community - a previous attempt at creating a JetBrains git client that I cherrypicked some commits from
- JetBrains (obviously)
Loading