Skip to content

Commit 57e733c

Browse files
committed
Merge branch 'refs/heads/master' into feat/optional-android-dep
2 parents a23d5fd + 9a72135 commit 57e733c

File tree

12 files changed

+287
-51
lines changed

12 files changed

+287
-51
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ updates:
99
interval: "weekly"
1010
labels:
1111
- "autosubmit"
12+
# Updating patch versions for "github-actions" is too chatty.
13+
# See https://github.com/flutter/flutter/issues/158350.
14+
ignore:
15+
- dependency-name: "*"
16+
update-types: ["version-update:semver-patch"]

CONTRIBUTING.md

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

54-
## Setting environments
54+
## Environment set-up
5555

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

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

flutter-idea/src/icons/FlutterIcons.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ private static Icon load(String path) {
1414
public static final Icon DevTools = load("/icons/expui/devTools.svg");
1515
public static final Icon DevToolsExtensions = load("/icons/expui/extensions.svg");
1616
public static final Icon DevToolsInspector = load("icons/expui/inspector.svg");
17+
public static final Icon PropertyEditor = load("/icons/expui/propertyEditor.svg");
1718

1819
public static final Icon Flutter_13_2x = load("/icons/[email protected]");
1920
public static final Icon Flutter_64 = load("/icons/flutter_64.png");
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright 2025 The Chromium Authors. All rights reserved.
3+
* Use of this source code is governed by a BSD-style license that can be
4+
* found in the LICENSE file.
5+
*/
6+
package io.flutter.propertyeditor;
7+
8+
import com.intellij.openapi.application.ApplicationManager;
9+
import com.intellij.openapi.project.Project;
10+
import com.intellij.openapi.wm.ToolWindow;
11+
import com.intellij.openapi.wm.ToolWindowFactory;
12+
import io.flutter.FlutterUtils;
13+
import io.flutter.actions.RefreshToolWindowAction;
14+
import io.flutter.bazel.WorkspaceCache;
15+
import io.flutter.devtools.DevToolsIdeFeature;
16+
import io.flutter.devtools.DevToolsUrl;
17+
import io.flutter.run.daemon.DevToolsService;
18+
import io.flutter.sdk.FlutterSdk;
19+
import io.flutter.sdk.FlutterSdkVersion;
20+
import io.flutter.utils.AsyncUtils;
21+
import kotlin.coroutines.Continuation;
22+
import org.jetbrains.annotations.NotNull;
23+
24+
import java.util.List;
25+
import java.util.Optional;
26+
27+
public class PropertyEditorViewFactory implements ToolWindowFactory {
28+
@NotNull private static String TOOL_WINDOW_ID = "Flutter Property Editor";
29+
30+
@Override
31+
public Object isApplicableAsync(@NotNull Project project, @NotNull Continuation<? super Boolean> $completion) {
32+
FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
33+
FlutterSdkVersion sdkVersion = sdk == null ? null : sdk.getVersion();
34+
return sdkVersion != null && sdkVersion.canUsePropertyEditor();
35+
}
36+
37+
@Override
38+
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
39+
FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
40+
FlutterSdkVersion sdkVersion = sdk == null ? null : sdk.getVersion();
41+
42+
AsyncUtils.whenCompleteUiThread(
43+
DevToolsService.getInstance(project).getDevToolsInstance(),
44+
(instance, error) -> {
45+
// Skip displaying if the project has been closed.
46+
if (!project.isOpen()) {
47+
return;
48+
}
49+
50+
if (error != null) {
51+
return;
52+
}
53+
54+
if (instance == null) {
55+
return;
56+
}
57+
58+
final DevToolsUrl devToolsUrl = new DevToolsUrl.Builder()
59+
.setDevToolsHost(instance.host())
60+
.setDevToolsPort(instance.port())
61+
.setPage("propertyEditor")
62+
.setEmbed(true)
63+
.setFlutterSdkVersion(sdkVersion)
64+
.setWorkspaceCache(WorkspaceCache.getInstance(project))
65+
.setIdeFeature(DevToolsIdeFeature.TOOL_WINDOW)
66+
.build();
67+
68+
ApplicationManager.getApplication().invokeLater(() -> {
69+
Optional.ofNullable(
70+
FlutterUtils.embeddedBrowser(project))
71+
.ifPresent(embeddedBrowser -> embeddedBrowser.openPanel(toolWindow, "Property Editor", devToolsUrl, System.out::println));
72+
});
73+
}
74+
);
75+
76+
toolWindow.setTitleActions(List.of(new RefreshToolWindowAction(TOOL_WINDOW_ID)));
77+
}
78+
}

flutter-idea/src/io/flutter/sdk/FlutterSdkVersion.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public final class FlutterSdkVersion implements Comparable<FlutterSdkVersion> {
4646
@NotNull
4747
private static final FlutterSdkVersion MIN_SUPPORTS_DTD = new FlutterSdkVersion("3.22.0");
4848

49+
@NotNull
50+
private static final FlutterSdkVersion MIN_SUPPORTS_PROPERTY_EDITOR = new FlutterSdkVersion("3.29.0");
51+
4952
@Nullable
5053
private final Version version;
5154
@Nullable
@@ -127,6 +130,10 @@ public boolean canUseDeepLinksTool() {
127130
return supportsVersion(MIN_SUPPORTS_DEEP_LINKS_TOOL);
128131
}
129132

133+
public boolean canUsePropertyEditor() {
134+
return supportsVersion(MIN_SUPPORTS_PROPERTY_EDITOR);
135+
}
136+
130137
public boolean canUseDevToolsMultiEmbed() {
131138
return supportsVersion(MIN_SUPPORTS_DEVTOOLS_MULTI_EMBED);
132139
}

product-matrix.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"version": "2024.3",
5353
"ijVersion": "2024.3",
5454
"ideaProduct": "android-studio",
55-
"ideaVersion": "2024.3.1.7",
55+
"ideaVersion": "2024.3.1.10",
5656
"baseVersion": "243.22562.59",
5757
"dartPluginVersion": " 243.21565.120",
5858
"androidPluginVersion": "",

resources/META-INF/plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@
387387
<toolWindow id="Flutter Inspector" anchor="right" icon="FlutterIcons.DevToolsInspector"
388388
factoryClass="io.flutter.view.FlutterViewFactory"/>
389389
<projectService serviceImplementation="io.flutter.view.FlutterView" overrides="false"/>
390+
<!-- Do not uncomment until ready to release the Property Editor. -->
391+
<!-- <toolWindow id="Flutter Property Editor" anchor="right" icon="FlutterIcons.PropertyEditor" factoryClass="io.flutter.propertyeditor.PropertyEditorViewFactory" /> -->
390392
<toolWindow id="Flutter Deep Links" anchor="right" icon="FlutterIcons.DevToolsDeepLinks" factoryClass="io.flutter.deeplinks.DeepLinksViewFactory" />
391393
<toolWindow id="Flutter DevTools" anchor="right" icon="FlutterIcons.DevTools" factoryClass="io.flutter.devtools.RemainingDevToolsViewFactory" />
392394
<toolWindow id="Flutter DevTools Extensions" anchor="right" icon="FlutterIcons.DevToolsExtensions" factoryClass="io.flutter.devtools.DevToolsExtensionsViewFactory" />

resources/META-INF/plugin_template.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@
315315
<toolWindow id="Flutter Inspector" anchor="right" icon="FlutterIcons.DevToolsInspector"
316316
factoryClass="io.flutter.view.FlutterViewFactory"/>
317317
<projectService serviceImplementation="io.flutter.view.FlutterView" overrides="false"/>
318+
<!-- Do not uncomment until ready to release the Property Editor. -->
319+
<!-- <toolWindow id="Flutter Property Editor" anchor="right" icon="FlutterIcons.PropertyEditor" factoryClass="io.flutter.propertyeditor.PropertyEditorViewFactory" /> -->
318320
<toolWindow id="Flutter Deep Links" anchor="right" icon="FlutterIcons.DevToolsDeepLinks" factoryClass="io.flutter.deeplinks.DeepLinksViewFactory" />
319321
<toolWindow id="Flutter DevTools" anchor="right" icon="FlutterIcons.DevTools" factoryClass="io.flutter.devtools.RemainingDevToolsViewFactory" />
320322
<toolWindow id="Flutter DevTools Extensions" anchor="right" icon="FlutterIcons.DevToolsExtensions" factoryClass="io.flutter.devtools.DevToolsExtensionsViewFactory" />

0 commit comments

Comments
 (0)