-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathbuild.gradle.kts
205 lines (174 loc) · 6.87 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
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.5.0"
}
repositories {
mavenCentral()
mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots")
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
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-241 if the product is released or 243-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.*
// this page shows android studio versions and the corresponding intellij version that is behind it
// https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html#2024
val descriptors = listOf(
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 = "252.*",
sdkVersion = "2024.3.1",
sourceFolder = "IC-243",
useInstaller = true,
),
PluginDescriptor(
since = "251.*", // this version is 2025.1.x
until = "252.*",
sdkVersion = "251-EAP-SNAPSHOT",
sourceFolder = "IC-251",
useInstaller = false,
),
)
val productName = System.getenv("PRODUCT_NAME") ?: "IC-243"
val jvmTargetVersion = System.getenv("JVM_TARGET") ?: "17"
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 {
// https://youtrack.jetbrains.com/issue/IJPL-159134/JUnit5-Test-Framework-refers-to-JUnit4-java.lang.NoClassDefFoundError-junit-framework-TestCase
testImplementation("junit:junit:4.13.2")
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
// snapshots here https://www.jetbrains.com/intellij-repository/snapshots/
intellijIdeaCommunity(descriptor.sdkVersion, useInstaller = descriptor.useInstaller)
if (!descriptor.useInstaller) {
jetbrainsRuntime()
}
pluginVerifier()
zipSigner()
bundledPlugin("com.intellij.java")
bundledPlugin("org.jetbrains.kotlin")
bundledPlugin("org.jetbrains.plugins.gradle")
// this is workaround for a bug in intellij itself
// see https://jetbrains-platform.slack.com/archives/C5U8BM1MK/p1734228390297349
if (descriptor.sdkVersion == "2024.3.1") {
bundledPlugin("com.intellij.llmInstaller")
}
testFramework(TestFrameworkType.Plugin.Java)
}
// 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")
}
}
}