diff --git a/.gitignore b/.gitignore index 90e97f6..843e099 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.idea +.intellijPlatform /.gradle *.iml */target/ diff --git a/build.gradle.kts b/build.gradle.kts index 02ad1ee..55c1c0b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,6 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML - -fun environment(key: String) = providers.environmentVariable(key) +import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { // Java support @@ -9,16 +8,50 @@ plugins { // Kotlin support // id("org.jetbrains.kotlin.jvm") version "1.9.10" // Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin - id("org.jetbrains.intellij") version "1.17.2" + id("org.jetbrains.intellij.platform") version "2.0.1" // Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin id("org.jetbrains.changelog") version "2.2.0" } +group = "ink.organics" +version = "2.0.6" + +// Configure project's dependencies +repositories { + mavenCentral() + // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html + intellijPlatform { + defaultRepositories() + } +} + dependencies { + + intellijPlatform { + intellijIdeaCommunity("2023.3") + + bundledPlugin("com.intellij.java") + bundledPlugin("com.intellij.properties") + bundledPlugin("org.jetbrains.kotlin") + + pluginVerifier() + zipSigner() + instrumentationTools() + + testFramework(TestFrameworkType.Plugin.Java) + } + +// intellijPlatformTesting { +// runIde +// testIde +// } + implementation("org.springframework:spring-expression:6.1.4") implementation("org.reflections:reflections:0.10.2") { exclude(group = "org.slf4j") } + + testCompileOnly("junit:junit:4.13.2") testCompileOnly("com.alibaba:fastjson:1.2.83") testCompileOnly("com.fasterxml.jackson.core:jackson-databind:2.14.3") // https://projectlombok.org/setup/gradle @@ -26,31 +59,53 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:1.18.30") } -group = "ink.organics" -version = "2.0.6" +// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html +intellijPlatform { + pluginConfiguration { + // Extract the section from README.md and provide for the plugin's manifest + description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map { + val start = "" + val end = "" -repositories { - mavenCentral() -} + with(it.lines()) { + if (!containsAll(listOf(start, end))) { + throw GradleException("Plugin description section not found in README.md:\n$start ... $end") + } + subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML) + } + } -intellij { - // 这个版本是本地Runtime版本 - version.set("2023.3") - updateSinceUntilBuild.set(false) - // https://github.com/JetBrains/gradle-intellij-plugin/issues/38 - plugins.set( - listOf( - "org.intellij.intelliLang", - "com.intellij.java", - "org.jetbrains.kotlin", - "com.intellij.properties" - ) - ) + // Get the latest available change notes from the changelog file + changeNotes = changelog.renderItem(changelog.getLatest(), Changelog.OutputType.HTML) + + // 这个版本是插件页面展示的最低支持版本 + ideaVersion { + sinceBuild = "233" + } + } + + signing { + certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN") + privateKey = providers.environmentVariable("PRIVATE_KEY") + password = providers.environmentVariable("PRIVATE_KEY_PASSWORD") + } + + publishing { + token = providers.environmentVariable("PUBLISH_TOKEN") + } + + pluginVerification { + ides { + recommended() + } + } } tasks { +// printBundledPlugins.get().printBundledPlugins() + withType { sourceCompatibility = "17" targetCompatibility = "17" @@ -61,17 +116,13 @@ tasks { gradleVersion = "8.6" } - buildSearchableOptions { - enabled = false - } - - instrumentCode { - enabled = false - } - - instrumentTestCode { - enabled = false - } +// instrumentCode { +// enabled = false +// } +// +// instrumentTestCode { +// enabled = false +// } test { // 这里要签出一个完整的 Intellij IC 作为JVM语言的测试环境,并且要注意版本与 version.set("2022.3") 分发环境相同 。这个配置真蠢。 @@ -81,40 +132,9 @@ tasks { println(getSystemProperties()) } - patchPluginXml { - // 这个版本是插件页面展示的最低支持版本 - sinceBuild.set("223") - - // Extract the section from README.md and provide for the plugin's manifest - pluginDescription.set( - File(projectDir, "README.md").readText().lines().run { - val start = "" - val end = "" - - if (!containsAll(listOf(start, end))) { - throw GradleException("Plugin description section not found in README.md:\n$start ... $end") - } - subList(indexOf(start) + 1, indexOf(end)) - }.joinToString("\n").run { markdownToHTML(this) } - ) - - // Get the latest available change notes from the changelog file - changeNotes.set(provider { changelog.renderItem(changelog.getLatest(), Changelog.OutputType.HTML) }) - } - register("printChangelog") { println(changelog.renderItem(changelog.getLatest(), Changelog.OutputType.MARKDOWN)) } - - signPlugin { - certificateChain.set(environment("CERTIFICATE_CHAIN")) - privateKey.set(environment("PRIVATE_KEY")) - password.set(environment("PRIVATE_KEY_PASSWORD")) - } - - publishPlugin { - token.set(environment("PUBLISH_TOKEN")) - } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index ae61d2a..3ea1d27 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,11 +1,11 @@ ink.organics.pojo2json POJO to JSON - organics2016 - com.intellij.modules.platform - com.intellij.modules.lang - com.intellij.java - com.intellij.properties + organics2016 + + + +