1
1
/*
2
- * Copyright 2019 The Chromium Authors. All rights reserved.
2
+ * Copyright 2024 The Chromium Authors. All rights reserved.
3
3
* Use of this source code is governed by a BSD-style license that can be
4
4
* found in the LICENSE file.
5
5
*/
6
6
7
- buildscript {
8
- repositories {
9
- mavenCentral()
10
- maven {
11
- url= uri(" https://www.jetbrains.com/intellij-repository/snapshots/" )
12
- }
13
- maven {
14
- url= uri(" https://oss.sonatype.org/content/repositories/snapshots/" )
15
- }
16
- maven {
17
- url= uri(" https://www.jetbrains.com/intellij-repository/releases" )
18
- }
19
- gradlePluginPortal()
20
- }
21
- }
22
-
23
- plugins {
24
- id(" org.jetbrains.intellij" ) version " 1.17.3"
25
- id(" org.jetbrains.kotlin.jvm" ) version " 2.0.0"
26
- }
27
-
28
- repositories {
29
- mavenLocal()
30
- mavenCentral()
31
- maven {
32
- url= uri(" https://www.jetbrains.com/intellij-repository/snapshots/" )
33
- }
34
- maven {
35
- url= uri(" https://oss.sonatype.org/content/repositories/snapshots/" )
36
- }
37
- maven {
38
- url= uri(" https://www.jetbrains.com/intellij-repository/releases" )
39
- }
40
- }
7
+ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
8
+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
9
+ import org.jetbrains.intellij.platform.gradle.models.ProductRelease
10
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
11
+ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
41
12
42
13
// Specify UTF-8 for all compilations so we avoid Windows-1252.
43
14
allprojects {
@@ -49,81 +20,158 @@ allprojects {
49
20
}
50
21
}
51
22
52
- val ide: String by project
53
- val flutterPluginVersion: String by project
54
- val javaVersion: String by project
55
- val androidVersion: String by project
56
- val dartVersion: String by project
57
- val baseVersion: String by project
58
- val name: String by project
59
- val buildSpec: String by project
60
- val smaliPlugin: String by project
61
- val langPlugin: String by project
62
- val ideVersion: String by project
23
+ repositories {
24
+ mavenCentral()
25
+ intellijPlatform {
26
+ defaultRepositories()
27
+ }
28
+ }
29
+
30
+ plugins {
31
+ // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html
32
+ // https://github.com/JetBrains/intellij-platform-gradle-plugin/releases
33
+ id(" org.jetbrains.intellij.platform" ) version " 2.1.0"
34
+ id(" org.jetbrains.kotlin.jvm" ) version " 2.0.0"
35
+ }
63
36
37
+ val flutterPluginVersion = providers.gradleProperty(" flutterPluginVersion" ).get()
38
+ val ideaProduct = providers.gradleProperty(" ideaProduct" ).get()
39
+ val ideaVersion = providers.gradleProperty(" ideaVersion" ).get()
40
+ val dartPluginVersion = providers.gradleProperty(" dartPluginVersion" ).get()
41
+ // The Android Plugin version is only used if the ideaProduct is not "android-studio"
42
+ val androidPluginVersion = providers.gradleProperty(" androidPluginVersion" ).get()
43
+ val sinceBuildInput = providers.gradleProperty(" sinceBuild" ).get()
44
+ val untilBuildInput = providers.gradleProperty(" untilBuild" ).get()
64
45
group = " io.flutter"
65
- version = flutterPluginVersion
66
46
47
+ // For debugging purposes:
48
+ println (" flutterPluginVersion: $flutterPluginVersion " )
49
+ println (" ideaProduct: $ideaProduct " )
50
+ println (" ideaVersion: $ideaVersion " )
51
+ println (" dartPluginVersion: $dartPluginVersion " )
52
+ println (" androidPluginVersion: $androidPluginVersion " )
53
+ println (" sinceBuild: $sinceBuildInput " )
54
+ println (" untilBuild: $untilBuildInput " )
55
+ println (" group: $group " )
56
+
57
+ kotlin {
58
+ compilerOptions {
59
+ apiVersion.set(KotlinVersion .KOTLIN_1_9 )
60
+ jvmTarget = JvmTarget .JVM_17
61
+ }
62
+ }
63
+ val javaCompatibilityVersion = JavaVersion .VERSION_17
67
64
java {
68
- sourceCompatibility = JavaVersion .toVersion(javaVersion)
69
- targetCompatibility = JavaVersion .toVersion(javaVersion)
65
+ sourceCompatibility = javaCompatibilityVersion
66
+ targetCompatibility = javaCompatibilityVersion
70
67
}
71
68
72
- intellij {
73
- pluginName.set(name)
74
- // This adds nullability assertions, but also compiles forms.
75
- instrumentCode.set(true )
76
- updateSinceUntilBuild.set(false )
77
- version.set(ideVersion)
78
- downloadSources.set(false )
79
- val pluginList = mutableListOf (
80
- project(" :flutter-idea" ), " java" , " properties" ,
81
- " junit" , " Git4Idea" , " Kotlin" , " gradle" ,
82
- " Groovy" , " Dart:$dartVersion " )
69
+ dependencies {
70
+ intellijPlatform {
71
+ if (ideaProduct == " android-studio" ) {
72
+ create(IntelliJPlatformType .AndroidStudio , ideaVersion)
73
+ } else {// if (ide == "ideaIC") {
74
+ create(IntelliJPlatformType .IntellijIdeaCommunity , ideaVersion)
75
+ }
76
+ testFramework(TestFrameworkType .Platform )
77
+ val bundledPluginList = mutableListOf (
78
+ " com.intellij.java" ,
79
+ " com.intellij.properties" ,
80
+ " JUnit" ,
81
+ " Git4Idea" ,
82
+ " org.jetbrains.kotlin" ,
83
+ " org.jetbrains.plugins.gradle" ,
84
+ " org.intellij.intelliLang" ,
85
+ )
86
+ if (ideaProduct == " android-studio" ) {
87
+ bundledPluginList.add(" org.jetbrains.android" )
88
+ bundledPluginList.add(" com.android.tools.idea.smali" )
89
+ }
90
+ val pluginList = mutableListOf (" Dart:$dartPluginVersion " )
91
+ if (ideaProduct == " IC" ) {
92
+ pluginList.add(" org.jetbrains.android:$androidPluginVersion " )
93
+ }
83
94
84
- // If 2023.3+ and IDEA (not AS), then "org.jetbrains.android:$androidVersion", otherwise "org.jetbrains.android",
85
- // see https://github.com/flutter/flutter-intellij/issues/7145
86
- if (ide == " android-studio" ) {
87
- pluginList.add(" org.jetbrains.android" )
88
- } else if (ide == " ideaIC" ) {
89
- pluginList.add(" org.jetbrains.android:$androidVersion " )
90
- }
95
+ // Finally, add the plugins into their respective lists:
96
+ // https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#project-setup
97
+ bundledPlugins(bundledPluginList)
98
+ plugins(pluginList)
91
99
92
- if (ide == " android-studio " ) {
93
- pluginList.add(smaliPlugin)
94
- }
95
- pluginList.add(langPlugin)
96
- if (ide == " android-studio " ) {
97
- type.set( " AI " )
98
- pluginList + = listOf (project( " :flutter-studio " ) )
100
+ // The warning that "instrumentationTools()" is deprecated might be valid, however, this error is produced by Gradle IJ plugin version
101
+ // 2.1.0 if this isn't included:
102
+ // Caused by: org.gradle.api.GradleException: No Java Compiler dependency found.
103
+ // Please ensure the `instrumentationTools()` entry is present in the project dependencies section along with the `intellijDependencies()` entry in the repositories section.
104
+ // See: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
105
+ instrumentationTools( )
106
+ // pluginVerifier( )
99
107
}
100
- plugins.set(pluginList)
101
108
}
109
+ // intellijPlatform {
110
+ // pluginConfiguration {
111
+ // version = flutterPluginVersion
112
+ // ideaVersion {
113
+ // sinceBuild = sinceBuildInput
114
+ // untilBuild = untilBuildInput
115
+ // }
116
+ // }
117
+ // // TODO (jwren) get the verifier to work, and enable in the github presubmit,
118
+ // // the com.teamdev dep is having the verifier fail
119
+ // // Verifier documentation: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification-ides
120
+ // pluginVerification {
121
+ // // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#mutePluginVerifierProblems
122
+ // freeArgs = listOf(
123
+ // "-mute",
124
+ // "TemplateWordInPluginId"
125
+ // )
126
+ // ides {
127
+ // if (ideaProduct == "android-studio") {
128
+ // ide(IntelliJPlatformType.AndroidStudio, ideaVersion)
129
+ // } else {
130
+ // ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
131
+ // }
132
+ // recommended()
133
+ // // select {
134
+ // // types = listOf(IntelliJPlatformType.AndroidStudio)
135
+ // // channels = listOf(ProductRelease.Channel.RELEASE)
136
+ // // sinceBuild = sinceBuildInput
137
+ // // untilBuild = untilBuildInput
138
+ // // }
139
+ // }
140
+ // }
141
+ // }
102
142
143
+ // Documentation for printProductsReleases:
144
+ // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#how-to-check-the-latest-available-eap-release
103
145
tasks {
104
- buildSearchableOptions {
105
- enabled = false
106
- }
107
- prepareSandbox {
108
- dependsOn( " :flutter-idea:prepareSandbox " )
109
- if (ide == " android-studio " ) {
110
- dependsOn( " :flutter-studio:prepareSandbox " )
146
+ printProductsReleases {
147
+ channels = listOf ( ProductRelease . Channel . EAP )
148
+ types = listOf ( IntelliJPlatformType . IntellijIdeaCommunity )
149
+ untilBuild = provider { null }
150
+
151
+ doLast {
152
+ productsReleases.get().max( )
111
153
}
112
154
}
113
155
}
114
156
115
157
dependencies {
116
- implementation(project(" flutter-idea" , " instrumentedJar " )) // Second arg is required to use forms
117
- if (ide == " android-studio" ) {
158
+ implementation(project(" flutter-idea" ))
159
+ if (ideaProduct == " android-studio" ) {
118
160
implementation(project(" flutter-studio" ))
119
161
}
120
162
}
121
163
122
164
tasks {
123
- instrumentCode {
124
- compilerVersion.set(baseVersion)
165
+ prepareJarSearchableOptions {
166
+ enabled = false
167
+ }
168
+ buildSearchableOptions {
169
+ enabled = false
125
170
}
126
- instrumentTestCode {
127
- compilerVersion.set(baseVersion)
171
+ prepareSandbox {
172
+ dependsOn(" :flutter-idea:prepareSandbox" )
173
+ if (ideaProduct == " android-studio" ) {
174
+ dependsOn(" :flutter-studio:prepareSandbox" )
175
+ }
128
176
}
129
- }
177
+ }
0 commit comments