-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
127 lines (106 loc) · 3.19 KB
/
build.gradle.kts
File metadata and controls
127 lines (106 loc) · 3.19 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
115
116
117
118
119
120
121
122
123
124
125
126
127
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun config(name: String) = project.findProperty(name).toString()
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
plugins {
java
alias(libs.plugins.kotlin)
alias(libs.plugins.intelliJPlatform)
alias(libs.plugins.kotlinSerialization)
}
group = config("group")
version = config("version")
dependencies {
implementation(libs.kotlinxSerialization)
testImplementation(libs.junit)
intellijPlatform {
create(config("platformType"), config("platformVersion"))
val plugins = providers.gradleProperty("plugins").map { it.split(',') }
if (plugins.isPresent && plugins.get().isNotEmpty()) {
plugins(plugins)
}
val platformBundledPlugins = providers.gradleProperty("platformBundledPlugins").map { it.split(',') }
if (platformBundledPlugins.isPresent && platformBundledPlugins.get().isNotEmpty()) {
bundledPlugins(platformBundledPlugins)
}
pluginVerifier()
zipSigner()
testFramework(TestFrameworkType.Platform)
}
}
intellijPlatform {
pluginConfiguration {
name.set(config("pluginName"))
version.set(project.version.toString())
description.set(file("description.html").readText())
changeNotes.set(readChangeNotes("CHANGES.md"))
ideaVersion {
sinceBuild.set(config("platformSinceBuild"))
}
}
buildSearchableOptions = false
pluginVerification.ides {
recommended()
}
publishing {
try {
token.set(file("token.txt").readLines()[0])
} catch (e: Exception) {
println("No token.txt found")
}
channels.set(listOf(config("publishChannel")))
}
}
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 {
config("jvmVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.fromTarget(it))
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = config("gradleVersion")
}
test {
useJUnit()
maxHeapSize = "1G"
}
}