1
+ import org.jetbrains.changelog.Changelog
2
+ import org.jetbrains.changelog.markdownToHTML
3
+ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
4
+
5
+ plugins {
6
+ id(" java" ) // Java support
7
+ alias(libs.plugins.kotlin) // Kotlin support
8
+ alias(libs.plugins.intelliJPlatform) version " 2.7.1" // IntelliJ Platform Gradle Plugin
9
+ alias(libs.plugins.changelog) // Gradle Changelog Plugin
10
+ }
11
+
12
+ group = providers.gradleProperty(" pluginGroup" ).get()
13
+ version = System .getenv(" LD_VERSION" ) ? : providers.gradleProperty(" pluginVersion" ).get()
14
+
15
+ // Set the JVM language level used to build the project.
16
+ kotlin {
17
+ jvmToolchain(17 )
18
+ }
19
+
20
+ // Configure project's dependencies
21
+ repositories {
22
+ mavenLocal()
23
+ maven(" https://jitpack.io" )
24
+ mavenCentral()
25
+
26
+ // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
27
+ intellijPlatform {
28
+ defaultRepositories()
29
+ }
30
+ }
31
+
32
+ // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
33
+ dependencies {
34
+ api(" com.shuzijun:lc-sdk:0.0.3" )
35
+ api(" com.alibaba:fastjson:1.2.47" )
36
+ api(" org.jsoup:jsoup:1.11.3" )
37
+ api(" io.sentry:sentry:1.7.9" ) {
38
+ exclude(module = " slf4j-api" )
39
+ }
40
+ api(" org.scilab.forge:jlatexmath:1.0.7" )
41
+ api(" org.apache.commons:commons-lang3:3.9" )
42
+ api(" com.vladsch.flexmark:flexmark:0.62.2" )
43
+ api(" com.vladsch.flexmark:flexmark-ext-attributes:0.62.2" )
44
+ api(" io.github.biezhi:TinyPinyin:2.0.3.RELEASE" )
45
+ // api(fileTree(mapOf("dir" to "src/main/resources/lib", "include" to listOf("*.jar"))))
46
+
47
+ testImplementation(libs.junit)
48
+ testImplementation(libs.opentest4j)
49
+
50
+ // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
51
+ intellijPlatform {
52
+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
53
+
54
+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
55
+ // bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
56
+
57
+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
58
+ // plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
59
+
60
+ // Module Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules.
61
+ // bundledModules(providers.gradleProperty("platformBundledModules").map { it.split(',') })
62
+
63
+ testFramework(TestFrameworkType .Platform )
64
+ }
65
+ }
66
+
67
+ // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
68
+ intellijPlatform {
69
+ pluginConfiguration {
70
+ name = providers.gradleProperty(" pluginName" )
71
+ version = project.version.toString()
72
+
73
+ // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
74
+ description = providers.fileContents(layout.projectDirectory.file(providers.gradleProperty(" pluginDescription" ).get())).toString()
75
+
76
+ val changelog = project.changelog // local variable for configuration cache compatibility
77
+ // Get the latest available change notes from the changelog file
78
+ changeNotes = with (changelog) {
79
+ renderItem(
80
+ (getOrNull(project.version.toString() + " .0" ) ? : getUnreleased())
81
+ .withHeader(false )
82
+ .withEmptySections(false ),
83
+ Changelog .OutputType .HTML ,
84
+ )
85
+ }
86
+
87
+ ideaVersion {
88
+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
89
+ }
90
+ }
91
+
92
+ publishing {
93
+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
94
+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
95
+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
96
+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
97
+ channels = providers.gradleProperty(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
98
+ }
99
+
100
+ pluginVerification {
101
+ ides {
102
+ recommended()
103
+ }
104
+ }
105
+ }
106
+
107
+ // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
108
+ changelog {
109
+ groups.empty()
110
+ repositoryUrl = providers.gradleProperty(" pluginRepositoryUrl" )
111
+ }
112
+
113
+
114
+ tasks {
115
+ wrapper {
116
+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
117
+ }
118
+
119
+ publishPlugin {
120
+ dependsOn(patchChangelog)
121
+ }
122
+ }
123
+
124
+ intellijPlatformTesting {
125
+ runIde {
126
+ register(" runIdeForUiTests" ) {
127
+ task {
128
+ jvmArgumentProviders + = CommandLineArgumentProvider {
129
+ listOf (
130
+ " -Dfile.encoding=utf-8"
131
+ )
132
+ }
133
+ }
134
+
135
+ plugins {
136
+ robotServerPlugin()
137
+ }
138
+ }
139
+ }
140
+ }
0 commit comments