-
Notifications
You must be signed in to change notification settings - Fork 34
/
build.gradle.kts
207 lines (177 loc) · 7.11 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
import io.gitlab.arturbosch.detekt.Detekt
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
// reads properties from gradle.properties file
fun properties(key: String) = project.findProperty(key).toString()
plugins {
id("org.jetbrains.changelog") version "2.2.0"
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.kotlin.jvm") version "1.9.23"
id("io.gitlab.arturbosch.detekt") version ("1.23.6")
id("pl.allegro.tech.build.axion-release") version "1.17.0"
id("io.miret.etienne.sass") version "1.5.0"
}
version = scmVersion.version
group = properties("pluginGroup")
description = properties("pluginName")
val jdk = "17"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
implementation(platform("com.squareup.retrofit2:retrofit-bom:2.11.0"))
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.23.1")
implementation("org.commonmark:commonmark:0.21.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.segment.analytics.java:analytics:3.4.0")
implementation("io.sentry:sentry:6.27.0")
implementation("javax.xml.bind:jaxb-api:2.3.1") // necessary because since JDK 9 not included
implementation("com.squareup.retrofit2:retrofit")
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.0")
implementation("org.json:json:20231013")
implementation("org.slf4j:slf4j-api:2.0.5")
implementation("ly.iterative.itly:plugin-iteratively:1.2.11") {
exclude(group = "com.fasterxml.jackson.core")
}
implementation("ly.iterative.itly:plugin-schema-validator:1.2.11") {
exclude(group = "org.slf4j")
}
implementation("ly.iterative.itly:sdk-jvm:1.2.11") {
exclude(group = "org.json")
}
testImplementation("com.google.jimfs:jimfs:1.3.0")
testImplementation("com.squareup.okhttp3:mockwebserver")
testImplementation("junit:junit:4.13.2") {
exclude(group = "org.hamcrest")
}
testImplementation("org.hamcrest:hamcrest:2.2")
testImplementation("io.mockk:mockk:1.13.5")
testImplementation("org.awaitility:awaitility:4.2.0")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
}
// configuration for gradle-intellij-plugin plugin.
// read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set(properties("platformVersion"))
// https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
// type.set("IU")
downloadSources.set(properties("platformDownloadSources").toBoolean())
// plugin dependencies: uses `platformPlugins` property from the gradle.properties file.
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
}
// configure for detekt plugin.
// read more: https://detekt.github.io/detekt/kotlindsl.html
detekt {
config.setFrom("$projectDir/.github/detekt/detekt-config.yml")
baseline = file("$projectDir/.github/detekt/detekt-baseline.xml")
buildUponDefaultConfig = true
}
tasks {
// plugin from https://github.com/EtienneMiret/sass-gradle-plugin
compileSass {
sourceDir = project.file("${projectDir}/src/main/resources/stylesheets")
outputDir = project.file("${projectDir}/src/main/resources/stylesheets")
}
processResources{
dependsOn(compileSass)
}
compileKotlin{
dependsOn(processResources)
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = jdk
kotlinOptions.languageVersion = "1.9"
}
withType<JavaCompile> {
targetCompatibility = jdk
sourceCompatibility = jdk
}
withType<Detekt> {
jvmTarget = jdk
reports {
sarif {
required.set(true)
outputLocation.set(file("$buildDir/detekt.sarif"))
}
html.required.set(false)
xml.required.set(false)
txt.required.set(false)
}
}
withType<ProcessResources> {
val environment = project.findProperty("environment") ?: "DEVELOPMENT"
filesMatching("application.properties") {
val amplitudeExperimentApiKey = project.findProperty("amplitudeExperimentApiKey") ?: ""
val segmentWriteKey = project.findProperty("segmentWriteKey") ?: ""
val sentryDsnKey = project.findProperty("sentryDsn") ?: ""
val tokens = mapOf(
"amplitude.experiment.api-key" to amplitudeExperimentApiKey,
"environment" to environment,
"segment.analytics.write-key" to segmentWriteKey,
"sentry.dsn" to sentryDsnKey
)
filter<ReplaceTokens>("tokens" to tokens)
}
}
withType<Test> {
maxHeapSize = "2048m"
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}
val createOpenApiSourceJar by registering(Jar::class) {
// Java sources
from(sourceSets.main.get().java) {
include("**/*.java")
}
// Kotlin sources
from(kotlin.sourceSets.main.get().kotlin) {
include("**/*.kt")
}
destinationDirectory.set(layout.buildDirectory.dir("libs"))
archiveClassifier.set("src")
}
buildPlugin {
dependsOn(createOpenApiSourceJar)
from(createOpenApiSourceJar) { into("lib/src") }
}
buildSearchableOptions {
enabled = false
}
patchPluginXml {
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
val content = File("$projectDir/README.md").readText()
val startIndex = content.indexOf("# JetBrains plugin")
val descriptionFromReadme = content.substring(startIndex).lines().joinToString("\n").run { markdownToHTML(this) }
pluginDescription.set(descriptionFromReadme)
changeNotes.set(provider { changelog.renderItem(changelog.getLatest(), Changelog.OutputType.HTML) })
}
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
}
runIde {
maxHeapSize = "2g"
autoReloadPlugins.set(false)
if (properties("localIdeDirectory").isNotEmpty()) {
ideDir.set(File(properties("localIdeDirectory")))
}
}
runPluginVerifier {
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
failureLevel.set(
listOf(
org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.COMPATIBILITY_PROBLEMS,
org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.INVALID_PLUGIN
)
)
}
}