2024-11-03 16:17:30 +01:00
|
|
|
import nl.adaptivity.xmlutil.core.impl.multiplatform.name
|
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
|
2024-11-03 16:17:30 +01:00
|
|
|
import org.jetbrains.intellij.platform.gradle.tasks.ComposedJarTask
|
|
|
|
import org.jetbrains.intellij.platform.gradle.tasks.InstrumentedJarTask
|
2024-10-28 02:05:12 +01:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
|
|
|
|
|
|
|
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-10-29 23:20:12 +01:00
|
|
|
val javaVersion = property("javaVersion").toString().toInt()
|
|
|
|
val lsp4ijVersion: String by project
|
2024-11-03 16:17:30 +01:00
|
|
|
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-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 {
|
2024-11-03 16:17:30 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2024-10-30 16:40:45 +01:00
|
|
|
implementation(project(":core"))
|
2024-11-03 16:17:30 +01:00
|
|
|
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 {
|
|
|
|
sinceBuild = providers.gradleProperty("pluginSinceBuild")
|
|
|
|
untilBuild = providers.gradleProperty("pluginUntilBuild")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
|
|
|
recommended()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|