Skip to content

Commit 9a72135

Browse files
authored
Update CONTRIBUTING steps (#7960)
1 parent ae408c2 commit 9a72135

File tree

1 file changed

+167
-50
lines changed

1 file changed

+167
-50
lines changed

CONTRIBUTING.md

+167-50
Original file line numberDiff line numberDiff line change
@@ -52,79 +52,196 @@ name and contact info to the [AUTHORS](AUTHORS) file.
5252
6. `git remote add upstream https://github.com/flutter/flutter-intellij`
5353
The name `upstream` can be whatever you want.
5454

55-
## Setting environments
55+
## Environment set-up
5656

57-
The current Java Development Kit version is: **20**.
57+
1. Install the lastest [Java Development Kit](https://www.java.com/en/download/).
58+
- The current Java Development Kit version is: **23**.
59+
- **[Googlers only]** Install Java from go/softwarecenter instead.
5860

59-
1. Set your `JAVA_HOME` directory in your environment.
61+
2. Set your `JAVA_HOME` directory in the configuration file for your shell environment.
6062
- For example, on macOS, the following works:
6163
Check what version of java you have:
6264
```shell
6365
/usr/libexec/java_home -V
6466
```
65-
Set your `JAVA_HOME` env variable to match that version.
67+
This should print out a Java version such as:
6668
```shell
67-
export JAVA_HOME=`/usr/libexec/java_home -v 20`
69+
Matching Java Virtual Machines (1):
70+
23.0.2 (arm64) "Azul Systems, Inc." - "Zulu 23.32.11" /Library/Java/JavaVirtualMachines/zulu-23.jdk/Contents/Home
71+
/Library/Java/JavaVirtualMachines/zulu-23.jdk/Contents/Home
6872
```
69-
2. Set your `FLUTTER_SDK` directory to point to `/path/to/flutter`.
70-
3. Also set your `DART_SDK` directory to `/path/to/flutter/bin/cache/dart-sdk`.
71-
4. Ensure both `DART_SDK`, `FLUTTER_SDK` and `JAVA_HOME` are added to the `PATH`
72-
in the shell initialization script that runs at login.
73-
(not just for the one used for every interactive shell).
74-
```shell
75-
export PATH=$DART_SDK/bin:$FLUTTER_SDK/bin:$JAVA_HOME/bin:$PATH
76-
```
77-
5. Make sure you're using the latest stable release of IntelliJ,
78-
or download and install the latest version of IntelliJ (2023.1 or later).
73+
In your shell configuration file (e.g. `.bashrc` or `.zshrc`), set your `JAVA_HOME` env variable to match that version.
74+
```shell
75+
export JAVA_HOME=`/usr/libexec/java_home -v 23.0.2
76+
```
77+
78+
3. Set your `FLUTTER_SDK` path in the configuration file for your shell environment.
79+
- For example, on macOS, the following works:
80+
Check where your Flutter SDK is installed:
81+
```shell
82+
which flutter
83+
```
84+
This should print out a path to the Flutter SDK such as:
85+
```shell
86+
home/path/to/flutter/bin/flutter
87+
```
88+
In your shell configuration file (e.g. `.bashrc` or `.zshrc`), set your `FLUTTER_SDK` env variable to match the path.
89+
```shell
90+
export FLUTTER_SDK="$HOME/path/to/flutter"
91+
```
92+
93+
4. Set your `DARK_SDK` path in the configuration file for your shell environment.
94+
- In your shell configuration file (e.g. `.bashrc` or `.zshrc`), set your `DART_SDK` env variable to match the Dart SDK in your Flutter SDK. This should look like the `FLUTTER_SDK` path (added above) with `/bin/cache/dart-sdk` appened to the end.
95+
```shell
96+
export DART_SDK="$HOME/path/to/flutter/bin/cache/dart-sdk`"
97+
```
98+
99+
5. Add `DART_SDK`, `FLUTTER_SDK` and `JAVA_HOME` to your `PATH`.
100+
- In your shell configuration file (e.g. `.bashrc` or `.zshrc`), below where your `JAVA_HOME`, `FLUTTER_SDK`, `DART_SDK` env variables were set, add the following line:
101+
```shell
102+
export PATH=$DART_SDK/bin:$FLUTTER_SDK/bin:$JAVA_HOME/bin:$PATH"
103+
```
104+
105+
6. Update your current `PATH`.
106+
- Either re-start your terminal or run `source ~/.zshrc` / `source ~/.bashrc` to add the new environment variables to your `PATH`.
107+
108+
## IntelliJ set-up
109+
110+
1. Make sure you're using the latest stable release of IntelliJ,
111+
or download and install the latest version of IntelliJ (2023.1 or later).
79112
- [IntelliJ Downloads](https://www.jetbrains.com/idea/download/)
80113
- Either the community edition (free) or Ultimate will work.
81-
- Determine the directory of your downloaded IntelliJ IDEA installation. e.g.
82-
* `IntelliJ IDEA CE.app` (macOS)
83-
* `~/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8109.175/IntelliJ IDEA.app` (macOS)
84-
* `~/idea-IC-231.8109.175` (Linux)
85-
* `X:\path\to\your\IDEA-U\ch-0\231.8109.175` (Windows after installed)
86-
6. Start the IntelliJ IDEA with the `flutter-intellij` project.
114+
115+
2. Create a `gradle.properties` file.
116+
- In the root directory, create an empty `gradle.properties` file (`touch gradle.properties`)
117+
- Add the following to the file:
118+
```
119+
name = "flutter-intellij
120+
buildSpec=2024.3
121+
flutterPluginVersion=1
122+
ideaProduct=android-studio
123+
ideaVersion=2024.3.1.7
124+
baseVersion=243.22562.59
125+
dartPluginVersion= 243.21565.120
126+
androidPluginVersion=
127+
sinceBuild=243
128+
untilBuild=253.*
129+
testing=true
130+
kotlin.stdlib.default.dependency=false
131+
org.gradle.parallel=true
132+
org.gradle.jvmargs=-Xms1024m -Xmx4048m`
133+
```
134+
- **[Note]** If you want, you can manually change these properties to target different versions of IntelliJ. See `product-matrix.json` to find which configurations are supported.
135+
136+
3. Start the IntelliJ IDEA with the `flutter-intellij` project.
87137
- If you see a popup with "Gradle build scripts found",
88138
**confirm loading the Gradle project, and wait until syncing is done.**
89139
- If you didn't see the popup at the first start, **delete & re-clone the repo** and try again.
90140
- Install DevKit plugin when prompted (this is required for later steps)
91141
- Ignore suggestion for `protobuf-java` plugin, unless you want it.
92-
7. Prepare other dependencies from the command line:
142+
143+
4. Prepare other dependencies from the command line:
93144
- `cd path/to/flutter-intellij`
94145
- `dart pub get`
95146
- `(cd tool/plugin; dart pub get)`
96147
- `bin/plugin test`
97-
8. In the "Project Structure" dialog (`File | Project Structure`):
98-
- Select "Platform Settings > SDKs", click the "+" sign at the top "Add New SDK (Alt+Insert)",
99-
then select "Add JDK...".
100-
- Point it to the directory of the jbr which is under the IDEA's content (e.g. `IntelliJ IDEA CE.app/Contents/jbr`).
101-
- Change the name to `IDEA JBR 17` (or any names that your can easily identify).
102-
- Select "Platform Settings > SDKs", click the "+" sign at the top "Add New SDK (Alt+Insert)",
103-
then select "Add IntelliJ Platform Plugin SDK...".
104-
- If you don't see this option, ensure you have the DevKit plugin installed.
105-
- Point it to the directory of the content which is under the IDEA's installation.
106-
- Remember the generated name (probably `IntelliJ IDEA IU-231.8109.175`) or change to name to format like this.
107-
- Change the "Internal Java Platform" to the previous `IDEA JBR 17`.
108-
- Select "Platform Settings > Project", change the "SDK" selection to **the previous IntelliJ Platform Plugin SDK**
109-
(probably `IntelliJ IDEA IU-231.8109.175 java version 17`).
110-
- Select "Platform Settings > Modules".
111-
- Select "flutter-intellij > flutter-idea > main" module, switch to the "Paths" window,
112-
select the **Inherit project compile output path** option then apply.
113-
This step can be repeated after everytime the project is open.
114-
- Select every module from the top (flutter-intellij) to the bottom (test) (could be 6 modules in summary),
115-
switch to the "Dependencies" window, change the "Module SDK" selection to `Project SDK`.
116-
9. In the "File | Settings | Build, Execution, Deployment | Build Tools | Gradle" setting:
148+
149+
### Configure "Project Structure" settings
150+
151+
1. From IntelliJ, Open the "Project Structure" dialog (`File | Project Structure`).
152+
153+
2. Add the IntelliJ JBR from disk:
154+
- Select "Platform Settings > SDKs"
155+
- Click the "+" sign at the top "Add New SDK (Alt+Insert)", then select "Add JDK from disk...".
156+
- Select your IntelliJ application (most likely under `Applications`) and from there, select the `Contents/jbr/Contents/Home` directory
157+
- **[For macos]** You won't be able to select the `Contents` directory from Finder without right-clicking on the IntelliJ application, and selecting "Quick Look" from the dropdown that opens. From there, you can select the `Contents` directory.
158+
- Change the name so that you can easily identify it, e.g. `IDEA JBR 21`.
159+
- When you are done, your settings should look something like:
160+
```
161+
Name: IDEA JBR 21
162+
JDK home path: /Applications/IntelliJ IDEA CE.app/Contents/jbr/Contents/Home
163+
```
164+
165+
3. Add the IntelliJ Platform Plugin SDK
166+
- Select "Platform Settings > SDKs"
167+
- Click the "+" sign at the top "Add New SDK (Alt+Insert)", then select "Add IntelliJ Platform Plugin SDK...".
168+
- **[Note]** If you don't see this option, ensure you have the DevKit plugin installed.
169+
- Select your IntelliJ application (most likely under `Applications`) and from there, select the `Contents` directory
170+
- **[For macos]** You won't be able to select the `Contents` directory from Finder without right-clicking on the IntelliJ application, and selecting "Quick Look" from the dropdown that opens.
171+
- Remember the generated name (probably `IntelliJ IDEA IU-231.8109.175`) or change to name to format like this.
172+
- Change the **Internal Java Platform** to the JBR you added in step 2. (e.g. `IDEA JBR 21`).
173+
- When you are done, your settings should look something like:
174+
```
175+
Name: IntelliJ IDEA Community Edition IC-243.23654.189
176+
IntelliJ Platform Plugin SDK home path: /Applications/IntelliJ IDEA CE.app/Contents
177+
Internal Java Platform: IDEA JBR 21
178+
```
179+
180+
3. Set the SDK for the Project
181+
- Select "Project Settings > Project"
182+
- Change the "SDK" selection to the **IntelliJ Platform Plugin SDK** you added in step 3.
183+
- When you are done, your settings should look something like:
184+
```
185+
SDK: IntelliJ IDEA Community Edition IC-243.23654.189
186+
```
187+
188+
4. Configure the modules for the Project
189+
- Select "Project Settings > Modules"
190+
- Select the `flutter-intellij > flutter-idea` module
191+
- Switch to the "Paths" window
192+
- Select the **Inherit project compile output path** option then apply.
193+
194+
5. Change the modules SDK to the Project SDK
195+
- Select "Project Settings > Modules"
196+
- Select all the sub-directories under the `flutter-intellij > flutter-idea` module
197+
- Switch to the "Dependencies" window
198+
- Change the "Module SDK" selection to `Project SDK`.
199+
200+
### Configure the Gradle settings
201+
202+
1. From IntelliJ, Open the "Settings" dialog (`IntelliJ IDEA | Settings`).
203+
204+
2. Change the Gradle JVM to the Project SDK
205+
- Select "Build, Execution, Deployment > Build Tools > Gradle"
117206
- Change "Gradle JVM" selection to "Project SDK".
118-
10. In the "File | Settings | Build, Execution, Deployment | Compiler" setting:
119-
- In "Java Compiler", change the "Project bytecode version" to the same version of the JDK.
120-
- In "Kotlin Compiler", change the "Target JVM version" to the same version of the JDK.
121-
11. One-time Dart plugin install - first-time a new IDE is installed and run you will need to install the Dart plugin.
207+
- When you are done, your settings should look something like:
208+
```
209+
Gradle JVM: Project SDK IDEA JBR 21
210+
```
211+
212+
3. Configure the Java compiler
213+
- Select "Build, Execution, Deployment > Compiler > Java Compiler"
214+
- Change the "Project bytecode version" to the major version of your Java version.
215+
- For example, if your Java version is `23.0.2 `, set it to `23`.
216+
- When you are done, your settings should look something like:
217+
```
218+
Project bytecode version: 23
219+
```
220+
221+
4. Configure the Kotlin compiler
222+
- Select "Build, Execution, Deployment > Compiler > Java Compiler"
223+
- Change the "Target JVM version" to the same version as the Java compiler (step 3).
224+
- When you are done, your settings should look something like:
225+
```
226+
Target JVM version: 23
227+
```
228+
229+
### Build and run the plugin
230+
231+
1. One-time Dart plugin install - first-time a new IDE is installed and run you will need to install the Dart plugin.
122232
- Find `Plugins` (in "File | Settings | Plugins") and install the Dart plugin, then restart the IDE if needed.
123-
12. Build the project using `Build` | `Build Project`.
124-
13. Try running the plugin; select the `flutter-intellij [runIde]` run config then click the Debug icon.
233+
234+
2. [Optional] Add a key for JX Browser (see **Working with Embedded DevTools (JxBrowser)** below)
235+
- **[Note]** This is only required if you are making changes to the embedded views.
236+
237+
3. Build the project using `Build` | `Build Project`.
238+
239+
4. Try running the plugin; select the `flutter-intellij [runIde]` run config then click the Debug icon.
125240
This should open the "runtime workbench", a new instance of IntelliJ IDEA with the plugin installed.
126-
14. If the Flutter Plugin doesn't load (Dart code or files are unknown) see above "One-time Dart plugin install".
127-
15. Verify installation of the Flutter plugin:
241+
242+
5. If the Flutter Plugin doesn't load (Dart code or files are unknown) see above "One-time Dart plugin install".
243+
244+
6. Verify installation of the Flutter plugin:
128245
- Select `flutter-intellij [runIde]` in the Run Configuration drop-down list.
129246
- Click Debug button (to the right of that drop-down).
130247
- In the new IntelliJ process that spawns, open the `path/to/flutter/examples/hello_world` project.

0 commit comments

Comments
 (0)