Skip to content

Commit

Permalink
update org.jetbrains.intellij.platform to 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
organics2016 committed Aug 14, 2024
1 parent 68c8711 commit 29bb28d
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 77 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea
.intellijPlatform
/.gradle
*.iml
*/target/
Expand Down
146 changes: 83 additions & 63 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,56 +1,111 @@
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
id("java")
// 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
testCompileOnly("org.projectlombok:lombok:1.18.30")
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 <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
Expand All @@ -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") 分发环境相同 。这个配置真蠢。
Expand All @@ -81,40 +132,9 @@ tasks {
println(getSystemProperties())
}

patchPluginXml {
// 这个版本是插件页面展示的最低支持版本
sinceBuild.set("223")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(
File(projectDir, "README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description 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"))
}
}


Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<idea-plugin>
<id>ink.organics.pojo2json</id>
<name>POJO to JSON</name>
<vendor email="374564811@qq.com" url="https://github.com/organics2016">organics2016</vendor>
<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.lang</depends>
<depends>com.intellij.java</depends>
<depends>com.intellij.properties</depends>
<vendor email="organics2015@outlook.com" url="https://github.com/organics2016">organics2016</vendor>
<!-- <depends>com.intellij.modules.platform</depends>-->
<!-- <depends>com.intellij.modules.lang</depends>-->
<!-- <depends>com.intellij.java</depends>-->
<!-- <depends>com.intellij.properties</depends>-->

<extensions defaultExtensionNs="com.intellij">
<notificationGroup id="ink.organics.pojo2json.NotificationGroup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.intellij.openapi.actionSystem.AnAction;
import ink.organics.pojo2json.test.MyTestCase;

import static org.junit.Assert.*;
import static junit.framework.Assert.*;

public class AnnotationTestModel extends TestModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static org.junit.Assert.*;
import static junit.framework.Assert.*;

public class DataTypeTestModel extends TestModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.intellij.openapi.actionSystem.AnAction;
import ink.organics.pojo2json.test.MyTestCase;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;

public class DocTestModel extends TestModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.intellij.openapi.actionSystem.AnAction;
import ink.organics.pojo2json.test.MyTestCase;

import static org.junit.Assert.assertTrue;
import static junit.framework.Assert.assertTrue;

public class MemberClassTestModel extends TestModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.intellij.openapi.actionSystem.AnAction;
import ink.organics.pojo2json.test.MyTestCase;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;

public class StaticFieldTestModel extends TestModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import ink.organics.pojo2json.test.MyTestCase;

import java.util.Arrays;

import static junit.framework.Assert.assertTrue;

public class TestModel {

protected final MyTestCase testCase;
Expand All @@ -10,5 +14,7 @@ public TestModel(MyTestCase testCase) {
this.testCase = testCase;
}


public static void assertArrayEquals(Object[] expected, Object[] actual) {
assertTrue(Arrays.equals(expected, actual));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.math.RoundingMode;
import java.util.stream.StreamSupport;

import static org.junit.Assert.*;
import static junit.framework.Assert.*;

public class VariableTestModel extends TestModel {

Expand Down

0 comments on commit 29bb28d

Please sign in to comment.