Skip to content

Commit 7fba84e

Browse files
committed
build:重构构建配置并添加新功能
- 适配PHPStorm-242.*
1 parent 6a1d6d9 commit 7fba84e

96 files changed

Lines changed: 1425 additions & 669 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
.idea
13+
*.iws
14+
*.iml
15+
*.ipr
16+
out/
17+
!**/src/main/**/out/
18+
!**/src/test/**/out/
19+
20+
### Eclipse ###
21+
.apt_generated
22+
.classpath
23+
.factorypath
24+
.project
25+
.settings
26+
.springBeans
27+
.sts4-cache
28+
bin/
29+
!**/src/main/**/bin/
30+
!**/src/test/**/bin/
31+
32+
### NetBeans ###
33+
/nbproject/private/
34+
/nbbuild/
35+
/dist/
36+
/nbdist/
37+
/.nb-gradle/
38+
39+
### VS Code ###
40+
.vscode/
41+
42+
### Mac OS ###
43+
.DS_Store
44+
/.semanticgraphs/
45+
/.idea/
46+
/.run/
47+
/.kotlin/
48+
/.intellijPlatform/

CHANGELOG.md

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,51 @@
1-
Changelog
2-
=========
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
32

4-
## 1.0.0-rc.1
5-
* 添加lombok功能
3+
# Changelog
4+
<hr>
65

7-
## 0.2.4
8-
* fix(main): 修复模板存在重复代码块、多空行时,代理断点映射行错误的问题
6+
## [1.1.0] - 2025-04-27
7+
### Added
8+
- Nothing
99

10-
## 0.1
11-
* 项目初始化
10+
### Removed
11+
- 去除旧版本不兼容api相应的功能
12+
13+
### Changed
14+
- 适配PHPStorm-242.*
15+
<hr>
16+
17+
## [1.0.5] - 2023-12-08
18+
### Added
19+
- Nothing
20+
21+
### Removed
22+
- Nothing
23+
24+
### Changed
25+
- 适配PHPStorm-233.*
26+
<hr>
27+
28+
## [1.0.1] - 2023-11-17
29+
### Added
30+
- 添加lombok功能
31+
32+
### Removed
33+
- Nothing
34+
35+
### Changed
36+
- Nothing
37+
<hr>
38+
39+
## [0.2.4] - 2023-10-25
40+
### Changed
41+
- Nothing
42+
43+
### Fixed
44+
- 修复模板存在重复代码块、多空行时,代理断点映射行错误的问题
45+
46+
### Removed
47+
- Nothing
48+
<hr>
49+
50+
## [0.1.0] - 2023-10-24
51+
### Init

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 maliboot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ IntelliJ IDEA / PhpStorm Hyperf Plugin
44

55
| Key | Value |
66
|------------|-------------------------------------------|
7-
| Plugin Url | https://plugins.jetbrains.com/plugin/23164 |
7+
| Plugin Url | https://plugins.jetbrains.com/plugin/23007 |
88
| ID | `io.maliboot.www.hyperf` |
99
| Changelog | [CHANGELOG](CHANGELOG.md) |
10-
10+
<!-- Plugin description -->
1111
# About
12+
This is a PHPStorm plugin that provides support for the hyperf framework/component or third-party vendor extensions dependent on hyperf components.
13+
14+
# 简介
1215
这是一个对`hyperf`框架/组件、或者依赖`hyperf组件`的第三方`vendor`扩展包,提供功能支持的`PHPStorm`插件。
1316

17+
[功能介绍](https://github.com/maliboot/idea-hyperf-plugin/blob/master/README.md)
18+
<!-- Plugin description end -->
19+
1420
# Install
15-
* 通过插件市场安装 [Hyperf Support](https://plugins.jetbrains.com/plugin/23164) `Settings -> Plugins -> Browse repositories`
16-
* 通过本地磁盘安装 [Hyperf Support](https://github.com/maliboot/idea-hyperf-plugin/releases) `Settings -> Plugins -> Install Plugin from Disk...`,插件jar包可以在[release](https://github.com/maliboot/idea-hyperf-plugin/releases)页面找到
21+
* 通过插件市场安装 [Hyperf Booster](https://plugins.jetbrains.com/plugin/23007) `Settings -> Plugins -> Browse repositories`
22+
* 通过本地磁盘安装 [Hyperf Booster](https://github.com/maliboot/idea-hyperf-plugin/releases) `Settings -> Plugins -> Install Plugin from Disk...`,插件jar包可以在[release](https://github.com/maliboot/idea-hyperf-plugin/releases)页面找到
1723
* 预览版本只能通过[release](https://github.com/maliboot/idea-hyperf-plugin/releases)页面安装,里面包含了一些正在测试中的功能
1824

1925
# Feature
@@ -22,15 +28,20 @@ IntelliJ IDEA / PhpStorm Hyperf Plugin
2228
* 拼写检查:屏蔽框架常用词如`hyperf``swoole``jsonrpc`等等单词的拼写错误警告。如有遗漏或补充,请提交Issue给我。
2329

2430
## debug
31+
`swoole`官网提到,在版本`5.1`以上支持了`xdebug`调试,所以做了这样一个功能
32+
> 调试准备,php.ini中修改:
33+
>
34+
> swoole.enable_fiber_mock=On
35+
2536
本插件会定位`模板文件``代理文件`的断点所在行第一个`ast节点`,计算出该节点的树路径相对偏移量,得出对应文件的断点位置,尽可能让`hyperf`得以在`模板文件`内调试
2637
![Debug Preview](doc/xdebug.png)
2738
>>> hyperf的AOP会生成编译生成代理文件,如`app/IndexController.php`会生成`./runtime/container/proxy/APP_IndexController.proxy.php`代理文件。当程序启动时,`IndexController.php`变成了模板文件不再参与程序运行,`APP_IndexController.proxy.php`成为了实际上真正运行的文件,所以当debug调试程序时所有的`断点``堆栈列表日志`都追溯到了代理文件内。
2839
2940
## Lombok‼️(**该功能完全不依赖`代理文件`**
3041
![Debug Preview](doc/lombok.gif)
3142
* Lombok支持:[maliboot/lombok](https://github.com/maliboot/lombok)适配,解决该PHP扩展使用时编辑器没有自动补全、参数提示、错误语法高量、导航等功能。
32-
* **该功能完全不依赖`代理文件`**。旨在极端情况下,提供对[maliboot/lombok](https://github.com/maliboot/lombok)的全方位支持
43+
* **该功能完全不依赖`代理文件`**通过构建了相应的`FakePhpPsiElement`元素, 旨在极端情况下,提供对[maliboot/lombok](https://github.com/maliboot/lombok)的全方位支持
3344

3445
# Idea
3546
* 如果使用插件过程中有报错,可以[提交堆栈报告](https://github.com/maliboot/idea-hyperf-plugin/issues/new?title=[BUG]XXX主题&body=...)给我。这对我非常重要,我会及时修复
36-
* 欢迎给我提功能建议👏,如果戳中了需求痛点,我会抽时间来开发。[点这里提需求](https://github.com/maliboot/idea-hyperf-plugin/issues/new?title=%E3%80%90%E5%8A%9F%E8%83%BD%E5%BB%BA%E8%AE%AE%E3%80%91XXX&body=...)
47+
* 欢迎给我提功能建议👏,如果戳中了需求痛点,我会抽时间来开发。因为到目前为止,我也不知道写啥功能。[点这里提需求](https://github.com/maliboot/idea-hyperf-plugin/issues/new?title=%E3%80%90%E5%8A%9F%E8%83%BD%E5%BB%BA%E8%AE%AE%E3%80%91XXX&body=...)

build.gradle.kts

Lines changed: 79 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,101 @@
1+
import org.jetbrains.changelog.Changelog
2+
import org.jetbrains.changelog.markdownToHTML
3+
14
plugins {
25
id("java")
3-
id("org.jetbrains.kotlin.jvm") version "1.9.20"
4-
id("org.jetbrains.intellij") version "1.16.0"
6+
alias(libs.plugins.kotlin) // Kotlin support
7+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
8+
alias(libs.plugins.changelog) // Gradle Changelog Plugin
59
}
610

7-
group = "io.maliboot.devkit.idea"
8-
version = "1.0.0-rc.5"
11+
group = providers.gradleProperty("pluginGroup").get()
12+
version = providers.gradleProperty("pluginVersion").get()
13+
14+
kotlin {
15+
jvmToolchain(providers.gradleProperty("javaVersion").get().toInt())
16+
}
917

1018
repositories {
1119
mavenCentral()
12-
}
1320

14-
intellij {
15-
pluginName.set("Hyperf Support")
16-
version.set("2023.1")
17-
type.set("PS")
21+
intellijPlatform {
22+
defaultRepositories()
23+
}
24+
}
1825

19-
plugins.set(listOf("com.jetbrains.php"))
26+
dependencies {
27+
intellijPlatform {
28+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
29+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
30+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
31+
}
2032
}
2133

22-
tasks {
34+
intellijPlatform {
35+
pluginConfiguration {
36+
name = providers.gradleProperty("pluginName")
37+
version = providers.gradleProperty("pluginVersion")
38+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
39+
val start = "<!-- Plugin description -->"
40+
val end = "<!-- Plugin description end -->"
41+
42+
with(it.lines()) {
43+
if (!containsAll(listOf(start, end))) {
44+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
45+
}
46+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
47+
}
48+
}
2349

24-
compileKotlin {
25-
kotlinOptions.jvmTarget = "17"
50+
val changelog = project.changelog // local variable for configuration cache compatibility
51+
// Get the latest available change notes from the changelog file
52+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
53+
with(changelog) {
54+
renderItem(
55+
(getOrNull(pluginVersion) ?: getUnreleased())
56+
.withHeader(false)
57+
.withEmptySections(false),
58+
Changelog.OutputType.HTML,
59+
)
60+
}
61+
}
62+
63+
ideaVersion {
64+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
65+
untilBuild = providers.gradleProperty("pluginUntilBuild")
66+
}
67+
}
68+
69+
signing {
70+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
71+
privateKey = providers.environmentVariable("PRIVATE_KEY")
72+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
2673
}
2774

28-
compileJava {
29-
sourceCompatibility = "17"
30-
targetCompatibility = "17"
75+
publishing {
76+
token = providers.environmentVariable("PUBLISH_TOKEN")
77+
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
3178
}
3279

33-
patchPluginXml {
34-
sinceBuild.set("231")
35-
untilBuild.set("233.*")
36-
changeNotes.set(file("src/main/resources/META-INF/change-notes.html").readText().replace("<html>", "").replace("</html>", ""))
80+
pluginVerification {
81+
ides {
82+
recommended()
83+
}
3784
}
85+
}
3886

39-
signPlugin {
40-
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
41-
privateKey.set(System.getenv("PRIVATE_KEY"))
42-
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
87+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
88+
changelog {
89+
groups.empty()
90+
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
91+
}
92+
93+
tasks {
94+
wrapper {
95+
gradleVersion = providers.gradleProperty("gradleVersion").get()
4396
}
4497

4598
publishPlugin {
46-
token.set(System.getenv("PUBLISH_TOKEN"))
99+
dependsOn(patchChangelog)
47100
}
48-
}
101+
}

gradle.properties

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pluginGroup = io.maliboot.devkit
2+
pluginName = Hyperf Booster
3+
pluginVersion = 1.0.1
4+
pluginRepositoryUrl = https://github.com/maliboot/idea-hyperf-plugin
5+
6+
pluginSinceBuild = 231
7+
pluginUntilBuild =
8+
9+
platformType = PS
10+
platformVersion = 2024.2.5
11+
platformPlugins =
12+
platformBundledPlugins = com.jetbrains.php
13+
14+
javaVersion = 21
15+
gradleVersion = 8.12
16+
17+
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
18+
kotlin.stdlib.default.dependency = false
19+
20+
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
21+
org.gradle.configuration-cache = true
22+
23+
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
24+
org.gradle.caching = true

gradle/libs.versions.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[versions]
2+
# plugins
3+
changelog = "2.2.1"
4+
intelliJPlatform = "2.5.0"
5+
kotlin = "2.1.20"
6+
7+
[libraries]
8+
9+
[plugins]
10+
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
11+
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
12+
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

59.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Thu Apr 24 12:21:32 CST 2025
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)