Skip to content

Commit 6350cf8

Browse files
authored
Build for AS canary (#5868)
* Build for AS canary
1 parent a22560e commit 6350cf8

31 files changed

+71
-2923
lines changed

.github/workflows/presubmit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
version: [AF.3.1, AS.211, 2021.2]
21+
version: [AF.3.1, AS.211, 2021.2, AS.212]
2222
steps:
2323
- name: checkout
2424
uses: actions/checkout@v2

CONTRIBUTING.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ You can do this online, and it only takes a minute. If you've never submitted co
1010
you must add your (or your organization's) name and contact info to the [AUTHORS](AUTHORS)
1111
file.
1212

13-
NEEDS UPDATING a/o 9 NOV 21
14-
1513
* Install Flutter SDK from [Flutter SDK download](https://flutter.dev/docs/get-started/install) or
1614
[github](https://github.com/flutter/flutter) and set it up according to its instructions.
1715
* Verify installation from the command line:
@@ -213,19 +211,26 @@ Sometimes browsing the source code of IntelliJ is helpful for understanding plat
213211

214212
## Working with Android Studio
215213

214+
Android Studio cannot use the Gradle-based project definition, so it still needs the `flutter-intellij-community.iml`
215+
file. Obviously, unit tests can only be run from the command line.
216+
216217
1. Initialize Android Studio sources.
217218
2. Checkout Flutter plugin sources, tip of tree.
218219
3. Follow the directions for setting up the Dart plugin sources in
219220
intellij-plugins/Dart/README.md with these changes:
220221
- you do not need to clone the intellij-community repo
221-
- open studio-master-dev/tools/idea in IntelliJ
222+
- open studio-main/tools/adt/idea in IntelliJ
222223
- possibly skip running intellij-community/getPlugins.sh
223224
4. Checkout Dart plugin sources.
224225
5. Using the Project Structure editor, import
225-
- intellij-plugins/Dart/Dart-community.iml
226-
- flutter-intellij
227-
6. Using the Project Structure editor, select the `studio` module and add a module dependency to all modules
228-
that begin with `flutter`, plus `Dart` (make sure `Dart` is at the bottom of the list)
226+
- intellij-plugins/Dart/Dart-community.iml (if there are lots of errors, see step 7)
227+
- flutter-intellij/flutter-intellij-community.iml
228+
6. Using the Project Structure editor, expand the tree to show `intellij > android > adt > ui`. Select the `ui`
229+
module then add a module dependency from it to `flutter-intellij-community`. Also add a dependency on the Dart
230+
module unless using step 7.
231+
7. (Optional, when Dart sources are not usable.) Make sure the `flutter-intellij-community` module has a dependency on a library named
232+
`Dart`. It should be pre-defined, but if it is out-of-date then adjust it to point to `flutter-intellij/lib/dart-plugin/xxx.yyyy/Dart.jar`.
233+
Delete the Dart module from the Project Structure modules list.
229234

230235
## Working with Embedded DevTools (JxBrowser)
231236

flutter-idea/src/io/flutter/FlutterUtils.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@ public static boolean isAndroidStudio() {
121121
return StringUtil.equals(PlatformUtils.getPlatformPrefix(), "AndroidStudio");
122122
}
123123

124-
public static boolean isNewAndroidStudioProjectWizard() {
125-
// TODO (messick) Remove this and its references when Android Studio 4.2 is stable.
126-
if (isAndroidStudio()) {
127-
ApplicationInfo info = ApplicationInfo.getInstance();
128-
int major = Integer.parseInt(info.getMajorVersion());
129-
int minor = Integer.parseInt(info.getMinorVersion());
130-
return true; //major >= 4 && minor >= 2;
131-
}
132-
return false;
133-
}
134-
135124
/**
136125
* Write a warning message to the IntelliJ log.
137126
* <p>

flutter-idea/src/io/flutter/module/FlutterModuleBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public void setFlutterSdkPath(String s) {
329329
combo.setItem(s);
330330
}
331331

332-
FlutterCreateAdditionalSettingsFields getSettingsField() {
332+
public FlutterCreateAdditionalSettingsFields getSettingsField() {
333333
return mySettingsFields;
334334
}
335335

flutter-intellij-community.iml

Lines changed: 24 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
<sourceFolder url="file://$MODULE_DIR$/third_party/intellij-plugins-dart/testSrc" isTestSource="true" />
1313
<sourceFolder url="file://$MODULE_DIR$/third_party/vmServiceDrivers" isTestSource="false" />
1414
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
15+
<sourceFolder url="file://$MODULE_DIR$/flutter-idea/src" isTestSource="false" />
16+
<sourceFolder url="file://$MODULE_DIR$/flutter-idea/testSrc/unit" isTestSource="true" />
17+
<sourceFolder url="file://$MODULE_DIR$/flutter-idea/third_party/vmServiceDrivers" isTestSource="false" />
18+
<sourceFolder url="file://$MODULE_DIR$/flutter-studio/src" isTestSource="false" />
1519
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
1620
<excludeFolder url="file://$MODULE_DIR$/.pub" />
1721
<excludeFolder url="file://$MODULE_DIR$/artifacts" />
1822
<excludeFolder url="file://$MODULE_DIR$/build" />
19-
<excludeFolder url="file://$MODULE_DIR$/flutter-idea" />
2023
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/.dart_tool" />
2124
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/.pub" />
2225
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData/sample_tests/build" />
@@ -38,22 +41,22 @@
3841
<excludeFolder url="file://$MODULE_DIR$/tool/plugin/.dart_tool" />
3942
<excludeFolder url="file://$MODULE_DIR$/tool/plugin/.pub" />
4043
<excludeFolder url="file://$MODULE_DIR$/tool/plugin/build" />
44+
<excludeFolder url="file://$MODULE_DIR$/flutter-gui-tests" />
45+
<excludeFolder url="file://$MODULE_DIR$/releases" />
46+
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/artifacts" />
47+
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/build" />
48+
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/resources" />
49+
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testData" />
50+
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/third_party/intellij-plugins-dart" />
51+
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/build" />
52+
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/resources" />
53+
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/testData" />
54+
<excludeFolder url="file://$MODULE_DIR$/flutter-idea/testSrc/integration" />
55+
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/testSrc" />
56+
<excludeFolder url="file://$MODULE_DIR$/flutter-studio/src/io/flutter/module" />
4157
</content>
4258
<orderEntry type="inheritedJdk" />
4359
<orderEntry type="sourceFolder" forTests="false" />
44-
<orderEntry type="module" module-name="intellij.platform.ide" />
45-
<orderEntry type="module" module-name="intellij.platform.lang" />
46-
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
47-
<orderEntry type="module" module-name="intellij.platform.debugger" />
48-
<orderEntry type="module" module-name="intellij.platform.debugger.impl" />
49-
<orderEntry type="module" module-name="intellij.platform.externalSystem.impl" />
50-
<orderEntry type="module" module-name="intellij.platform.externalSystem.rt" />
51-
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
52-
<orderEntry type="library" name="Velocity" level="project" />
53-
<orderEntry type="module" module-name="intellij.platform.smRunner" />
54-
<orderEntry type="module" module-name="intellij.xml.impl" />
55-
<orderEntry type="module" module-name="intellij.java.ui" />
56-
<orderEntry type="module" module-name="intellij.java.psi.impl" />
5760
<orderEntry type="module-library">
5861
<library>
5962
<CLASSES>
@@ -75,24 +78,11 @@
7578
</SOURCES>
7679
</library>
7780
</orderEntry>
78-
<orderEntry type="library" exported="" name="Dart SDK" level="project" />
7981
<orderEntry type="module" module-name="intellij.android.core" />
80-
<orderEntry type="module" module-name="intellij.platform.externalSystem" />
81-
<orderEntry type="module" module-name="intellij.gradle.common" />
82-
<orderEntry type="module" module-name="intellij.java.compiler.impl" />
83-
<orderEntry type="module" module-name="intellij.platform.serviceContainer" />
84-
<orderEntry type="library" name="snakeyaml" level="project" />
85-
<orderEntry type="library" name="miglayout-swing" level="project" />
86-
<orderEntry type="library" name="commons-io" level="project" />
87-
<orderEntry type="library" name="com.android.tools:common" level="project" />
8882
<orderEntry type="library" name="studio-analytics-proto" level="project" />
89-
<orderEntry type="library" name="protobuf" level="project" />
90-
<orderEntry type="library" name="com.android.tools.analytics-library:protos" level="project" />
9183
<orderEntry type="module" module-name="intellij.android.gradle.dsl" />
9284
<orderEntry type="module" module-name="intellij.android.projectSystem" />
93-
<orderEntry type="library" name="Trove4j" level="project" />
9485
<orderEntry type="module" module-name="intellij.android.observable" />
95-
<orderEntry type="library" name="jxbrowser-7.19" level="project" />
9686
<orderEntry type="module-library">
9787
<library>
9888
<CLASSES>
@@ -111,9 +101,7 @@
111101
<SOURCES />
112102
</library>
113103
</orderEntry>
114-
<orderEntry type="library" name="Trove4j" level="project" />
115104
<orderEntry type="module" module-name="intellij.android.observable" />
116-
<orderEntry type="library" name="jxbrowser-7.19" level="project" />
117105
<orderEntry type="library" name="studio-plugin-git4idea" level="project" />
118106
<orderEntry type="library" name="studio-plugin-yaml" level="project" />
119107
<orderEntry type="library" name="studio-plugin-gradle" level="project" />
@@ -127,37 +115,13 @@
127115
<SOURCES />
128116
</library>
129117
</orderEntry>
130-
<orderEntry type="module-library">
131-
<library>
132-
<CLASSES>
133-
<root url="jar://$MODULE_DIR$/lib/dart-plugin/203.6912/Dart.jar!/" />
134-
</CLASSES>
135-
<JAVADOC />
136-
<SOURCES />
137-
</library>
138-
</orderEntry>
139-
<orderEntry type="module" module-name="intellij.vcs.git.rt" />
140-
<orderEntry type="module" module-name="intellij.platform.vcs" />
141-
<orderEntry type="module" module-name="intellij.vcs.git" />
142-
<orderEntry type="module" module-name="intellij.platform.ide.util.io" />
143-
<orderEntry type="module" module-name="intellij.platform.core.ui" />
144-
<orderEntry type="module" module-name="intellij.platform.util.classLoader" />
145-
<orderEntry type="module" module-name="intellij.platform.coverage" />
146118
<orderEntry type="module" module-name="intellij.android.common" />
147-
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
148-
<orderEntry type="module-library" scope="RUNTIME">
149-
<library>
150-
<CLASSES>
151-
<root url="jar://$MODULE_DIR$/lib/dart-plugin/203.6912/resources_en.jar!/" />
152-
</CLASSES>
153-
<JAVADOC />
154-
<SOURCES />
155-
<jarDirectory url="jar://$MODULE_DIR$/lib/dart-plugin/203.6912/resources_en.jar!/" recursive="false" />
156-
</library>
157-
</orderEntry>
158-
<orderEntry type="library" name="Dart Packages" level="project" />
159-
<orderEntry type="library" name="java-string-similarity-2.0.0" level="project" />
160-
<orderEntry type="module" module-name="intellij.yaml" />
161119
<orderEntry type="library" name="mockito" level="project" />
120+
<orderEntry type="library" name="java-string-similarity-2.0.0" level="project" />
121+
<orderEntry type="module" module-name="assistant" />
122+
<orderEntry type="module" module-name="intellij.android.newProjectWizard" />
123+
<orderEntry type="library" name="Dart" level="project" />
124+
<orderEntry type="module" module-name="intellij.android.wizard" />
125+
<orderEntry type="module" module-name="intellij.android.wizard.model" />
162126
</component>
163-
</module>
127+
</module>

flutter-studio/src/io/flutter/FlutterStudioStartupActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.intellij.openapi.project.Project;
99
import com.intellij.openapi.startup.StartupActivity;
1010
import io.flutter.android.AndroidModuleLibraryManager;
11-
import io.flutter.project.FlutterProjectCreator;
11+
//import io.flutter.project.FlutterProjectCreator;
1212
import io.flutter.settings.FlutterSettings;
1313
import io.flutter.utils.AddToAppUtils;
1414
import io.flutter.utils.AndroidUtils;
@@ -28,7 +28,7 @@ public void runActivity(@NotNull Project project) {
2828

2929
// Unset this flag for all projects, mainly to ease the upgrade from 3.0.1 to 3.1.
3030
// TODO(messick) Delete once 3.0.x has 0 7DA's.
31-
FlutterProjectCreator.disableUserConfig(project);
31+
//FlutterProjectCreator.disableUserConfig(project);
3232
// Monitor Android dependencies.
3333
if (FlutterSettings.getInstance().isSyncingAndroidLibraries() ||
3434
System.getProperty("flutter.android.library.sync", null) != null) {

flutter-studio/src/io/flutter/actions/FlutterNewProjectAction.java

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,86 +5,44 @@
55
*/
66
package io.flutter.actions;
77

8-
import com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder;
9-
import com.android.tools.idea.wizard.model.ModelWizard;
10-
import com.android.tools.idea.wizard.model.ModelWizardDialog;
118
import com.intellij.icons.AllIcons;
129
import com.intellij.ide.impl.NewProjectUtil;
1310
import com.intellij.ide.projectWizard.NewProjectWizard;
14-
import com.intellij.ide.projectWizard.ProjectCategory;
15-
import com.intellij.ide.util.projectWizard.ModuleBuilderFactory;
1611
import com.intellij.openapi.actionSystem.AnAction;
1712
import com.intellij.openapi.actionSystem.AnActionEvent;
18-
import com.intellij.openapi.module.ModuleType;
1913
import com.intellij.openapi.project.DumbAware;
2014
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
21-
import com.intellij.openapi.ui.Messages;
2215
import com.intellij.openapi.wm.impl.welcomeScreen.NewWelcomeScreen;
2316
import com.intellij.ui.LayeredIcon;
2417
import com.intellij.ui.OffsetIcon;
2518
import icons.FlutterIcons;
2619
import io.flutter.FlutterBundle;
27-
import io.flutter.FlutterUtils;
28-
import io.flutter.module.FlutterProjectType;
29-
import io.flutter.project.ChoseProjectTypeStep;
30-
import io.flutter.project.FlutterProjectModel;
31-
import java.util.LinkedHashMap;
32-
import java.util.List;
33-
import java.util.NoSuchElementException;
3420
import javax.swing.Icon;
3521
import org.jetbrains.annotations.NotNull;
3622

37-
@SuppressWarnings("ComponentNotRegistered")
3823
public class FlutterNewProjectAction extends AnAction implements DumbAware {
3924

40-
ModuleBuilderFactory[] originalModuleBuilders;
41-
ProjectCategory[] originalCategories;
42-
List<ModuleType<?>> originalTypes;
43-
ModuleType<?>[] originalModuleTypes;
44-
LinkedHashMap<ModuleType<?>, Boolean> originalModuleMap;
45-
4625
public FlutterNewProjectAction() {
4726
super(FlutterBundle.message("action.new.project.title"));
4827
}
4928

5029
@Override
5130
public void update(@NotNull AnActionEvent e) {
5231
if (NewWelcomeScreen.isNewWelcomeScreen(e)) {
53-
e.getPresentation().setIcon(getFlutterDecoratedIcon());
32+
//e.getPresentation().setIcon(getFlutterDecoratedIcon());
5433
e.getPresentation().setText(FlutterBundle.message("welcome.new.project.compact"));
5534
}
5635
}
5736

5837
@Override
5938
public void actionPerformed(@NotNull AnActionEvent e) {
60-
if (!FlutterUtils.isNewAndroidStudioProjectWizard()) {
61-
FlutterProjectModel model = new FlutterProjectModel(FlutterProjectType.APP);
62-
try {
63-
ModelWizard wizard = new ModelWizard.Builder()
64-
.addStep(new ChoseProjectTypeStep(model))
65-
.build();
66-
StudioWizardDialogBuilder builder = new StudioWizardDialogBuilder(wizard, "Create New Flutter Project");
67-
ModelWizardDialog dialog = builder.build();
68-
try {
69-
dialog.show();
70-
}
71-
catch (NoSuchElementException ex) {
72-
// This happens if no Flutter SDK is installed and the user cancels the FlutterProjectStep.
73-
}
74-
}
75-
catch (NoSuchMethodError x) {
76-
Messages.showMessageDialog("Android Studio canary is not supported", "Unsupported IDE", Messages.getErrorIcon());
77-
}
78-
}
79-
else {
80-
NewProjectWizard wizard = new NewProjectWizard(null, ModulesProvider.EMPTY_MODULES_PROVIDER, null);
81-
NewProjectUtil.createNewProject(wizard);
82-
}
39+
NewProjectWizard wizard = new NewProjectWizard(null, ModulesProvider.EMPTY_MODULES_PROVIDER, null);
40+
NewProjectUtil.createNewProject(wizard);
8341
}
8442

8543
@NotNull
8644
Icon getFlutterDecoratedIcon() {
87-
Icon icon = AllIcons.Welcome.CreateNewProjectTab;
45+
Icon icon = AllIcons.Welcome.CreateNewProject;
8846
Icon badgeIcon = new OffsetIcon(0, FlutterIcons.Flutter_badge).scale(0.666f);
8947

9048
LayeredIcon decorated = new LayeredIcon(2);

0 commit comments

Comments
 (0)