-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
114 lines (98 loc) · 2.72 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
114 lines (98 loc) · 2.72 KB
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun config(name: String) = project.findProperty(name).toString()
repositories {
mavenCentral()
}
plugins {
java
kotlin("jvm") version "1.5.10"
id("org.jetbrains.intellij") version "0.7.2"
}
group = "dev.meanmail"
version = "${config("version")}-${config("postfix")}"
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation("junit:junit:4.13.2")
}
intellij {
pluginName = config("pluginName")
version = if (config("ideVersion") == "eap") {
"LATEST-EAP-SNAPSHOT"
} else {
config("ideVersion")
}
type = config("ideType")
val languages = config("languages").split(',').map {
it.trim().toLowerCase()
}
if ("python" in languages) {
when (type) {
"PY" -> {
setPlugins("python")
}
"PC" -> {
setPlugins("PythonCore")
}
else -> {
setPlugins("PythonCore:${config("PythonCore")}")
}
}
}
}
fun readChangeNotes(pathname: String): String {
val lines = file(pathname).readLines()
val notes: MutableList<MutableList<String>> = mutableListOf()
var note: MutableList<String>? = null
for (line in lines) {
if (line.startsWith('#')) {
if (notes.size == 3) {
break
}
note = mutableListOf()
notes.add(note)
val header = line.trimStart('#')
note.add("<b>$header</b>")
} else if (line.isNotBlank()) {
note?.add(line)
}
}
return notes.joinToString(
"</p><br><p>",
prefix = "<p>",
postfix = "</p><br>"
) {
it.joinToString("<br>")
} +
"See the full change notes on the <a href='" +
config("repository") +
"/blob/master/CHANGES.md'>github</a>"
}
tasks {
withType<JavaCompile> {
sourceCompatibility = config("jvmVersion")
targetCompatibility = config("jvmVersion")
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = config("jvmVersion")
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = config("jvmVersion")
}
withType<Wrapper> {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = config("gradleVersion")
}
test {
useJUnit()
maxHeapSize = "1G"
}
patchPluginXml {
setPluginDescription(file("description.html").readText())
setChangeNotes(readChangeNotes("CHANGES.md"))
}
publishPlugin {
dependsOn("buildPlugin")
setToken(System.getenv("PUBLISH_TOKEN"))
setChannels(listOf(config("publishChannel")))
}
}