forked from JetBrains/intellij-platform-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
190 lines (161 loc) · 6.22 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
@file:Suppress("UnstableApiUsage")
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun properties(key: String) = project.findProperty(key)?.toString()
plugins {
kotlin("jvm") version "1.5.10"
id("java-gradle-plugin")
id("maven-publish")
id("com.gradle.plugin-publish") version "0.15.0"
id("synapticloop.documentr") version "3.1.0"
id("com.github.breadmoirai.github-release") version "2.2.12"
id("org.jetbrains.changelog") version "1.1.2"
}
repositories {
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
maven("https://cache-redirector.jetbrains.com/repo1.maven.org/maven2")
}
dependencies {
implementation("org.jetbrains:marketplace-zip-signer:0.1.5")
implementation("org.jetbrains:annotations:21.0.0")
implementation("org.jetbrains.intellij.plugins:structure-base:3.185")
implementation("org.jetbrains.intellij.plugins:structure-intellij:3.185")
implementation("javax.xml.bind:jaxb-api:2.3.1")
// should be changed together with plugin-repository-rest-client
implementation("org.jetbrains.intellij:blockmap:1.0.5") {
exclude(group = "org.jetbrains.kotlin")
}
implementation("org.jetbrains.intellij:plugin-repository-rest-client:2.0.20") {
exclude(group = "org.jetbrains.kotlin")
}
testImplementation(gradleTestKit())
testImplementation(kotlin("test"))
testImplementation(kotlin("test-junit"))
}
version = when (properties("snapshot")?.toBoolean() ?: false) {
true -> "${properties("snapshotVersion")}-SNAPSHOT"
false -> properties("version")
} ?: ""
group = "org.jetbrains.intellij.plugins"
description = """
**This project requires Gradle 6.6 or newer**
When upgrading to 1.x version, please make sure to follow migration guide to adjust your existing build script: https://lp.jetbrains.com/gradle-intellij-plugin
This plugin allows you to build plugins for IntelliJ Platform using specified IntelliJ SDK and bundled/3rd-party plugins.
The plugin adds extra IntelliJ-specific dependencies, patches `processResources` tasks to fill some tags
(name, version) in `plugin.xml` with appropriate values, patches compile tasks to instrument code with
nullability assertions and forms classes made with IntelliJ GUI Designer and provides some build steps which might be
helpful while developing plugins for IntelliJ platform.
"""
gradlePlugin {
plugins.create("intellijPlugin") {
id = "org.jetbrains.intellij"
displayName = "Gradle IntelliJ Plugin"
implementationClass = "org.jetbrains.intellij.IntelliJPlugin"
}
}
pluginBundle {
website = "https://github.com/JetBrains/gradle-intellij-plugin"
vcsUrl = "https://github.com/JetBrains/gradle-intellij-plugin"
description = "Plugin for building plugins for IntelliJ IDEs"
tags = listOf("intellij", "jetbrains", "idea")
}
val cacheIntolerantTest = tasks.register<Test>("cacheIntolerantTest") {
configureTests(this)
include("**/DownloadIntelliJSpec.class")
filter.isFailOnNoMatchingTests = false
}
tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
apiVersion = "1.3"
}
}
wrapper {
gradleVersion = "7.0.2"
distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
test {
configureTests(this)
exclude("**/DownloadIntelliJSpec.class")
dependsOn(cacheIntolerantTest)
}
}
fun configureTests(testTask: Test) {
val testGradleHomePath = "$buildDir/testGradleHome"
testTask.doFirst {
File(testGradleHomePath).mkdir()
}
testTask.systemProperties["test.gradle.home"] = testGradleHomePath
testTask.systemProperties["test.gradle.version"] = properties("testGradleVersion")
testTask.systemProperties["plugins.repository"] = properties("pluginsRepository")
testTask.outputs.dir(testGradleHomePath)
}
val javadocJar = tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
from(tasks.named("javadoc"))
}
val sourcesJar = tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
publishing {
repositories {
maven {
name = "snapshot"
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = properties("ossrhUsername")
password = properties("ossrhPassword")
}
}
}
publications {
create<MavenPublication>("snapshot") {
groupId = project.group.toString()
artifactId = project.name
version = version.toString()
from(components["java"])
artifact(sourcesJar.get())
artifact(javadocJar.get())
pom {
name.set("Gradle IntelliJ Plugin")
description.set(project.description)
url.set("https://github.com/JetBrains/gradle-intellij-plugin")
packaging = "jar"
scm {
connection.set("scm:git:https://github.com/JetBrains/gradle-intellij-plugin/")
developerConnection.set("scm:git:https://github.com/JetBrains/gradle-intellij-plugin/")
url.set("https://github.com/JetBrains/gradle-intellij-plugin/")
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("zolotov")
name.set("Alexander Zolotov")
email.set("[email protected]")
}
}
}
}
}
}
changelog {
version = "${project.version}"
path = "${project.projectDir}/CHANGES.md"
}
githubRelease {
val releaseNote = if (changelog.has("${project.version}")) {
changelog.get("${project.version}").toText()
} else {
""
}
setToken(properties("githubToken"))
owner.set("jetbrains")
repo.set("gradle-intellij-plugin")
body.set(releaseNote)
}