Skip to content

Commit 0afb4df

Browse files
author
ale
committed
build for 152
1 parent b74b402 commit 0afb4df

34 files changed

Lines changed: 422 additions & 1342 deletions

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Build Plugin
22

33
on:
44
push:
5-
branches: *
5+
branches:
6+
- '*'
67
# pull_request:
78
# branches: [ "master" ]
89

@@ -16,7 +17,7 @@ jobs:
1617

1718
env:
1819
CI: true
19-
CI_BUILD_VERSION: 1.3.7.${{ github.run_number }}
20+
CI_BUILD_VERSION: 1.4.0.${{ github.run_number }}
2021

2122
steps:
2223
- name: Checkout
@@ -28,13 +29,13 @@ jobs:
2829
java-version: '17'
2930
distribution: 'temurin'
3031

31-
- name: Build 2023.1-EAP
32+
- name: Build 2025.3
3233
env:
33-
IDEA_VER: 231
34+
IDEA_VER: 245
3435
run: ./gradlew buildPlugin
3536

3637
- name: Upload artifact
37-
uses: actions/upload-artifact@v3.1.0
38+
uses: actions/upload-artifact@v4
3839
with:
3940
name: v${{ env.CI_BUILD_VERSION }}
4041
path: build/distributions/*.zip

.idea/modules.xml

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

build.gradle.kts

Lines changed: 38 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
import de.undercouch.gradle.tasks.download.*
17+
import de.undercouch.gradle.tasks.download.Download
1818
import org.apache.tools.ant.taskdefs.condition.Os
19+
import org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask
20+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1921
import java.io.ByteArrayOutputStream
22+
import kotlin.text.get
23+
import kotlin.text.set
2024

2125
plugins {
22-
id("org.jetbrains.intellij").version("1.10.0")
23-
id("org.jetbrains.kotlin.jvm").version("1.7.22")
26+
id("org.jetbrains.intellij.platform") version "2.7.0"
27+
id("org.jetbrains.kotlin.jvm").version("2.1.0")
2428
id("de.undercouch.download").version("5.3.0")
2529
}
2630

@@ -41,38 +45,13 @@ data class BuildData(
4145

4246
val buildDataList = listOf(
4347
BuildData(
44-
ideaSDKShortVersion = "231",
45-
// 223.7571.123-EAP-SNAPSHOT
46-
// LATEST-EAP-SNAPSHOT
47-
ideaSDKVersion = "LATEST-EAP-SNAPSHOT",
48-
sinceBuild = "231",
49-
untilBuild = "231.*",
48+
ideaSDKShortVersion = "2025.2",
49+
ideaSDKVersion = "252.23892.409",
50+
sinceBuild = "252",
51+
untilBuild = "252.*",
5052
bunch = "212",
5153
targetCompatibilityLevel = JavaVersion.VERSION_17,
5254
jvmTarget = "17"
53-
),
54-
BuildData(
55-
ideaSDKShortVersion = "223",
56-
ideaSDKVersion = "2022.3",
57-
sinceBuild = "223",
58-
untilBuild = "223.*",
59-
bunch = "212",
60-
targetCompatibilityLevel = JavaVersion.VERSION_17,
61-
jvmTarget = "17"
62-
),
63-
BuildData(
64-
ideaSDKShortVersion = "222",
65-
ideaSDKVersion = "2022.2",
66-
sinceBuild = "212",
67-
untilBuild = "222.*",
68-
bunch = "212"
69-
),
70-
BuildData(
71-
ideaSDKShortVersion = "211",
72-
ideaSDKVersion = "2021.1",
73-
sinceBuild = "211",
74-
untilBuild = "211.*",
75-
bunch = "203"
7655
)
7756
)
7857

@@ -115,11 +94,11 @@ fun getRev(): String {
11594

11695
task("downloadEmmyDebugger", type = Download::class) {
11796
src(arrayOf(
118-
"https://github.com/EmmyLua/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/darwin-arm64.zip",
119-
"https://github.com/EmmyLua/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/darwin-x64.zip",
120-
"https://github.com/EmmyLua/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/linux-x64.zip",
121-
"https://github.com/EmmyLua/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/win32-x64.zip",
122-
"https://github.com/EmmyLua/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/win32-x86.zip"
97+
"https://github.com/leinlin/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/darwin-arm64.zip",
98+
"https://github.com/leinlin/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/darwin-x64.zip",
99+
"https://github.com/leinlin/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/linux-x64.zip",
100+
"https://github.com/leinlin/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/win32-x64.zip",
101+
"https://github.com/leinlin/EmmyLuaDebugger/releases/download/${emmyDebuggerVersion}/win32-x86.zip"
123102
))
124103

125104
dest("temp")
@@ -172,8 +151,11 @@ task("installEmmyDebugger", type = Copy::class) {
172151

173152
project(":") {
174153
repositories {
175-
maven(url = "https://www.jetbrains.com/intellij-repository/releases")
176154
mavenCentral()
155+
intellijPlatform {
156+
defaultRepositories()
157+
marketplace()
158+
}
177159
}
178160

179161
dependencies {
@@ -183,6 +165,10 @@ project(":") {
183165
implementation("org.luaj:luaj-jse:3.0.1")
184166
implementation("org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5")
185167
implementation("com.jgoodies:forms:1.2.1")
168+
intellijPlatform {
169+
intellijIdeaCommunity(buildVersionData.ideaSDKShortVersion)
170+
//bundledModule("intellij.spellchecker")
171+
}
186172
}
187173

188174
sourceSets {
@@ -193,18 +179,14 @@ project(":") {
193179
}
194180
}
195181

196-
configure<JavaPluginConvention> {
182+
/*configure<JavaPluginConvention> {
197183
sourceCompatibility = buildVersionData.targetCompatibilityLevel
198184
targetCompatibility = buildVersionData.targetCompatibilityLevel
199-
}
185+
}*/
200186

201-
intellij {
202-
type.set("IC")
203-
updateSinceUntilBuild.set(false)
204-
downloadSources.set(!isCI)
205-
version.set(buildVersionData.ideaSDKVersion)
206-
//localPath.set(System.getenv("IDEA_HOME_${buildVersionData.ideaSDKShortVersion}"))
207-
sandboxDir.set("${project.buildDir}/${buildVersionData.ideaSDKShortVersion}/idea-sandbox")
187+
intellijPlatform {
188+
version = version
189+
sandboxContainer.set(layout.buildDirectory.dir("${buildVersionData.ideaSDKShortVersion}/idea-sandbox"))
208190
}
209191

210192
task("bunch") {
@@ -242,26 +224,27 @@ project(":") {
242224
}
243225
}
244226

227+
processResources {
228+
dependsOn("installEmmyDebugger")
229+
}
230+
245231
compileKotlin {
246-
kotlinOptions {
247-
jvmTarget = buildVersionData.jvmTarget
232+
compilerOptions {
233+
jvmTarget.set(JvmTarget.fromTarget(buildVersionData.jvmTarget))
248234
}
249235
}
250236

251237
patchPluginXml {
238+
dependsOn("installEmmyDebugger")
252239
sinceBuild.set(buildVersionData.sinceBuild)
253240
untilBuild.set(buildVersionData.untilBuild)
254241
}
255242

256-
instrumentCode {
257-
compilerVersion.set(buildVersionData.instrumentCodeCompilerVersion)
258-
}
259-
260243
publishPlugin {
261244
token.set(System.getenv("IDEA_PUBLISH_TOKEN"))
262245
}
263246

264-
withType<org.jetbrains.intellij.tasks.PrepareSandboxTask> {
247+
withType<PrepareSandboxTask> {
265248
doLast {
266249
copy {
267250
from("src/main/resources/std")
@@ -274,4 +257,4 @@ project(":") {
274257
}
275258
}
276259
}
277-
}
260+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
distributionBase=GRADLE_USER_HOME
1818
distributionPath=wrapper/dists
19-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
19+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
2020
zipStoreBase=GRADLE_USER_HOME
2121
zipStorePath=wrapper/dists

src/main/java/com/tang/intellij/lua/LuaBundle.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) Stri
3131
return CommonBundle.message(getBundle(), key, params);
3232
}
3333

34-
@Nullable
35-
public static String messageOfNull(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key,
36-
@NotNull Object... params) {
37-
return CommonBundle.messageOfNull(getBundle(), key, params);
38-
}
39-
4034
private static Reference<ResourceBundle> ourBundle;
4135
@NonNls
4236
private static final String BUNDLE = "LuaBundle";

src/main/java/com/tang/intellij/lua/codeInsight/LuaParameterInfoHandler.kt

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.tang.intellij.lua.codeInsight
1818

19-
import com.intellij.codeInsight.lookup.LookupElement
2019
import com.intellij.lang.parameterInfo.*
2120
import com.intellij.psi.util.PsiTreeUtil
2221
import com.intellij.util.Processor
@@ -34,18 +33,6 @@ data class ParameterInfoType(val sig: IFunSignature, val isColonStyle: Boolean)
3433
* Created by tangzx on 2016/12/25.
3534
*/
3635
class LuaParameterInfoHandler : ParameterInfoHandler<LuaArgs, ParameterInfoType> {
37-
override fun couldShowInLookup(): Boolean {
38-
return false
39-
}
40-
41-
override fun getParametersForLookup(lookupElement: LookupElement, parameterInfoContext: ParameterInfoContext): Array<Any>? {
42-
return emptyArray()
43-
}
44-
45-
override fun getParametersForDocumentation(o: ParameterInfoType, parameterInfoContext: ParameterInfoContext): Array<Any>? {
46-
return emptyArray()
47-
}
48-
4936
override fun findElementForParameterInfo(context: CreateParameterInfoContext): LuaArgs? {
5037
val file = context.file
5138
val luaArgs = PsiTreeUtil.findElementOfClassAtOffset(file, context.offset, LuaArgs::class.java, false)
@@ -85,14 +72,6 @@ class LuaParameterInfoHandler : ParameterInfoHandler<LuaArgs, ParameterInfoType>
8572
}
8673
}
8774

88-
override fun getParameterCloseChars(): String? {
89-
return ",()"
90-
}
91-
92-
override fun tracksParameterIndex(): Boolean {
93-
return true
94-
}
95-
9675
override fun updateUI(o: ParameterInfoType?, context: ParameterInfoUIContext) {
9776
if (o == null)
9877
return
@@ -113,14 +92,14 @@ class LuaParameterInfoHandler : ParameterInfoHandler<LuaArgs, ParameterInfoType>
11392
}
11493
if (str.isNotEmpty()) {
11594
context.setupUIComponentPresentation(
116-
str,
117-
start,
118-
end,
119-
false,
120-
false,
121-
false,
122-
context.defaultParameterColor
95+
str,
96+
start,
97+
end,
98+
false,
99+
false,
100+
false,
101+
context.defaultParameterColor
123102
)
124103
}
125104
}
126-
}
105+
}

src/main/java/com/tang/intellij/lua/codeInsight/inspection/RemoveUnusedLocal.kt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.TextRange
2323
import com.intellij.psi.PsiElementVisitor
2424
import com.intellij.psi.search.searches.ReferencesSearch
2525
import com.intellij.refactoring.RefactoringFactory
26+
import com.intellij.util.Processor
2627
import com.tang.intellij.lua.Constants
2728
import com.tang.intellij.lua.comment.psi.LuaDocPsiElement
2829
import com.tang.intellij.lua.psi.LuaLocalDef
@@ -44,17 +45,17 @@ class RemoveUnusedLocal : LocalInspectionTool() {
4445
return
4546
val search = ReferencesSearch.search(o, o.useScope)
4647
var found = false
47-
for (reference in search) {
48+
search.forEach(Processor { reference ->
4849
if (reference.element !is LuaDocPsiElement) {
4950
found = true
50-
break
5151
}
52-
}
52+
!found
53+
})
5354
if (!found) {
5455
holder.registerProblem(o,
55-
"Unused parameter : '${o.name}'",
56-
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
57-
RenameToUnderlineFix())
56+
"Unused parameter : '${o.name}'",
57+
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
58+
RenameToUnderlineFix())
5859
}
5960
}
6061

@@ -68,16 +69,16 @@ class RemoveUnusedLocal : LocalInspectionTool() {
6869
val offset = name.node.startOffset - o.node.startOffset
6970
val textRange = TextRange(offset, offset + name.textLength)
7071
holder.registerProblem(o,
71-
"Unused local : '${name.text}'",
72-
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
73-
textRange,
74-
RemoveFix("Remove unused local '${name.text}'"),
75-
RenameToUnderlineFix())
72+
"Unused local : '${name.text}'",
73+
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
74+
textRange,
75+
RemoveFix("Remove unused local '${name.text}'"),
76+
RenameToUnderlineFix())
7677
} else {
7778
holder.registerProblem(name,
78-
"Unused local : '${name.text}'",
79-
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
80-
RenameToUnderlineFix())
79+
"Unused local : '${name.text}'",
80+
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
81+
RenameToUnderlineFix())
8182
}
8283
}
8384
}
@@ -94,10 +95,10 @@ class RemoveUnusedLocal : LocalInspectionTool() {
9495
val textRange = TextRange(offset, offset + name.textLength)
9596

9697
holder.registerProblem(o,
97-
"Unused local function : '${name.text}'",
98-
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
99-
textRange,
100-
RemoveFix("Remove unused local function : '${name.text}'"))
98+
"Unused local function : '${name.text}'",
99+
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
100+
textRange,
101+
RemoveFix("Remove unused local function : '${name.text}'"))
101102
}
102103
}
103104
}
@@ -126,4 +127,4 @@ class RemoveUnusedLocal : LocalInspectionTool() {
126127
element.delete()
127128
}
128129
}
129-
}
130+
}

0 commit comments

Comments
 (0)