-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
153 lines (132 loc) · 5.1 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
153 lines (132 loc) · 5.1 KB
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
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.date
import java.util.*
plugins {
id("java")
// Must match the Kotlin version bundled with the IDE
// https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
// https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
// https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
id("org.jetbrains.kotlin.jvm") version "2.1.20"
// https://plugins.gradle.org/plugin/org.jetbrains.intellij.platform
// https://github.com/JetBrains/gradle-intellij-plugin/releases
id("org.jetbrains.intellij.platform") version "2.5.0"
id("org.jetbrains.changelog") version "2.2.1"
}
group = project.providers.gradleProperty("pluginGroup").get()
version = project.providers.gradleProperty("pluginVersion").get()
kotlin {
jvmToolchain(21)
}
repositories {
google()
mavenCentral()
intellijPlatform {
defaultRepositories()
intellijDependencies()
}
}
dependencies {
intellijPlatform {
bundledPlugins(
"org.jetbrains.kotlin",
"org.jetbrains.android",
"com.intellij.java",
)
if (project.hasProperty("localIdeOverride")) {
local(property("localIdeOverride").toString())
} else {
androidStudio(property("ideVersion").toString())
}
}
}
intellijPlatform {
buildSearchableOptions = false
instrumentCode = true
projectName = project.name
autoReload = true
pluginConfiguration {
group = providers.gradleProperty("pluginGroup")
name = providers.gradleProperty("pluginName")
version = providers.gradleProperty("pluginVersion")
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("./keystore/chain.crt")
privateKeyFile = file("./keystore/private.pem")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}
publishing {
token = providers.provider {
val securePropsFile = rootProject.file("./keystore/publish.properties")
var foundToken: String? = null
if (securePropsFile.exists() && securePropsFile.isFile) {
try {
val properties = Properties()
securePropsFile.inputStream().use { properties.load(it) }
foundToken = properties.getProperty("publish.token")
if (!foundToken.isNullOrBlank()) {
project.logger.lifecycle("Using publish token from ${securePropsFile.name}")
} else {
foundToken = null
}
} catch (e: Exception) {
project.logger.warn("Could not read publish token from ${securePropsFile.absolutePath}: ${e.message}")
}
}
if (foundToken == null) {
foundToken = providers.environmentVariable("PUBLISH_TOKEN").orNull
if (!foundToken.isNullOrBlank()) {
project.logger.lifecycle("Using publish token from environment variable PUBLISH_TOKEN")
} else {
foundToken = null
}
}
// If still not found after checking both, fail the build configuration
// Or return null if the token is optional for some tasks (publishing task will likely fail later if null)
foundToken ?: error(
"""
Publish token not found in ${securePropsFile.name} (key 'publish.token') or environment variable 'PUBLISH_TOKEN'.
See build script for details.
""".trimIndent()
)
} // End provider lambda
} // End publishing block
pluginVerification {
ides {
recommended()
}
}
}
changelog {
header.set(provider { "[${version.get()}] - ${date()}" })
version.set(project.version.toString())
groups.empty()
keepUnreleasedSection.set(false)
itemPrefix.set("-")
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}
configurations.all {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
}
}