@@ -39,52 +39,11 @@ List<EditCommand> editCommands = [
39
39
replacement: 'type = "IC"\n version = "211.6693.111"' ,
40
40
version: '2021.1' ,
41
41
),
42
- Subst (
43
- path: 'src/io/flutter/FlutterUtils.java' ,
44
- initial: 'ProjectUtil.isSameProject(Paths.get(path), project)' ,
45
- replacement: 'ProjectUtil.isSameProject(path, project)' ,
46
- versions: ['4.1' ],
47
- ),
48
- Subst (
49
- path: 'src/io/flutter/perf/EditorPerfDecorations.java' ,
50
- initial: 'highlighter.getTextAttributes(null)' ,
51
- replacement: 'highlighter.getTextAttributes()' ,
52
- versions: ['4.1' ],
53
- ),
54
- MultiSubst (
55
- path: 'src/io/flutter/sdk/FlutterSdk.java' ,
56
- initials: [
57
- 'branch = git4idea.light.LightGitUtilKt.getLocation(dir, GitExecutableManager.getInstance().getExecutable((Project)null));' ,
58
- 'catch (VcsException e)'
59
- ],
60
- replacements: [
61
- // This means we don't show platforms in IJ 2020.1, until stable channel supports them.
62
- 'return FlutterSdkChannel.fromText("stable");' ,
63
- 'catch (RuntimeException e)'
64
- ],
65
- versions: ['4.1' ],
66
- ),
67
- MultiSubst (
68
- path: 'src/io/flutter/editor/FlutterIconLineMarkerProvider.java' ,
69
- initials: [
70
- 'import com.intellij.codeInsight.daemon.GutterName;' ,
71
- '@GutterName'
72
- ],
73
- replacements: ['' , '' ],
74
- versions: ['4.1' ],
75
- ),
76
- Subst (
77
- path: 'src/io/flutter/preview/PreviewView.java' ,
78
- initial:
79
- 'Arrays.asList(expandAllAction, collapseAllAction, showOnlyWidgetsAction)' ,
80
- replacement: 'expandAllAction, collapseAllAction, showOnlyWidgetsAction' ,
81
- versions: ['4.1' ],
82
- ),
83
42
Subst (
84
43
path: 'src/io/flutter/FlutterErrorReportSubmitter.java' ,
85
44
initial: 'Consumer<? super SubmittedReportInfo> consumer' ,
86
45
replacement: 'Consumer<SubmittedReportInfo> consumer' ,
87
- versions: ['4.1' , '4. 2' ],
46
+ versions: ['4.2' ],
88
47
),
89
48
Subst (
90
49
path: 'src/io/flutter/utils/CollectionUtils.java' ,
@@ -110,13 +69,13 @@ List<EditCommand> editCommands = [
110
69
'Object' ,
111
70
'null' ,
112
71
],
113
- versions: ['4.1' , '4. 2' ],
72
+ versions: ['4.2' ],
114
73
),
115
74
Subst (
116
75
path: 'flutter-studio/src/io/flutter/project/FlutterProjectCreator.java' ,
117
76
initial: 'cannotWriteToFiles(List<Path> files)' ,
118
77
replacement: 'cannotWriteToFiles(List<? extends File> files)' ,
119
- versions: ['4.1' , '4. 2' ],
78
+ versions: ['4.2' ],
120
79
),
121
80
Subst (
122
81
path: 'src/io/flutter/sdk/FlutterSdkUtil.java' ,
@@ -138,7 +97,8 @@ List<EditCommand> editCommands = [
138
97
),
139
98
Subst (
140
99
path: 'src/io/flutter/utils/JxBrowserUtils.java' ,
141
- initial: 'return false; // return SystemInfo.isMac && com.intellij.util.system.CpuArch.isArm64();' ,
100
+ initial:
101
+ 'return false; // return SystemInfo.isMac && com.intellij.util.system.CpuArch.isArm64();' ,
142
102
replacement: 'return SystemInfo.isMac && CpuArch.isArm64();' ,
143
103
versions: ['2021.1' ],
144
104
),
@@ -164,7 +124,7 @@ class EditAndroidModuleLibraryManager extends EditCommand {
164
124
String convert (BuildSpec spec) {
165
125
// Starting with 3.6 we need to call a simplified init().
166
126
// This is where the $PROJECT_FILE$ macro is defined, #registerComponents.
167
- if (spec.version.startsWith ("4.1" ) || spec.version. startsWith ( '4.2' )) {
127
+ if (spec.version.startsWith ('4.2' )) {
168
128
var processedFile, source;
169
129
processedFile = File (
170
130
'flutter-studio/src/io/flutter/android/AndroidModuleLibraryManager.java' );
@@ -175,19 +135,9 @@ class EditAndroidModuleLibraryManager extends EditCommand {
175
135
"super.init(false, indicator);" , "super.init(indicator);" );
176
136
source = source.replaceAll (
177
137
"import com.intellij.openapi.project.impl.ProjectExImpl;" , "" );
178
- if (spec.version.startsWith ("4.1" )) {
179
- source = source.replaceAll (
180
- "import com.intellij.openapi.components.impl.stores.IProjectStore;" ,
181
- "" );
182
- source = source.replaceAll ("IProjectStore" , "Object" );
183
- source = source.replaceAll (
184
- "androidProject.init42" , "androidProject.initPre41" );
185
- source = source.replaceAll ("PluginManagerCore.getLoadedPlugins(), null" ,
186
- "PluginManagerCore.getLoadedPlugins(), false" );
187
- }
188
138
if (spec.version.startsWith ('4.2' )) {
189
- source = source. replaceAll (
190
- "androidProject.init42" , "androidProject.init41" );
139
+ source =
140
+ source. replaceAll ( "androidProject.init42" , "androidProject.init41" );
191
141
source = source.replaceAll ("PluginManagerCore.getLoadedPlugins(), null" ,
192
142
"PluginManagerCore.getLoadedPlugins()" );
193
143
source = source.replaceAll ("getStateStore1" , "getStateStore" );
@@ -275,9 +225,16 @@ class Subst extends EditCommand {
275
225
String path;
276
226
String initial;
277
227
String replacement;
228
+
229
+ /// The list of platform versions to perform the substitution for.
278
230
List <String > versions;
279
231
280
- Subst ({this .versions, this .initial, this .replacement, this .path, version})
232
+ Subst (
233
+ {this .versions,
234
+ this .initial,
235
+ this .replacement,
236
+ this .path,
237
+ String version})
281
238
: assert (initial != null ),
282
239
assert (replacement != null ),
283
240
assert (path != null ) {
@@ -296,7 +253,7 @@ class Subst extends EditCommand {
296
253
var original = source;
297
254
source = source.replaceAll (initial, replacement);
298
255
processedFile.writeAsStringSync (source);
299
- log ('edited $path ' );
256
+ log ('edited $path ' );
300
257
return original;
301
258
} else {
302
259
return null ;
0 commit comments