-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
323 lines (295 loc) · 12 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// 当前最新开发环境:gradle-7.5.1
plugins {
id 'java'
/*
Gradle-IntelliJ-Plugin 'org.jetbrains.intellij' 的设置说明:
1. Gradle-IntelliJ-Plugin'org.jetbrains.intellij' 版本升级说明:
- build plugin for 2022.1 ,'org.jetbrains.intellij' 需要使用 1.5.3+ 版本(同时需要升级 gradle 版本到 7.* 以上,JDK 版本至 11)
- build plugin for 2022.2.3 ,'org.jetbrains.intellij' 需要使用 1.13.3+ 版本(同时需要升级 gradle 版本到 7.* 以上,JDK 版本至 17)
2. 若使用本地默认的 gradle ,请手动切换 gradle 到特定版本
3. 当前项目默认使项目根目录下 gradle/wrapper/gradle-wrapper.properties 中指定的 gradle 版本,更改当前项目的 gradle 版本的便捷方法是:修改 gradle-wrapper.properties 中 distributionUrl(目标gradle下载地址)
- 使用 gradle-5.2.1:distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
- 使用 gradle-7.5.1:distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
4. 当前项目使用的 JDK 版本设置:Preferences | Build, Execution, Deployment | Build Tools | Gradle,Gradle JVM 设置对应版本 JDK
*/
// id 'org.jetbrains.intellij' version '0.4.16' // gradle 6.7
// id 'org.jetbrains.intellij' version '1.12.0' // gradle 7.5.1
id 'org.jetbrains.intellij' version '1.13.3' // gradle 7.5.1
}
// 插件需要支持的 IntelliJ IDEA Community Edition平台版本
// 平台版本使用其 branch_number 作为区分
// 关于`branch_number`的更多细节,可参考 https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
enum PlatformType {
// Android Studio 3.5
IC_191 ('191'),
// Android Studio 3.6
IC_192 ('192'),
// Android Studio 4.0
IC_193 ('193'),
// Android Studio 4.1
IC_201 ('201'),
// Android Studio 4.2
IC_202 ('202'),
// Android Studio - Arctic Fox | 2020.3.1
IC_203 ('203'),
// Android Studio Bumblebee | 2021.1.1
IC_211 ('211'),
// Android Studio Chipmunk | 2021.2.1
IC_212 ('212'),
// Android Studio Dolphin | 2021.3.1
IC_213 ('213'),
// Android Studio Electric Eel | 2022.1.1
IC_221 ('221'),
// Android Studio Flamingo | 2022.2.1
IC_222 ('222'),
// Android Studio Giraffe | 2022.3.1
IC_223 ('223'),
// Android Studio Hedgehog | 2023.1.1
IC_231 ('231'),
final String branchNumber
PlatformType(String branchNumber) {
this.branchNumber = branchNumber
}
String getBranchNumber() {
return this.branchNumber
}
String toString(){
'IC-' + branchNumber
}
}
// flr-plugin-engine 的版本号
// 关于其介绍,可看文档《flr_plugin_workflow》(注:文档中使用的字段为 plugin_engine_version)
// 该值在完成一个新版本的 flr-plugin-engine 开发后,手动更新
String pluginEngineVersion = '3.3.1'
// 用于开发 flr-plugin-engine 时使用平台版本
// 一般使用最新平台版本
PlatformType pluginEnginePlatform = PlatformType.IC_231
// 用于开发 flr-plugin 时使用平台版本
// 该值在切换到 platform-master 分支后,手动更新
// 如切换到 191-master 分支后,该值更新为 PlatformType.IC_191
PlatformType pluginProductPlatform = pluginEnginePlatform
// 指定JDK版本
// JDK8: '1.8'or'8'
// JDK11: '11' (IDEA 2020.2 版本开始使用JDK11)
sourceCompatibility = '8'
switch (pluginProductPlatform) {
// Config for Android Studio 3.5
case PlatformType.IC_191:
// Config for Android Studio 3.6
case PlatformType.IC_192:
// Config for Android Studio 4.0
case PlatformType.IC_193:
// Config for Android Studio 4.1
case PlatformType.IC_201:
sourceCompatibility = '8'
break
// Config for Android Studio 4.2
case PlatformType.IC_202:
// Config for Android Studio - Arctic Fox | 2020.3.1
case PlatformType.IC_203:
// Config for Android Studio Bumblebee | 2021.1.1
case PlatformType.IC_211:
// Config for Android Studio Chipmunk | 2021.2.1
case PlatformType.IC_212:
// Config for Android Studio Dolphin | 2021.3.1
case PlatformType.IC_213:
// Config for Android Studio Electric Eel | 2022.1.1
case PlatformType.IC_221:
sourceCompatibility = '11'
break
// Config for Android Studio Flamingo | 2022.2.1
case PlatformType.IC_222:
// Config for Android Studio Giraffe | 2022.3.1
case PlatformType.IC_223:
// Config for Android Studio Hedgehog | 2023.1.1
case PlatformType.IC_231:
sourceCompatibility = '17'
break
}
println "flr-as-plugin 构建配置信息如下:"
println " - PluginProductPlatform: ${pluginProductPlatform}"
println " - SourceCompatibility: JDK${sourceCompatibility}"
// flr-plugin 的版本号
// 关于其介绍,可看文档《flr_plugin_workflow》(注:文档中使用的字段为 plugin_product_version)
//
// plugin_product_version = #{IC_branch_number}.#{plugin_engine_version}
//
// example:
// IC_branch_number = 191
// plugin_engine_version = 1.0.0
// plugin_product_version = 191.1.0.0
//
String pluginProductVersion = pluginProductPlatform.branchNumber + '.' + pluginEngineVersion
// 打包文件的基本名称
// example: flr-as-plugin-191.1.0.0
archivesBaseName = rootProject.name + '-' + pluginProductVersion
repositories {
mavenCentral()
}
dependencies {
/*
gradle7 适配说明:
- compile 函数名需要改为 implementation
- testCompile 函数名需要改为 testImplementation
*/
// testCompile group: 'junit', name: 'junit', version: '4.12'
// compile group: 'org.yaml', name: 'snakeyaml', version: '1.26'
testImplementation group: 'junit', name: 'junit', version: '4.12'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.26'
}
// See https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
// Get platformVersion with Build#AI-Version of Android Studio from https://www.jetbrains.com/idea/download/other.html
intellij {
String platformVersion = null
List platformPlugins = null
switch (pluginProductPlatform) {
// Config for Android Studio 3.5
case PlatformType.IC_191:
platformVersion = '2019.1.4'
platformPlugins = ['Dart:191.8593', 'io.flutter:43.0.1']
break
// Config for Android Studio 3.6
case PlatformType.IC_192:
platformVersion = '2019.2.4'
platformPlugins = ['Dart:192.7761', 'io.flutter:43.0.2']
break
// Config for Android Studio 4.0
case PlatformType.IC_193:
platformVersion = '2019.3.3'
platformPlugins = ['Dart:193.7361', 'io.flutter:45.1.2']
break
// Config for Android Studio 4.1
case PlatformType.IC_201:
platformVersion = '2020.1.4'
platformPlugins = ['Dart:201.9002', 'io.flutter:50.0.2']
break
// Config for Android Studio 4.2
case PlatformType.IC_202:
platformVersion = '2020.2.3'
platformPlugins = ['Dart:202.8488', 'io.flutter:56.0.2']
break
// Config for Android Studio - Arctic Fox | 2020.3.1
case PlatformType.IC_203:
platformVersion = '2020.3.1'
platformPlugins = ['Dart:203.8292', 'io.flutter:59.0.2']
break
// Config for Android Studio Bumblebee | 2021.1.1
case PlatformType.IC_211:
platformVersion = '2021.1'
platformPlugins = ['Dart:211.7798', 'io.flutter:64.1.2']
break
// Config for Android Studio Chipmunk | 2021.2.1
case PlatformType.IC_212:
platformVersion = '2021.2.3'
platformPlugins = ['Dart:212.5744', 'io.flutter:67.1.2']
break
// Config for Android Studio Dolphin | 2021.3.1
case PlatformType.IC_213:
platformVersion = '2021.3.2'
platformPlugins = ['Dart:213.7371', 'io.flutter:70.0.3']
break
// Config for Android Studio Electric Eel | 2022.1.1
case PlatformType.IC_221:
platformVersion = '2022.1.4'
platformPlugins = ['java', 'Dart:221.6096', 'io.flutter:71.2.4']
break
// Config for Android Studio Flamingo | 2022.2.1
case PlatformType.IC_222:
platformVersion = '2022.2.4'
platformPlugins = ['java', 'Dart:222.4582', 'io.flutter:73.0.2']
break
// Config for Android Studio Giraffe | 2022.3.1
case PlatformType.IC_223:
platformVersion = '2022.3.3'
platformPlugins = ['java', 'Dart:223.8950', 'io.flutter:73.0.3']
break
// Config for Android Studio Hedgehog | 2023.1.1
case PlatformType.IC_231:
platformVersion = '2023.1.5'
platformPlugins = ['java', 'Dart:231.9402', 'io.flutter:77.1.2']
break
}
assert(platformVersion != null && platformPlugins != null)
version = platformVersion
plugins = platformPlugins
/*
* Use this property if you want to test your plugin in any non-IDEA JetBrains IDE such as WebStorm or Android Studio.
*
* See https://github.com/JetBrains/gradle-intellij-plugin#rundebug-ide-properties
* */
//alternativeIdePath '/Applications/Android Studio.app'
}
// See https://github.com/JetBrains/gradle-intellij-plugin#patching-dsl
patchPluginXml {
// 设置插件的版本号
version = pluginProductVersion
// 设置插件描述
pluginDescription = """
<p>Flr (Flutter-R): A Flutter Resource Manager Android Studio Plugin, which can help flutter developer to auto specify assets in pubspec.yaml and generate r.g.dart file.</p>
<br>
<p>You can get more details from:</p>
<ul>
<li><a href="https://github.com/Fly-Mix/flr-as-plugin">Flr GitHub Repository</a></li>
<li><a href="https://plugins.jetbrains.com/plugin/13789-flr/">Flr Plugin Homepage</a></li>
</ul>
"""
/*
* 插件兼容IDEA的最小版本号和最大版本号
* 详细可参考:
* - https://github.com/JetBrains/gradle-intellij-plugin#patching-dsl
* - http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
* */
sinceBuild = pluginProductPlatform.branchNumber
//untilBuild = '191.*'
/*
* 设置版本更新日志
* 注意:最新版本号的标题样式为h3,其他版本号的标题样式为h4
*/
changeNotes = """
<h2>Flr Plugin Change Notes</h2>
<br/>
<h2>Flr Plugin Engine Change Notes</h2>
<h3>3.3.1</h3>
<ul>
<li>Fix bug</li>
</ul>
<h4>3.3.0</h4>
<ul>
<li>Support for nullsafety-feature of Dart 2.12</li>
</ul>
<h4>3.2.0</h4>
<ul>
<li>Add pubspec.yaml file tree view</li>
</ul>
<h4>3.1.0</h4>
<ul>
<li>Support for processing(init/generate/monitor) multi projects(the main project and its sub projects in one workspace)</li>
<li>Support for auto merging old asset specifications when specifying new assets</li>
</ul>
<h4>3.0.0</h4>
<ul>
<li>Support for processing non-implied resource file which is outside of "lib/" directory (such as "~/path/to/flutter_r_demo/assets/images/test.png")</li>
<li>New recommended flutter resource structure</li>
</ul>
<h4>2.0.0</h4>
<ul>
<li>New asset generation algorithm to support all kinds of standard or nonstandard image/text resource structure</li>
<li>New asset-id generation algorithm to support assets with the same filename but different path</li>
<li>New recommended flutter resource structure</li>
</ul>
<h4>1.1.0</h4>
<ul>
<li>Improve generate-capability to support nonstandard image resource structure</li>
<li>Add recommend-capability to display the recommended flutter resource structure</li>
</ul>
<h4>1.0.0</h4>
<ul>
<li>Automatically specify assets in pubspec.yaml and generate r.g.dart file</li>
<li>Support for processing image assets (.png, .jpg, .jpeg, .gif, .webp, .icon, .bmp, .wbmp, .svg)</li>
<li>Support for processing image asset variants</li>
<li>Support for processing text assets (.txt, .json, .yaml, .xml)</li>
<li>Support for processing font assets (.ttf, .otf, .ttc)</li>
<li>Improve robustness</li>
</ul>
"""
}