Skip to content

Commit 8118c3d

Browse files
committed
build: cleanup build script
1 parent f4b445e commit 8118c3d

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

build.gradle.kts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import org.jetbrains.grammarkit.tasks.GenerateLexerTask
44
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
55
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
66

7-
fun properties(key: String): String =
8-
property(key).toString()
7+
fun stringProperty(key: String, default: String? = null): String =
8+
findProperty(key)?.toString() ?: default ?: error("Expected a valid property $key")
99

1010
plugins {
1111
java
@@ -17,10 +17,11 @@ plugins {
1717
group = "com.github.lppedd"
1818

1919
repositories {
20+
mavenCentral()
21+
2022
// For org.everit.json.schema
2123
maven("https://jitpack.io")
2224
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
23-
mavenCentral()
2425
}
2526

2627
dependencies {
@@ -37,8 +38,8 @@ dependencies {
3738
}
3839

3940
intellij {
40-
type = properties("platformType")
41-
version = properties("platformVersion")
41+
type = stringProperty("platformType")
42+
version = stringProperty("platformVersion")
4243
downloadSources = true
4344
pluginName = "idea-conventional-commit"
4445
plugins = listOf("java")
@@ -68,14 +69,15 @@ kotlin {
6869
compilerOptions {
6970
jvmTarget = JvmTarget.JVM_17
7071
languageVersion = KotlinVersion.KOTLIN_1_9
71-
optIn.add("kotlin.contracts.ExperimentalContracts")
7272
freeCompilerArgs.addAll(
7373
"-Xno-call-assertions",
7474
"-Xno-receiver-assertions",
7575
"-Xno-param-assertions",
7676
"-Xjvm-default=all",
7777
"-Xallow-kotlin-package",
7878
)
79+
80+
optIn.add("kotlin.contracts.ExperimentalContracts")
7981
}
8082
}
8183

@@ -104,8 +106,8 @@ tasks {
104106

105107
patchPluginXml {
106108
version = versionStr
107-
sinceBuild = properties("pluginSinceBuild")
108-
untilBuild = properties("pluginUntilBuild")
109+
sinceBuild = stringProperty("pluginSinceBuild")
110+
untilBuild = stringProperty("pluginUntilBuild")
109111

110112
val pluginDescriptionFile = File("$projectPath/plugin-description.html")
111113
pluginDescription = pluginDescriptionFile.readText()
@@ -136,13 +138,14 @@ tasks {
136138
"IC-2022.3",
137139
"IC-2023.1",
138140
"IC-2023.3",
141+
"IC-2024.1",
139142
)
140143
}
141144

142145
runIde {
143-
val dcevm = findProperty("dcevmExecutable")
146+
val dcevm = stringProperty("dcevmExecutable", default = "")
144147

145-
if (dcevm is String && dcevm.isNotBlank()) {
148+
if (dcevm.isNotBlank()) {
146149
executable = dcevm
147150
}
148151
}

0 commit comments

Comments
 (0)