forked from nocalhost/nocalhost-intellij-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
137 lines (116 loc) · 4.45 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
plugins {
id("org.jetbrains.intellij") version "1.12.0"
java
kotlin("jvm") version "1.7.21"
id("io.franzbecker.gradle-lombok") version "2.1"
id("net.saliman.properties") version "1.5.1"
}
java {
sourceCompatibility = JavaVersion.valueOf(prop("javaCompatibility"))
targetCompatibility = JavaVersion.valueOf(prop("javaCompatibility"))
}
group = "dev.nocalhost"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib", "1.5.10"))
implementation("com.squareup.okhttp3:okhttp:4.9.0")
implementation("com.auth0:java-jwt:3.12.0")
implementation("com.google.code.gson:gson:2.8.6")
// If import guava, NocalhostNodeConfiguration#createDebugProcess will report the following error at runtime, `com.jetbrains:ideaIU` has built-in guava, so remove the dependency here
// Error running 'Nocalhost': loader constraint violation: loader com.intellij.ide.plugins.cl.PluginClassLoader @690f178e (instance of com.intellij.ide.plugins.cl.PluginClassLoader, child of 'bootstrap') wants to load interface com.google.common.collect.BiMap. A different interface with the same name was previously loaded by com.intellij.ide.plugins.cl.PluginClassLoader @1acb7e07 (instance of com.intellij.ide.plugins.cl.PluginClassLoader, child of 'bootstrap').
// implementation("com.google.guava:guava:27.1-jre")
implementation("org.yaml:snakeyaml:1.27")
implementation("com.github.zafarkhaja:java-semver:0.9.0")
implementation("io.sentry:sentry:1.7.23") {
exclude("org.slf4j")
}
implementation("com.github.briandilley.jsonrpc4j:jsonrpc4j:1.6") {
exclude("org.slf4j")
}
annotationProcessor("org.projectlombok:lombok:1.18.24")
testAnnotationProcessor("org.projectlombok:lombok:1.18.24")
testImplementation("junit", "junit", "4.12")
}
var baseIDE = "IU"
if (project.hasProperty("baseIDE")) {
baseIDE = project.property("baseIDE") as String
}
val platformVersion = prop("platformVersion").toInt()
val ideaVersion = prop("ideaVersion")
val nocalhostVersion = prop("version")
val changelogVersion = nocalhostVersion.replace("(\\d+\\.\\d+\\.)(\\d+)".toRegex(), "$1x")
val terminalPlugin = "terminal"
var javascriptPlugin = "JavaScript"
var javascriptDebuggerPlugin = "JavaScriptDebugger"
val javaPlugin = "com.intellij.java"
val phpPlugin = "com.jetbrains.php:" + prop("phpPluginVersion")
val goPlugin = "org.jetbrains.plugins.go:" + prop("goPluginVersion")
var pythonPlugin = "Pythonid:" + prop("pythonPluginVersion")
version = "$nocalhostVersion-$platformVersion"
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set(ideaVersion)
plugins.set(mutableListOf(
javascriptDebuggerPlugin,
javascriptPlugin,
terminalPlugin,
pythonPlugin,
javaPlugin,
phpPlugin,
goPlugin
))
pluginName.set("nocalhost-intellij-plugin")
updateSinceUntilBuild.set(true)
}
sourceSets {
main {
java.srcDirs("src/$platformVersion/main/java")
}
}
//Install other ide at your local and config these paths if you want to run other ide: RunGoland and so on
tasks.runIde {
if (baseIDE == "IC") {
ideDir.set(File("/Applications/IntelliJ IDEA CE.app/Contents"))
}
if (baseIDE == "GO") {
ideDir.set(File("/Applications/GoLand.app/Contents"))
}
if (baseIDE == "Node") {
ideDir.set(File("/Applications/WebStorm.app/Contents"))
}
if (baseIDE == "Python") {
ideDir.set(File("/Applications/PyCharm.app/Contents"))
}
if (baseIDE == "PHP") {
ideDir.set(File("/Applications/PhpStorm.app/Contents"))
}
}
tasks {
patchPluginXml {
pluginId.set("dev.nocalhost.nocalhost-intellij-plugin")
pluginDescription.set(provider { file("description.html").readText() })
changeNotes.set(
"""
<h2>Version $nocalhostVersion</h2>
<p>
<a href="https://nocalhost.dev/docs/changelogs/$changelogVersion/">https://nocalhost.dev/docs/changelogs/$changelogVersion</a>
</p>
"""
);
}
publishPlugin {
token.set(System.getenv("JETBRAINS_TOKEN"))
}
buildSearchableOptions {
enabled = false
}
}
tasks.withType(JavaCompile::class) {
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
fun prop(name: String): String =
extra.properties[name] as? String
?: error("Property `$name` is not defined in gradle.properties")