44 * found in the LICENSE file.
55 */
66
7+ import okhttp3.internal.immutableListOf
78import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
89import org.jetbrains.intellij.platform.gradle.TestFrameworkType
910import org.jetbrains.intellij.platform.gradle.models.ProductRelease
1011import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
1112import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1213import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
14+ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
1315
1416// Specify UTF-8 for all compilations so we avoid Windows-1252.
1517allprojects {
@@ -36,24 +38,18 @@ plugins {
3638 id(" org.jetbrains.kotlin.jvm" ) version " 2.1.21-RC2"
3739}
3840
39- // TODO(mossmana) These properties are duplicated in flutter-idea/build.gradle.kts and flutter-studio/build.gradle.kts. Should be consolidated.
4041val flutterPluginVersion = providers.gradleProperty(" flutterPluginVersion" ).get()
41- val ideaProduct = providers.gradleProperty(" ideaProduct" ).get()
4242val ideaVersion = providers.gradleProperty(" ideaVersion" ).get()
4343val 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()
4644val sinceBuildInput = providers.gradleProperty(" sinceBuild" ).get()
4745val untilBuildInput = providers.gradleProperty(" untilBuild" ).get()
4846val javaVersion = providers.gradleProperty(" javaVersion" ).get()
4947group = " io.flutter"
5048
5149// For debugging purposes:
5250println (" flutterPluginVersion: $flutterPluginVersion " )
53- println (" ideaProduct: $ideaProduct " )
5451println (" ideaVersion: $ideaVersion " )
5552println (" dartPluginVersion: $dartPluginVersion " )
56- println (" androidPluginVersion: $androidPluginVersion " )
5753println (" sinceBuild: $sinceBuildInput " )
5854println (" untilBuild: $untilBuildInput " )
5955println (" javaVersion: $javaVersion " )
@@ -87,7 +83,7 @@ javaCompatibilityVersion = when (javaVersion) {
8783 }
8884
8985 " 21" -> {
90- JavaVersion .VERSION_21
86+ JavaVersion .VERSION_21 // all later versions of java can build against the earlier versions
9187 }
9288
9389 else -> {
@@ -103,20 +99,13 @@ dependencies {
10399 intellijPlatform {
104100 // Documentation on the default target platform methods:
105101 // 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)
115103 testFramework(TestFrameworkType .Platform )
116104
117105 // Plugin dependency documentation:
118106 // 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(
120109 " com.google.tools.ij.aiplugin" ,
121110 " com.intellij.java" ,
122111 " com.intellij.properties" ,
@@ -125,27 +114,132 @@ dependencies {
125114 " org.jetbrains.kotlin" ,
126115 " org.jetbrains.plugins.gradle" ,
127116 " 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 " )
142122
143123 if (sinceBuildInput == " 243" || sinceBuildInput == " 251" ) {
144124 bundledModule(" intellij.platform.coverage" )
145125 bundledModule(" intellij.platform.coverage.agent" )
146126 }
147127 pluginVerifier()
148128 }
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+ )
149243}
150244
151245
@@ -195,6 +289,47 @@ intellijPlatform {
195289 }
196290 }
197291}
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+
198333// Documentation for printProductsReleases:
199334// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#how-to-check-the-latest-available-eap-release
200335tasks {
@@ -207,26 +342,20 @@ tasks {
207342 productsReleases.get().max()
208343 }
209344 }
210- }
211-
212- dependencies {
213- implementation(project(" flutter-idea" ))
214- if (ideaProduct == " android-studio" ) {
215- implementation(project(" flutter-studio" ))
216- }
217- }
218-
219- tasks {
220345 prepareJarSearchableOptions {
221346 enabled = false
222347 }
223348 buildSearchableOptions {
224349 enabled = false
225350 }
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" )
230359 }
231360 }
232361}
0 commit comments