-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
249 lines (207 loc) · 7 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
import org.gradle.api.JavaVersion.VERSION_11
import org.jetbrains.intellij.tasks.PrepareSandboxTask
import org.jetbrains.intellij.tasks.RunPluginVerifierTask
buildscript {
dependencies {
classpath("org.commonmark:commonmark:0.17.2")
}
repositories {
mavenCentral()
maven { setUrl("https://www.jetbrains.com/intellij-repository/releases") }
}
}
plugins {
idea
id("org.jetbrains.intellij") version "1.10.1"
id("org.jetbrains.changelog") version "1.3.1"
}
val pluginVersion = prop("pluginVersion")
val lombokVersion = prop("lombokVersion")
val appMapJvmAgentVersion = prop("appMapJvmAgent")
group = "appland.appmap"
version = pluginVersion
val isCI = System.getenv("CI") == "true"
allprojects {
repositories {
mavenCentral()
maven { setUrl("https://www.jetbrains.com/intellij-repository/releases") }
}
apply {
plugin("idea")
plugin("org.jetbrains.intellij")
}
val testOutput = configurations.create("testOutput")
dependencies {
// for compatibility with IntelliJ Ultimate, IU-2021.3.3 doesn't include this for unknown reasons
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
// http://wiremock.org, Apache 2 license
testImplementation("com.github.tomakehurst:wiremock-jre8:2.33.1")
// Project Lombok, only for compilation
compileOnly("org.projectlombok:lombok:$lombokVersion")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
// share test classes of plugin-core with other Gradle modules
testOutput(sourceSets.getByName("test").output)
if (project.name != "plugin-core") {
testImplementation(project(":plugin-core", "testOutput"))
}
}
intellij {
version.set(prop("ideVersion"))
downloadSources.set(!isCI)
updateSinceUntilBuild.set(true)
instrumentCode.set(true)
}
configure<JavaPluginExtension> {
sourceCompatibility = VERSION_11
targetCompatibility = VERSION_11
}
tasks {
buildSearchableOptions.get().enabled = false
buildPlugin {
dependsOn(":copyPluginAssets")
from("${rootProject.buildDir}/appmap-assets") {
into("")
include("**/*")
}
}
processTestResources {
dependsOn(":copyPluginAssets")
from("${rootProject.buildDir}/appmap-assets") {
into("")
include("**/*")
}
}
runIde {
onlyIf { this.project == rootProject }
systemProperty("appmap.sandbox", "true")
}
verifyPlugin {
onlyIf { this.project == rootProject }
}
withType<PrepareSandboxTask> {
dependsOn(":copyPluginAssets")
from("${rootProject.buildDir}/appmap-assets") {
into(intellij.pluginName.get())
include("**/*")
}
}
withType<Test> {
systemProperty("idea.test.execution.policy", "appland.AppLandTestExecutionPolicy")
systemProperty("appland.testDataPath", rootProject.rootDir.resolve("src/test/data").path)
// to allow tests to access the custom Java 11 JDK
systemProperties["NO_FS_ROOTS_ACCESS_CHECK"] = true
if (isCI) {
testLogging {
setEvents(listOf("failed", "standardError"))
}
}
}
withType<RunPluginVerifierTask> {
onlyIf { this.project == rootProject }
ideVersions.set(prop("ideVersionVerifier").split(","))
}
withType<Zip> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
}
project(":") {
val appMapJavaAgent = configurations.create("appMapJavaAgent")
dependencies {
implementation(project(":plugin-core"))
implementation(project(":plugin-gradle"))
implementation(project(":plugin-java"))
implementation(project(":plugin-maven"))
// to copy the appmap-java jar file into the plugin zip
appMapJavaAgent("com.appland:appmap-agent:$appMapJvmAgentVersion")
}
changelog {
path.set("${project.projectDir}/CHANGELOG.md")
}
tasks {
task<Copy>("copyPluginAssets") {
inputs.files("${project.rootDir}/appland")
inputs.files("${project.rootDir}/appland-install-guide")
inputs.files(appMapJavaAgent)
destinationDir = project.buildDir
from("${project.rootDir}/appland") {
into("appmap-assets/appmap")
include("index.html")
include("dist/**")
}
from("${project.rootDir}/appland-install-guide") {
into("appmap-assets/appland-install-guide")
include("index.html")
include("dist/**")
}
from(appMapJavaAgent) {
into("appmap-assets/appmap-agents")
rename {
when (it.startsWith("appmap-agent-")) {
true -> "appmap-agent.jar"
false -> name
}
}
}
processResources {
dependsOn("copyPluginAssets")
}
instrumentCode {
dependsOn("copyPluginAssets")
}
jar {
dependsOn("copyPluginAssets")
}
}
patchPluginXml {
sinceBuild.set(prop("sinceBuild"))
untilBuild.set(prop("untilBuild"))
pluginDescription.set(file("${rootDir}/description.md").readText().renderMarkdown())
changeNotes.set(provider {
if (pluginVersion.endsWith("-SNAPSHOT")) {
changelog.getUnreleased().toHTML()
} else {
changelog.get(pluginVersion).toHTML()
}
})
}
}
}
project(":plugin-java") {
dependencies {
implementation(project(":plugin-core"))
}
intellij {
plugins.set(listOf("java"))
}
}
project(":plugin-gradle") {
dependencies {
implementation(project(":plugin-core"))
implementation(project(":plugin-java"))
}
intellij {
plugins.set(listOf("java", "gradle"))
}
}
project(":plugin-maven") {
dependencies {
implementation(project(":plugin-core"))
implementation(project(":plugin-java"))
}
intellij {
plugins.set(listOf("java", "maven"))
}
}
// https://github.com/commonmark/commonmark-java
fun String.renderMarkdown(): String {
val parser = Parser.builder().build()
val document = parser.parse(this)
val renderer = HtmlRenderer.builder().build()
return renderer.render(document).trim()
}
fun prop(name: String): String {
return extra.properties[name] as? String ?: error("Property `$name` is not defined in gradle.properties")
}