-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
163 lines (144 loc) · 5.22 KB
/
build.gradle
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
plugins {
id 'java'
id 'idea'
id 'checkstyle'
id 'pmd'
id 'org.jetbrains.intellij.platform' version '2.1.0'
id 'org.sonarqube' version '5.1.0.4882'
}
ext {
checkstyleVersion = '10.20.1'
pmdVersion = '7.7.0'
}
def properties(String key) {
return providers.gradleProperty(key)
}
def environment(String key) {
return providers.environmentVariable(key)
}
apply plugin: 'org.jetbrains.intellij.platform'
apply plugin: 'java'
apply plugin: 'checkstyle'
// Add plugin group and version
group = properties("pluginGroup").get()
version = properties("pluginVersion").get()
// Add build script repository to maven central
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
// https://github.com/gradle/gradle/issues/27035
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
dependencies {
intellijPlatform {
create(properties("platformType"), properties("platformVersion"))
bundledPlugins(properties("platformBundledPlugins").map { it.split(",").collect { it.trim() }.findAll { !it.empty } })
plugins(properties("platformPlugins").map { it.split(",").collect { it.trim() }.findAll { !it.empty } })
pluginVerifier()
zipSigner()
instrumentationTools()
testFramework TestFrameworkType.Platform.INSTANCE
}
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
pmd "net.sourceforge.pmd:pmd-ant:${pmdVersion}",
"net.sourceforge.pmd:pmd-java:${pmdVersion}"
testImplementation platform('org.junit:junit-bom:5.11.3'),
'org.junit.jupiter:junit-jupiter',
'org.junit.jupiter:junit-jupiter-engine',
'org.assertj:assertj-core:3.26.3'
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
}
}
// Add intellij task configuration for base intellij version (minimum compatibility)
// This needs to fit the tag <idea-version since-build="xxx"> in plugin.xml
// See https://www.jetbrains.com/intellij-repository/snapshots
// See https://www.jetbrains.com/intellij-repository/releases
intellijPlatform {
pluginConfiguration {
name = properties("pluginName")
version = properties("pluginVersion")
}
patchPluginXml {
pluginId = properties("pluginGroup")
pluginName = properties("pluginName")
pluginVersion = properties("pluginVersion")
sinceBuild = properties("platformSinceBuild")
untilBuild = provider { null }
}
pluginVerification {
ides {
recommended()
}
}
signPlugin {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}
publishPlugin {
token = environment("PUBLISH_TOKEN")
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion")
.map { [((it.split('-') as List)[1] ?: "default").split('\\.').find { true }.toLowerCase()] }
}
}
checkstyle {
configDirectory = file("$rootProject.projectDir/.config/checkstyle")
ignoreFailures false
showViolations true
toolVersion = checkstyleVersion
}
pmd {
consoleOutput = true
ruleSetFiles = files(".config/pmd/ruleset.xml")
toolVersion = pmdVersion
}
tasks.withType(Checkstyle).configureEach {
enabled = project.hasProperty("checkstyleEnabled");
}
tasks.withType(Pmd).configureEach {
enabled = project.hasProperty("pmdEnabled")
}
// Configure compileJava AND compileTestJava
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.compile.JavaCompile.html
tasks.withType(JavaCompile).configureEach {
// JAVA compatibility
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
compileTestJava.options.encoding = 'UTF-8'
// Activate junit since gradle 4.7
test {
useJUnitPlatform()
}
sonar {
properties {
// Ignore sonar warnings globally
property 'sonar.issue.ignore.multicriteria', 'S1948'
// Ignore serialization waring as it's only relevant for RMI which is not used
property 'sonar.issue.ignore.multicriteria.S1948.ruleKey', 'java:S1948'
property 'sonar.issue.ignore.multicriteria.S1948.resourceKey', '**/*.java'
}
}
// Add resources directory because intellij test framework checks there for test resources (instead of build/resources)
sourceSets {
test.output.resourcesDir = "build/classes/java/resources"
}
tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
}
}