-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
156 lines (135 loc) · 4.82 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
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import kotlin.math.sin
group = "com.squareup.cash.hermit"
version = project.properties["version"] ?: "1.0-SNAPSHOT"
plugins {
id("java")
kotlin("kapt") version "1.9.25"
id("org.jetbrains.intellij.platform") version "2.0.1"
id("org.jetbrains.kotlin.jvm") version "1.9.25"
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.25"
}
// region Build, dependencies
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
data class Product(
val releaseType: String, // identifier for this product
val sdkVersion: String, // the version string passed to the intellij sdk gradle plugin
val goPluginVersion: String, // a specific version for the go plugin
val intellijVersion: String,
val golandVersion: String,
)
val products = listOf(
Product(
releaseType = "release",
sdkVersion = properties["IIC.release.version"] as String,
goPluginVersion = properties["IIC.release.go_plugin.version"] as String,
intellijVersion = properties["IIC.release.version"] as String,
golandVersion = properties["GO.release.version"] as String,
),
Product(
releaseType = "eap",
// "<major version>-EAP-SNAPSHOT"
sdkVersion = "${(properties["IIC.eap.version"] as String).split(".")[0]}-EAP-SNAPSHOT",
goPluginVersion = properties["IIC.eap.go_plugin.version"] as String,
intellijVersion = properties["IIC.eap.version"] as String,
golandVersion = properties["GO.eap.version"] as String,
),
)
val product = products.first { it.releaseType == (System.getenv("RELEASE_TYPE") ?: "release") }
val verifyOldVersions = System.getenv("VERIFY_VERSIONS") == "old"
val kotlinVersion = "1.9.25"
val arrowVersion = "0.11.0"
dependencies {
intellijPlatform {
intellijIdeaUltimate(product.sdkVersion, useInstaller = false)
pluginVerifier("1.378")
plugins(
"org.jetbrains.plugins.go:${product.goPluginVersion}"
)
bundledPlugins(
"com.intellij.gradle",
"com.intellij.java",
"com.intellij.properties",
// Needed by Go plugin. See https://github.com/JetBrains/gradle-intellij-plugin/issues/1056
"org.intellij.intelliLang"
)
testFramework(TestFrameworkType.Bundled, product.sdkVersion)
}
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2")
implementation("io.arrow-kt:arrow-core:$arrowVersion")
implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
kapt("io.arrow-kt:arrow-meta:$arrowVersion")
testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
}
test {
systemProperty("idea.force.use.core.classloader", "true")
}
}
intellijPlatform {
version = version
projectName = project.name
instrumentCode = false // We don't need to scan codebase for jetbrains annotations
//type.set("IU")
pluginVerification {
// These need to match the versions from
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIC,IIE,GO
if (verifyOldVersions) {
ides {
select {
types = listOf(IntelliJPlatformType.IntellijIdeaUltimate)
sinceBuild = project.properties["IIC.from.version"] as String
untilBuild = project.properties["IIC.from.version"] as String
}
select {
types = listOf(IntelliJPlatformType.GoLand)
sinceBuild = project.properties["GO.from.version"] as String
untilBuild = project.properties["GO.from.version"] as String
}
}
} else {
ides {
select {
types = listOf(IntelliJPlatformType.IntellijIdeaUltimate)
sinceBuild = product.intellijVersion
untilBuild = product.intellijVersion
}
select {
types = listOf(IntelliJPlatformType.GoLand)
sinceBuild = product.golandVersion
untilBuild = product.golandVersion
}
}
}
}
}
tasks {
patchPluginXml {
sinceBuild.set(project.properties["IIC.from.version"] as String)
val versionSuffix = when(product.releaseType) {
"release" -> ""
else -> "-${product.releaseType}"
}
version = "${System.getenv("IJ_PLUGIN_VERSION")}${versionSuffix}" // IJ_PLUGIN_VERSION env var available in CI
}
publishPlugin {
token.set(System.getenv("JETBRAINS_TOKEN")) // JETBRAINS_TOKEN env var available in CI
}
}