4
4
* found in the LICENSE file.
5
5
*/
6
6
7
+ import okhttp3.internal.immutableListOf
7
8
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
8
9
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
9
10
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
10
11
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
11
12
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12
13
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
14
+ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
13
15
14
16
// Specify UTF-8 for all compilations so we avoid Windows-1252.
15
17
allprojects {
@@ -36,24 +38,18 @@ plugins {
36
38
id(" org.jetbrains.kotlin.jvm" ) version " 2.1.21-RC2"
37
39
}
38
40
39
- // TODO(mossmana) These properties are duplicated in flutter-idea/build.gradle.kts and flutter-studio/build.gradle.kts. Should be consolidated.
40
41
val flutterPluginVersion = providers.gradleProperty(" flutterPluginVersion" ).get()
41
- val ideaProduct = providers.gradleProperty(" ideaProduct" ).get()
42
42
val ideaVersion = providers.gradleProperty(" ideaVersion" ).get()
43
43
val dartPluginVersion = providers.gradleProperty(" dartPluginVersion" ).get()
44
- // The Android Plugin version is only used if the ideaProduct is not "android-studio"
45
- val androidPluginVersion = providers.gradleProperty(" androidPluginVersion" ).get()
46
44
val sinceBuildInput = providers.gradleProperty(" sinceBuild" ).get()
47
45
val untilBuildInput = providers.gradleProperty(" untilBuild" ).get()
48
46
val javaVersion = providers.gradleProperty(" javaVersion" ).get()
49
47
group = " io.flutter"
50
48
51
49
// For debugging purposes:
52
50
println (" flutterPluginVersion: $flutterPluginVersion " )
53
- println (" ideaProduct: $ideaProduct " )
54
51
println (" ideaVersion: $ideaVersion " )
55
52
println (" dartPluginVersion: $dartPluginVersion " )
56
- println (" androidPluginVersion: $androidPluginVersion " )
57
53
println (" sinceBuild: $sinceBuildInput " )
58
54
println (" untilBuild: $untilBuildInput " )
59
55
println (" javaVersion: $javaVersion " )
@@ -87,7 +83,7 @@ javaCompatibilityVersion = when (javaVersion) {
87
83
}
88
84
89
85
" 21" -> {
90
- JavaVersion .VERSION_21
86
+ JavaVersion .VERSION_21 // all later versions of java can build against the earlier versions
91
87
}
92
88
93
89
else -> {
@@ -103,20 +99,13 @@ dependencies {
103
99
intellijPlatform {
104
100
// Documentation on the default target platform methods:
105
101
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms
106
- if (ideaProduct == " android-studio" ) {
107
- androidStudio(ideaVersion)
108
- } else {
109
- when (ideaProduct) {
110
- " IU" -> intellijIdeaUltimate(ideaVersion)
111
- " IC" -> intellijIdeaCommunity(ideaVersion)
112
- else -> throw IllegalArgumentException (" ideaProduct must be defined in the product matrix as either \" IU\" or \" IC\" , but is not for $ideaVersion " )
113
- }
114
- }
102
+ androidStudio(ideaVersion)
115
103
testFramework(TestFrameworkType .Platform )
116
104
117
105
// Plugin dependency documentation:
118
106
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins
119
- val bundledPluginList = mutableListOf (
107
+ // https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#project-setup
108
+ bundledPlugins(immutableListOf(
120
109
" com.google.tools.ij.aiplugin" ,
121
110
" com.intellij.java" ,
122
111
" com.intellij.properties" ,
@@ -125,27 +114,132 @@ dependencies {
125
114
" org.jetbrains.kotlin" ,
126
115
" org.jetbrains.plugins.gradle" ,
127
116
" org.jetbrains.plugins.yaml" ,
128
- " org.intellij.intelliLang"
129
- )
130
- val pluginList = mutableListOf (" Dart:$dartPluginVersion " )
131
- if (ideaProduct == " android-studio" ) {
132
- bundledPluginList.add(" org.jetbrains.android" )
133
- bundledPluginList.add(" com.android.tools.idea.smali" )
134
- } else {
135
- pluginList.add(" org.jetbrains.android:$androidPluginVersion " )
136
- }
137
-
138
- // Finally, add the plugins into their respective lists:
139
- // https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#project-setup
140
- bundledPlugins(bundledPluginList)
141
- plugins(pluginList)
117
+ " org.intellij.intelliLang" ,
118
+ " org.jetbrains.android" ,
119
+ " com.android.tools.idea.smali"
120
+ ))
121
+ plugin(" Dart:$dartPluginVersion " )
142
122
143
123
if (sinceBuildInput == " 243" || sinceBuildInput == " 251" ) {
144
124
bundledModule(" intellij.platform.coverage" )
145
125
bundledModule(" intellij.platform.coverage.agent" )
146
126
}
147
127
pluginVerifier()
148
128
}
129
+
130
+ // TODO(helin24): The rest in this block was pulled over from flutter-idea; potentially parts could be deleted.
131
+ compileOnly(" org.jetbrains:annotations:24.0.0" )
132
+ testImplementation(" org.jetbrains:annotations:24.0.0" )
133
+ testImplementation(" org.powermock:powermock-api-mockito2:2.0.9" )
134
+ testImplementation(" org.powermock:powermock-module-junit4:2.0.9" )
135
+ testImplementation(mapOf (" group" to " org.mockito" , " name" to " mockito-core" , " version" to " 5.2.0" ))
136
+
137
+ testRuntimeOnly(
138
+ fileTree(
139
+ mapOf (
140
+ " dir" to " ${project.rootDir} /artifacts/android-studio/plugins" ,
141
+ " include" to listOf (" **/*.jar" ),
142
+ " exclude" to listOf (" **/kotlin-compiler.jar" , " **/kotlin-plugin.jar" , " **/kotlin-stdlib-jdk8.jar" )
143
+ )
144
+ )
145
+ )
146
+ compileOnly(
147
+ fileTree(
148
+ mapOf (
149
+ " dir" to " ${project.rootDir} /artifacts/android-studio/lib" ,
150
+ " include" to listOf (" *.jar" ),
151
+ " exclude" to listOf (" **/annotations.jar" )
152
+ )
153
+ )
154
+ )
155
+ testRuntimeOnly(
156
+ fileTree(
157
+ mapOf (
158
+ " dir" to " ${project.rootDir} /artifacts/android-studio/lib" ,
159
+ " include" to listOf (" *.jar" )
160
+ )
161
+ )
162
+ )
163
+ compileOnly(
164
+ fileTree(
165
+ mapOf (
166
+ " dir" to " ${project.rootDir} /artifacts/android-studio/plugins/git4idea/lib" ,
167
+ " include" to listOf (" *.jar" )
168
+ )
169
+ )
170
+ )
171
+ testImplementation(
172
+ fileTree(
173
+ mapOf (
174
+ " dir" to " ${project.rootDir} /artifacts/android-studio/plugins/git4idea/lib" ,
175
+ " include" to listOf (" *.jar" )
176
+ )
177
+ )
178
+ )
179
+ compileOnly(" com.google.guava:guava:32.0.1-android" )
180
+ compileOnly(" com.google.code.gson:gson:2.10.1" )
181
+ testImplementation(" com.google.guava:guava:32.0.1-jre" )
182
+ testImplementation(" com.google.code.gson:gson:2.10.1" )
183
+ testImplementation(" junit:junit:4.13.2" )
184
+ runtimeOnly(
185
+ fileTree(
186
+ mapOf (
187
+ " dir" to " ${project.rootDir} /third_party/lib/jxbrowser" ,
188
+ " include" to listOf (" *.jar" )
189
+ )
190
+ )
191
+ )
192
+ compileOnly(
193
+ fileTree(
194
+ mapOf (
195
+ " dir" to " ${project.rootDir} /third_party/lib/jxbrowser" ,
196
+ " include" to listOf (" *.jar" )
197
+ )
198
+ )
199
+ )
200
+ testImplementation(
201
+ fileTree(
202
+ mapOf (
203
+ " dir" to " ${project.rootDir} /third_party/lib/jxbrowser" ,
204
+ " include" to listOf (" *.jar" )
205
+ )
206
+ )
207
+ )
208
+
209
+ compileOnly(
210
+ fileTree(
211
+ mapOf (
212
+ " dir" to " ${project.rootDir} /artifacts/android-studio/lib" ,
213
+ " include" to listOf (" *.jar" )
214
+ )
215
+ )
216
+ )
217
+ testImplementation(
218
+ fileTree(
219
+ mapOf (
220
+ " dir" to " ${project.rootDir} /artifacts/android-studio/lib" ,
221
+ " include" to listOf (" *.jar" )
222
+ )
223
+ )
224
+ )
225
+ compileOnly(
226
+ fileTree(
227
+ mapOf (
228
+ " dir" to " ${project.rootDir} /artifacts/android-studio/plugins" ,
229
+ " include" to listOf (" **/*.jar" ),
230
+ " exclude" to listOf (" **/kotlin-compiler.jar" , " **/kotlin-plugin.jar" )
231
+ )
232
+ )
233
+ )
234
+ testImplementation(
235
+ fileTree(
236
+ mapOf (
237
+ " dir" to " ${project.rootDir} /artifacts/android-studio/plugins" ,
238
+ " include" to listOf (" **/*.jar" ),
239
+ " exclude" to listOf (" **/kotlin-compiler.jar" , " **/kotlin-plugin.jar" )
240
+ )
241
+ )
242
+ )
149
243
}
150
244
151
245
@@ -195,6 +289,47 @@ intellijPlatform {
195
289
}
196
290
}
197
291
}
292
+
293
+ sourceSets {
294
+ main {
295
+ java.srcDirs(
296
+ listOf (
297
+ " flutter-idea/src" ,
298
+ " flutter-idea/third_party/vmServiceDrivers"
299
+ )
300
+ )
301
+ // Add kotlin.srcDirs if we start using Kotlin in the main plugin.
302
+ resources.srcDirs(
303
+ listOf (
304
+ " flutter-idea/src" ,
305
+ " flutter-idea/resources"
306
+ )
307
+ )
308
+ java.srcDirs(
309
+ listOf (
310
+ " flutter-studio/src" ,
311
+ " flutter-studio/third_party/vmServiceDrivers"
312
+ )
313
+ )
314
+ }
315
+ test {
316
+ java.srcDirs(
317
+ listOf (
318
+ " flutter-idea/src" ,
319
+ " flutter-idea/testSrc/unit" ,
320
+ " flutter-idea/third_party/vmServiceDrivers"
321
+ )
322
+ )
323
+ resources.srcDirs(
324
+ listOf (
325
+ " flutter-idea/resources" ,
326
+ " flutter-idea/testData" ,
327
+ " flutter-idea/testSrc/unit"
328
+ )
329
+ )
330
+ }
331
+ }
332
+
198
333
// Documentation for printProductsReleases:
199
334
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#how-to-check-the-latest-available-eap-release
200
335
tasks {
@@ -207,26 +342,20 @@ tasks {
207
342
productsReleases.get().max()
208
343
}
209
344
}
210
- }
211
-
212
- dependencies {
213
- implementation(project(" flutter-idea" ))
214
- if (ideaProduct == " android-studio" ) {
215
- implementation(project(" flutter-studio" ))
216
- }
217
- }
218
-
219
- tasks {
220
345
prepareJarSearchableOptions {
221
346
enabled = false
222
347
}
223
348
buildSearchableOptions {
224
349
enabled = false
225
350
}
226
- prepareSandbox {
227
- dependsOn(" :flutter-idea:prepareSandbox" )
228
- if (ideaProduct == " android-studio" ) {
229
- dependsOn(" :flutter-studio:prepareSandbox" )
351
+ test {
352
+ useJUnit()
353
+ testLogging {
354
+ showCauses = true
355
+ showStackTraces = true
356
+ showStandardStreams = true
357
+ exceptionFormat = TestExceptionFormat .FULL
358
+ events(" skipped" , " failed" )
230
359
}
231
360
}
232
361
}
0 commit comments