ZigBrains/build.gradle.kts

178 lines
5.1 KiB
Text
Raw Normal View History

2024-10-28 02:05:12 +01:00
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
2024-11-03 17:26:42 +01:00
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
2024-10-28 02:05:12 +01:00
plugins {
2024-10-28 15:22:57 +01:00
kotlin("jvm") version "1.9.24" apply false
2024-11-02 23:08:57 +01:00
kotlin("plugin.serialization") version "1.9.24" apply false
2024-10-28 02:05:12 +01:00
id("org.jetbrains.intellij.platform") version "2.1.0"
id("org.jetbrains.changelog") version "2.2.1"
2024-10-28 15:22:57 +01:00
id("org.jetbrains.grammarkit") version "2022.3.2.2" apply false
idea
2024-10-28 02:05:12 +01:00
}
2024-11-03 16:45:14 +01:00
val pluginSinceBuild: String by project
val pluginUntilBuild: String by project
2024-10-29 23:20:12 +01:00
val javaVersion = property("javaVersion").toString().toInt()
val lsp4ijVersion: String by project
val runIdeTarget: String by project
2024-10-29 23:20:12 +01:00
val lsp4ijNightly = property("lsp4ijNightly").toString().toBoolean()
val lsp4ijPluginString = "com.redhat.devtools.lsp4ij:$lsp4ijVersion${if (lsp4ijNightly) "@nightly" else ""}"
2024-10-28 02:05:12 +01:00
group = "com.falsepattern"
version = providers.gradleProperty("pluginVersion").get()
subprojects {
apply(plugin = "java")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.intellij.platform.module")
2024-10-28 15:22:57 +01:00
apply(plugin = "idea")
extensions.configure<KotlinJvmProjectExtension>("kotlin") {
jvmToolchain(javaVersion)
}
2024-11-03 17:26:42 +01:00
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
freeCompilerArgs.addAll("-Xlambdas=indy")
}
}
2024-10-28 02:05:12 +01:00
}
tasks {
processResources {
from("LICENSE")
from("licenses") {
into("licenses")
}
}
}
allprojects {
2024-10-28 15:22:57 +01:00
idea {
module {
isDownloadJavadoc = false
isDownloadSources = true
}
2024-10-28 02:05:12 +01:00
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
2024-10-28 15:22:57 +01:00
@Suppress("UnstableApiUsage")
2024-10-28 02:05:12 +01:00
vendor = JvmVendorSpec.JETBRAINS
}
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
instrumentationTools()
}
}
}
dependencies {
intellijPlatform {
when(runIdeTarget) {
"ideaCommunity" -> create(IntelliJPlatformType.IntellijIdeaCommunity, providers.gradleProperty("ideaCommunityVersion"))
"clion" -> create(IntelliJPlatformType.CLion, providers.gradleProperty("clionVersion"))
}
2024-10-28 02:05:12 +01:00
pluginVerifier()
zipSigner()
2024-10-29 23:20:12 +01:00
plugin(lsp4ijPluginString)
2024-10-28 02:05:12 +01:00
}
implementation(project(":core"))
implementation(project(":cidr"))
2024-10-28 02:05:12 +01:00
}
intellijPlatform {
pluginConfiguration {
version = providers.gradleProperty("pluginVersion")
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"
with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}
val changelog = project.changelog
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML
)
}
}
ideaVersion {
2024-11-03 16:45:14 +01:00
sinceBuild = pluginSinceBuild
if (pluginUntilBuild.isNotBlank()) {
untilBuild = pluginUntilBuild
}
2024-10-28 02:05:12 +01:00
}
}
signing {
certificateChainFile = file("secrets/chain.crt")
privateKeyFile = file("secrets/private.pem")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}
publishing {
token = providers.environmentVariable("PUBLISH_TOKEN")
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}
pluginVerification {
ides {
2024-11-03 16:45:14 +01:00
select {
types = listOf(
IntelliJPlatformType.IntellijIdeaCommunity,
IntelliJPlatformType.IntellijIdeaUltimate,
IntelliJPlatformType.CLion
)
}
2024-10-28 02:05:12 +01:00
}
}
buildSearchableOptions = false
2024-10-28 15:22:57 +01:00
instrumentCode = false
2024-10-28 02:05:12 +01:00
}
changelog {
groups.empty()
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}
tasks {
publishPlugin {
dependsOn(patchChangelog)
}
2024-10-28 15:22:57 +01:00
compileJava {
enabled = false
}
classes {
enabled = false
}
2024-10-28 02:05:12 +01:00
}