Skip to content

Commit 0078252

Browse files
author
YangLang
committed
优化线程模型
1 parent 5bf4c30 commit 0078252

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+189
-226
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ doc/node_modules/
1111
doc/nohup.out
1212
doc/README.md
1313
local.properties
14+
.intellijPlatform

CHANGELOG.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,62 @@
22

33
## [未完待续]
44

5-
###
5+
## 4.1.7 - 2024-08-24
66

7-
## [4.1.6] - 2024-08-17
7+
- `Base`: 优化线程模型
8+
9+
## 4.1.6 - 2024-08-17
810

911
- `Base`: 修复 `modify PSI for non-committed Document`
1012

11-
## [4.1.5] - 2024-08-10
13+
## 4.1.5 - 2024-08-10
1214

1315
- `Flutter Resource`: 优化资源列表预览尺寸
1416

15-
## [4.1.4] - 2024-08-03
17+
## 4.1.4 - 2024-08-03
1618

1719
- `Base`: 调整R文件创建逻辑
1820
- `Base`: 优化 `fromJson``toJson`
1921

20-
## [4.1.3] - 2024-06-30
22+
## 4.1.3 - 2024-06-30
2123

2224
- `Base`: 优化资源检测逻辑
2325

24-
## [4.1.2] - 2024-06-24
26+
## 4.1.2 - 2024-06-24
2527

2628
- `Base`: UI 优化
2729
- `Flutter Resource`: 交互细调整
2830

29-
## [4.1.1] - 2024-06-17
31+
## 4.1.1 - 2024-06-17
3032

3133
- `Base`: 调整部分UI布局
3234
- `Base`: 优化R资源生成机制
3335
- `Base`: 修复windows平台乱码问题
3436

35-
## [4.0.4] - 2024-05-03
37+
## 4.0.4 - 2024-05-03
3638

3739
- `Code`: 兼容223以后版本(ActionUpdateThread)
3840

39-
## [4.0.3] - 2024-04-15
41+
## 4.0.3 - 2024-04-15
4042

4143
- `Code`: 生成的R资源类构造函数私有化
4244
- `Dart Code`: 优化`LiveTemplate`配置
4345

44-
## [4.0.2] - 2024-04-2
46+
## 4.0.2 - 2024-04-2
4547

4648
- `Flutter Resource`: 优化图片压缩引导弹窗逻辑
4749
- `Repo Mirror`: 调整镜像配置UI && 拆分镜像注册方式(项目注入、插件注入、Flutter Gradle脚本注入)
4850

49-
## [4.0.1] - 2024-03-12
51+
## 4.0.1 - 2024-03-12
5052

5153
- `Base`: Bug修复 & 更新文档地址
5254

53-
## [4.0.0] - 2024-01-16
55+
## 4.0.0 - 2024-01-16
5456

5557
- `Flutter Resource`: 添加资源图片时,新增压缩引导弹窗
5658
- `Code`: 修复以目录的方式注册资源,R文件不更新Bug
5759
- `Base`: 解决切换分支时,图片大小检测弹窗频繁弹出Bug
5860

59-
## [3.0.6] - 2024-01-13
61+
## 3.0.6 - 2024-01-13
6062

61-
- `Base`: 代码优化
63+
- `Base`: 代码优化

build.gradle.kts

Lines changed: 69 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
1+
import org.jetbrains.changelog.Changelog
12
import org.jetbrains.changelog.date
23
import org.jetbrains.changelog.markdownToHTML
3-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4-
5-
fun properties(key: String) = project.findProperty(key).toString()
64

75
plugins {
8-
// Java support
96
id("java")
10-
// Kotlin support
11-
id("org.jetbrains.kotlin.jvm") version "1.5.30"
12-
// Gradle IntelliJ Plugin
13-
id("org.jetbrains.intellij") version "1.11.0"
14-
// Gradle Changelog Plugin
15-
id("org.jetbrains.changelog") version "1.3.0"
16-
// Gradle Qodana Plugin
17-
id("org.jetbrains.qodana") version "0.1.12"
7+
id("org.jetbrains.changelog") version "2.2.1"
8+
id("org.jetbrains.intellij.platform") version "2.0.1"
189
}
1910

20-
group = properties("pluginGroup")
21-
version = properties("pluginVersion")
22-
23-
// Configure project's dependencies
2411
repositories {
2512
mavenCentral()
13+
intellijPlatform {
14+
defaultRepositories()
15+
}
2616
}
2717

2818
dependencies {
@@ -32,107 +22,92 @@ dependencies {
3222
implementation("com.twelvemonkeys.imageio:imageio-webp:3.10.1")
3323
implementation("com.twelvemonkeys.imageio:imageio-batik:3.10.1")
3424
implementation("com.tinify:tinify:1.8.3")
35-
}
3625

37-
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
38-
intellij {
39-
pluginName.set(properties("pluginName"))
40-
version.set(properties("platformVersion"))
41-
type.set(properties("platformType"))
42-
downloadSources.set(properties("platformDownloadSources").toBoolean())
43-
updateSinceUntilBuild.set(false)
44-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
45-
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
26+
intellijPlatform {
27+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
28+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
29+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
30+
31+
instrumentationTools()
32+
pluginVerifier()
33+
zipSigner()
34+
}
4635
}
4736

48-
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
4937
changelog {
50-
version.set(properties("pluginVersion"))
51-
path.set("${project.projectDir}/CHANGELOG.md")
38+
version.set(providers.gradleProperty("pluginVersion"))
39+
path.set(file("CHANGELOG.md").canonicalPath)
5240
header.set(provider { "[${version.get()}] - ${date()}" })
41+
headerParserRegex.set("""(\d+\.\d+\.\d+)""".toRegex())
5342
itemPrefix.set("-")
5443
keepUnreleasedSection.set(true)
5544
unreleasedTerm.set("[未完待续]")
5645
groups.set(listOf(""))
5746
}
5847

59-
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
60-
qodana {
61-
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
62-
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
63-
saveReport.set(true)
64-
showReport.set(System.getenv("QODANA_SHOW_REPORT").toBoolean())
65-
}
48+
intellijPlatform {
49+
pluginConfiguration {
50+
version = providers.gradleProperty("pluginVersion")
51+
description = providers.fileContents(layout.projectDirectory.file("PLUGIN_DESC.md")).asText.map {
52+
val start = "<!-- Plugin description -->"
53+
val end = "<!-- Plugin description end -->"
6654

67-
tasks {
68-
// Set the JVM compatibility versions
69-
properties("javaVersion").let {
70-
withType<JavaCompile> {
71-
sourceCompatibility = it
72-
targetCompatibility = it
55+
with(it.lines()) {
56+
if (!containsAll(listOf(start, end))) {
57+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
58+
}
59+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
60+
}
61+
}
62+
ideaVersion {
63+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
64+
untilBuild = provider { null }
7365
}
74-
withType<KotlinCompile> {
75-
kotlinOptions.jvmTarget = it
66+
val changelog = project.changelog
67+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
68+
with(changelog) {
69+
renderItem(
70+
(getOrNull(pluginVersion) ?: getUnreleased())
71+
.withHeader(false)
72+
.withEmptySections(false),
73+
Changelog.OutputType.HTML,
74+
)
75+
}
7676
}
7777
}
78-
79-
wrapper {
80-
gradleVersion = properties("gradleVersion")
78+
signing {
79+
certificateChainFile.set(project.file("profiles/chain.crt"))
80+
privateKeyFile.set(project.file("profiles/private.pem"))
81+
password.set(providers.environmentVariable("PRIVATE_KEY_PASSWORD"))
8182
}
82-
83-
patchPluginXml {
84-
version.set(properties("pluginVersion"))
85-
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
86-
pluginDescription.set(
87-
projectDir.resolve("PLUGIN_DESC.md").readText().lines().run {
88-
val start = "<!-- Plugin description -->"
89-
val end = "<!-- Plugin description end -->"
90-
91-
if (!containsAll(listOf(start, end))) {
92-
throw GradleException("Plugin description section not found in PLUGIN_DESC.md:\n$start ... $end")
93-
}
94-
subList(indexOf(start) + 1, indexOf(end))
95-
}.joinToString("\n").run { markdownToHTML(this) }
96-
)
97-
98-
// Get the latest available change notes from the changelog file
99-
changeNotes.set(provider {
100-
changelog.run {
101-
getOrNull(properties("pluginVersion")) ?: getLatest()
102-
}.toHTML()
103-
})
83+
publishing {
84+
token = providers.environmentVariable("PUBLISH_TOKEN")
85+
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
10486
}
105-
106-
runPluginVerifier {
107-
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
87+
pluginVerification {
88+
ides {
89+
recommended()
90+
}
10891
}
92+
}
10993

110-
// Configure UI tests plugin
111-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
112-
runIdeForUiTests {
113-
systemProperty("robot-server.port", "8082")
114-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
115-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
116-
systemProperty("jb.consents.confirmation.enabled", "false")
94+
intellijPlatformTesting {
95+
runIde {
96+
register("runOnAndroidStudio") {
97+
localPath = file(providers.gradleProperty("idePath"))
98+
prepareSandboxTask {
99+
sandboxDirectory = project.layout.buildDirectory.dir("sandbox-as")
100+
}
101+
}
117102
}
103+
}
118104

119-
signPlugin {
120-
certificateChainFile.set(project.file("profiles/chain.crt"))
121-
privateKeyFile.set(project.file("profiles/private.pem"))
122-
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
105+
tasks {
106+
wrapper {
107+
gradleVersion = providers.gradleProperty("gradleVersion").get()
123108
}
124109

125110
publishPlugin {
126-
// dependsOn("patchChangelog")
127-
token.set(System.getenv("PUBLISH_TOKEN"))
128-
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
129-
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
130-
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
131-
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
132-
}
133-
134-
runIde {
135-
// jbrVersion.set("11_0_10b1145.115")
136-
ideDir.set(file(properties("idePath")))
111+
dependsOn(patchChangelog)
137112
}
138113
}

gradle.properties

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
# IntelliJ Platform Artifacts Repositories
2-
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
3-
pluginGroup=com.xtu.plugin
41
pluginName=iFlutter
5-
pluginVersion=4.1.6
6-
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
7-
# See https://jb.gg/intellij-platform-builds-list for available build versions.
8-
pluginVerifierIdeVersions=2022.3.1
2+
pluginVersion=4.1.7
3+
gradleVersion=17
4+
pluginSinceBuild=223
95
platformType=IC
106
platformVersion=2024.1.1
11-
#idePath=/Applications/Android Studio.app/Contents
12-
idePath=C:\\Program Files\\Android\\Android Studio
13-
platformDownloadSources=true
14-
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
15-
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
16-
platformPlugins=java,org.intellij.groovy,org.jetbrains.plugins.yaml:241.14494.150,Dart:241.18808,io.flutter:81.0.2
17-
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
18-
javaVersion=17
19-
gradleVersion=7.3
20-
# Opt-out flag for bundling Kotlin standard library.
21-
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
22-
# suppress inspection "UnusedProperty"
23-
kotlin.stdlib.default.dependency=false
7+
idePath=/Applications/Android Studio.app/Contents
8+
#idePath=C:\\Program Files\\Android\\Android Studio
9+
platformBundledPlugins=com.intellij.java,org.intellij.groovy,org.jetbrains.plugins.yaml
10+
platformPlugins=Dart:241.18808,io.flutter:81.0.2
11+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.3-bin.zip
3+
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

qodana.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/main/java/com/xtu/plugin/flutter/action/IFlutterActionGroup.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
public class IFlutterActionGroup extends DefaultActionGroup {
1111

1212
@Override
13-
public @NotNull ActionUpdateThread getActionUpdateThread() {
13+
@NotNull
14+
public ActionUpdateThread getActionUpdateThread() {
1415
return ActionUpdateThread.BGT;
1516
}
1617

src/main/java/com/xtu/plugin/flutter/action/analysis/ui/DuplicateResDisplayDialog.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ protected String getDimensionServiceKey() {
5252
}
5353

5454
@Override
55-
protected Action @NotNull [] createActions() {
55+
@NotNull
56+
protected Action[] createActions() {
5657
return new Action[]{copyAction, getOKAction()};
5758
}
5859

src/main/java/com/xtu/plugin/flutter/action/analysis/ui/UselessResAnalysisDialog.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ String getDimensionServiceKey() {
3434
}
3535

3636
@Override
37-
protected Action @NotNull [] createActions() {
37+
@NotNull
38+
protected Action[] createActions() {
3839
return new Action[]{copyAction, getOKAction()};
3940
}
4041

src/main/java/com/xtu/plugin/flutter/action/generate/res/GenerateResAction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public void actionPerformed(@NotNull AnActionEvent e) {
3737
newAssetList.add(assetPath);
3838
}
3939
}
40-
DartRFileGenerator.getInstance().resetCache();
41-
DartFontFileGenerator.getInstance().resetCache();
4240
WriteCommandAction.runWriteCommandAction(project, () -> {
4341
PubSpecUtils.writeAssetList(project, newAssetList, newFontList);
4442
});

src/main/java/com/xtu/plugin/flutter/action/intl/ui/AddIntlDialog.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ public JComponent getPreferredFocusedComponent() {
124124
}
125125

126126
@Override
127-
protected Action @NotNull [] createActions() {
127+
@NotNull
128+
protected Action[] createActions() {
128129
return new Action[]{getOKAction()};
129130
}
130131

0 commit comments

Comments
 (0)