-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle.kts
219 lines (194 loc) · 7.52 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
import java.util.Calendar
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("app.cash.licensee:licensee-gradle-plugin:1.7.0")
}
}
plugins {
id("com.diffplug.spotless") apply false
id("org.jetbrains.kotlin.jvm") apply false
id("io.gitlab.arturbosch.detekt") apply false
id("org.jetbrains.intellij") version "1.15.0"
id("com.asarkar.gradle.build-time-tracker") version "4.3.0"
}
val pluginGroup: String by project
val pluginName: String by project
val projectVersion: String by project
val pluginSinceBuild: String by project
val vertxVersion: String by project
val kotlinVersion: String by project
val platformType: String by project
val ideVersion: String by project
val platformPlugins: String by project
val platformDownloadSources: String by project
group = pluginGroup
version = projectVersion
allprojects {
repositories {
mavenCentral()
}
apply(plugin = "org.jetbrains.intellij")
configurations.all {
resolutionStrategy {
eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion(kotlinVersion)
}
}
eachDependency {
if (requested.name == "kotlinx-coroutines-core-jvm") {
useVersion("1.6.4")
}
}
}
}
intellij {
pluginName.set("interface-jetbrains")
version.set(ideVersion)
type.set(platformType)
downloadSources.set(platformDownloadSources.toBoolean())
updateSinceUntilBuild.set(false)
plugins.set(platformPlugins.split(',').map(String::trim).filter(String::isNotEmpty).toMutableList())
//plugins.add("com.intellij.zh:222.202") //test chinese locale
}
tasks {
// Disable all Gradle Tasks for the gradle-intellij-plugin as we only use the plugin for the dependencies
buildPlugin { enabled = false }
buildSearchableOptions { enabled = false }
downloadRobotServerPlugin { enabled = false }
jarSearchableOptions { enabled = false }
patchPluginXml { enabled = false }
prepareSandbox { enabled = false }
prepareTestingSandbox { enabled = false }
prepareUiTestingSandbox { enabled = false }
publishPlugin { enabled = false }
runIde { enabled = false }
runIdeForUiTests { enabled = false }
runPluginVerifier { enabled = false }
signPlugin { enabled = false }
verifyPlugin { enabled = false }
listProductsReleases { enabled = false }
instrumentCode { enabled = false }
// workaround for tests not being found in 2021.3+
// see https://youtrack.jetbrains.com/issue/IDEA-278926#focus=Comments-27-5561012.0-0
test {
isScanForTestClasses = false
include("**/*Test.class")
include("**/Test*.class")
exclude("**/Abstract*Test.class")
}
}
}
subprojects {
repositories {
mavenCentral()
maven(url = "https://pkg.sourceplus.plus/sourceplusplus/protocol")
maven(url = "https://www.jetbrains.com/intellij-repository/releases")
maven(url = "https://www.jetbrains.com/intellij-repository/snapshots")
}
if (!this.toString().contains("commander")) {
apply(plugin = "app.cash.licensee")
configure<app.cash.licensee.LicenseeExtension> {
ignoreDependencies("plus.sourceplus", "protocol")
allow("Apache-2.0")
allow("MIT")
allow("EPL-1.0")
allow("LGPL-2.1-only")
allowUrl("https://raw.githubusercontent.com/apollographql/apollo-kotlin/main/LICENSE") //MIT
allowUrl("https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html") //LGPL 2.1
allowUrl("https://www.bouncycastle.org/licence.html") //MIT
allowUrl("https://api.github.com/licenses/apache-2.0") //Apache 2.0
allowUrl("http://www.jcraft.com/jsch/LICENSE.txt") //BSD-style
allowUrl("http://www.jcraft.com/jzlib/LICENSE.txt") //BSD-style
allowUrl("http://jgrapht.org/LGPL.html") //LGPL 2.1
allowUrl("http://www.eclipse.org/legal/epl-v20.html") //EPL 2.0
allowDependency("net.jcip", "jcip-annotations", "1.0") {
because("Creative Commons")
}
}
}
apply<io.gitlab.arturbosch.detekt.DetektPlugin>()
val detektPlugins by configurations
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.1")
}
tasks {
withType<io.gitlab.arturbosch.detekt.Detekt> {
parallel = true
buildUponDefaultConfig = true
config.setFrom(arrayOf(File(project.rootDir, "detekt.yml")))
}
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
withType<Test> {
testLogging {
events("passed", "skipped", "failed")
setExceptionFormat("full")
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
apply(plugin = "com.diffplug.spotless")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
targetExclude("**/generated/**", "**/liveplugin/**")
val startYear = 2022
val currentYear = Calendar.getInstance().get(Calendar.YEAR)
val copyrightYears = if (startYear == currentYear) {
"$startYear"
} else {
"$startYear-$currentYear"
}
val jetbrainsProject = findProject(":interfaces:jetbrains") ?: rootProject
val licenseHeader = Regex("( . Copyright [\\S\\s]+)")
.find(File(jetbrainsProject.projectDir, "LICENSE").readText())!!
.value.lines().joinToString("\n") {
if (it.trim().isEmpty()) {
" *"
} else {
" * " + it.trim()
}
}
val formattedLicenseHeader = buildString {
append("/*\n")
append(
licenseHeader.replace(
"Copyright [yyyy] [name of copyright owner]",
"Source++, the continuous feedback platform for developers.\n" +
" * Copyright (C) $copyrightYears CodeBrig, Inc."
).replace(
"http://www.apache.org/licenses/LICENSE-2.0",
" http://www.apache.org/licenses/LICENSE-2.0"
)
)
append("/")
}
licenseHeader(formattedLicenseHeader)
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xdebug")
}
}
fun projectDependency(name: String): ProjectDependency {
return if (rootProject.name.contains("jetbrains")) {
DependencyHandlerScope.of(rootProject.dependencies).project(name)
} else {
DependencyHandlerScope.of(rootProject.dependencies).project(":interfaces:jetbrains$name")
}
}
if (hasProperty("buildScan")) {
extensions.findByName("buildScan")?.withGroovyBuilder {
setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service")
setProperty("termsOfServiceAgree", "yes")
}
}