-
Notifications
You must be signed in to change notification settings - Fork 25
/
build.gradle.kts
212 lines (186 loc) · 6.71 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
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
plugins {
id("java")
alias(libs.plugins.kotlin.jvm)
id("org.jetbrains.intellij.platform") version "2.1.0"
}
repositories {
mavenCentral()
mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots")
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
data class PluginDescriptor(
val since: String, // earliest version string this is compatible with
val until: String, // latest version string this is compatible with, can be wildcard like 202.*
// https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
val sdkVersion: String, // the version string passed to the intellij sdk gradle plugin
val sourceFolder: String, // used as the source root for specifics of this build
val useInstaller: Boolean, // required to be false for EAP builds
)
// https://jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
// useful link for kotlin plugin versions:
// https://plugins.jetbrains.com/plugin/6954-kotlin/versions
// json output of versions:
// https://jb.gg/intellij-platform-builds-list
// json output but restricted to IDEA ultimate:
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIU
// when releasing for an EAP, look at snapshots and see the column called build number
// https://www.jetbrains.com/intellij-repository/snapshots
// for the sdk version we can use IC-2021.1 if the product is released
// or IC-213-EAP-SNAPSHOT if not
// for 'since' we can use an early build number without eap/snapshot eg 213.5281.15
// and 'until' we can use a wildcard eg 213.*
val descriptors = listOf(
PluginDescriptor(
since = "231.8109.163", // this version is 2023.1 release
until = "231.*",
sdkVersion = "2023.1",
sourceFolder = "IC-231",
useInstaller = true,
),
PluginDescriptor(
since = "232.5150.116", // this version is 2023.2
until = "232.*",
sdkVersion = "2023.2",
sourceFolder = "IC-232",
useInstaller = true,
),
PluginDescriptor(
since = "233.9802.16", // this version is 2023.3
until = "233.*",
sdkVersion = "2023.3",
sourceFolder = "IC-233",
useInstaller = true,
),
PluginDescriptor(
since = "241.15989.150", // this version is 2024.1.x
until = "242.*",
sdkVersion = "2024.1",
sourceFolder = "IC-241",
useInstaller = true,
),
PluginDescriptor(
since = "242.*", // this version is 2024.2.x
until = "243.*",
sdkVersion = "2024.2.2",
sourceFolder = "IC-242",
useInstaller = true,
),
PluginDescriptor(
since = "243.*", // this version is 2024.3.x
until = "244.*",
sdkVersion = "243-EAP-SNAPSHOT",
sourceFolder = "IC-243",
useInstaller = false,
),
)
val productName = System.getenv("PRODUCT_NAME") ?: "IC-243"
val jvmTargetVersion = System.getenv("JVM_TARGET") ?: "11"
val descriptor = descriptors.first { it.sourceFolder == productName }
val jetbrainsToken: String by project
version = "1.3." + (System.getenv("GITHUB_RUN_NUMBER") ?: "0-SNAPSHOT")
val runWithCustomSandbox by intellijPlatformTesting.runIde.registering {
prepareSandboxTask {
sandboxDirectory = project.layout.buildDirectory.dir(project.property("sandbox").toString())
sandboxSuffix = ""
}
}
val runWithK2Mode by intellijPlatformTesting.runIde.registering {
task {
jvmArgs = listOf("-Didea.kotlin.plugin.use.k2=true")
}
}
intellijPlatform {
buildSearchableOptions = false
projectName = project.name
instrumentCode = true
pluginConfiguration {
name = "kotest"
id = "kotest-plugin-intellij"
description = "Kotest individual test support inside the IDE"
version = project.version.toString() + "-" + descriptor.sdkVersion
vendor {
name = "Kotest"
url = "https://kotest.io"
email = "[email protected]"
}
}
publishing {
version = project.version.toString() + "-" + descriptor.sdkVersion
token = System.getenv("JETBRAINS_TOKEN") ?: jetbrainsToken
}
}
dependencies {
testImplementation("junit:junit:4.13.2")
intellijPlatform {
// snapshots here https://www.jetbrains.com/intellij-repository/snapshots/
intellijIdeaCommunity(descriptor.sdkVersion, useInstaller = descriptor.useInstaller)
if (!descriptor.useInstaller)
jetbrainsRuntime()
instrumentationTools()
pluginVerifier()
zipSigner()
bundledPlugin("com.intellij.java")
bundledPlugin("org.jetbrains.kotlin")
bundledPlugin("org.jetbrains.plugins.gradle")
testFramework(TestFrameworkType.Plugin.Java)
}
// we bundle this for 4.1 support
// in kotest 4.2.0 the launcher has moved to a stand-alone module
implementation(libs.runtime.kotest.legacy.launcher)
// this is needed to use the launcher in 4.2.0, in 4.2.1+ the launcher is built
// into the engine dep which should already be on the classpath
implementation(libs.runtime.kotest.framework.launcher) {
}
// needed for the resource files which are loaded into java light tests
testImplementation(libs.test.kotest.framework.api)
testImplementation(libs.test.kotest.assertions.core)
// testRuntimeOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
}
configurations.runtimeOnly {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core-jvm")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-jdk8")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-test")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-test-jvm")
}
sourceSets {
main {
kotlin {
srcDir("src/${descriptor.sourceFolder}/kotlin")
}
resources {
srcDir("src/${descriptor.sourceFolder}/resources")
}
}
}
kotlin {
compilerOptions {
jvmToolchain(JavaLanguageVersion.of(jvmTargetVersion).asInt())
}
}
tasks {
test {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
include("**/*Test.class")
include("**/*Tests.class")
}
}
tasks {
printProductsReleases {
channels = listOf(ProductRelease.Channel.EAP)
types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
untilBuild = provider { null }
doLast {
val latestEap = productsReleases.get().max()
println("Latest EAP build: $latestEap")
}
}
}