-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbuild.gradle
229 lines (215 loc) · 8.83 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
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
220
221
222
223
224
225
226
227
228
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
plugins {
id 'jacoco'
id 'org.unbroken-dome.test-sets' version '4.1.0'
id "io.freefair.lombok" version "8.3"
id("org.jetbrains.intellij.platform") version "2.0.1"
}
apply plugin: 'groovy'
apply plugin: 'java'
def enableIdeaGroovyPlugin=Boolean.valueOf(enableIdeaGroovyPlugin)
def groovyOn = enableIdeaGroovyPlugin ? 'enabled':'disabled'
def enableIdeaScalaPlugin=Boolean.valueOf(enableIdeaScalaPlugin)
def scalaOn = enableIdeaScalaPlugin ? 'enabled':'disabled'
println "*****************************************************************************************************************************************************************"
println " Running build for ideaVersion: $ideaVersion and scalaPluginVersion: $scalaPluginVersion with Groovy plugin ${groovyOn} and Scala plugin ${scalaOn}"
println "*****************************************************************************************************************************************************************"
def isRunInCI=Boolean.valueOf(System.getenv('CI'))
def turnOffPlugins = []
if (!enableIdeaScalaPlugin) {
turnOffPlugins += "org.intellij.scala"
}
if (!enableIdeaGroovyPlugin) {
turnOffPlugins += "org.intellij.groovy"
}
ext {
useInstaller = ideaVersion != 'LATEST-EAP-SNAPSHOT' //EAP versions are not bundled with OS installer. for other versions better use bundled OS installer as it's more like production environment
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
snapshots()
}
}
dependencies {
intellijPlatform {
create(providers.gradleProperty("ideaType"), providers.gradleProperty("ideaVersion"), useInstaller)
jetbrainsRuntime()
bundledPlugins(["org.intellij.groovy"])
plugins(["org.intellij.scala:" + scalaPluginVersion])
instrumentationTools()
prepareTestSandbox {
disabledPlugins = turnOffPlugins
}
pluginVerifier()
testFramework(TestFrameworkType.JUnit5.INSTANCE)
testFramework(TestFrameworkType.Plugin.Java.INSTANCE)
pluginModule(implementation(project(':testme-intellij-common')))
pluginModule(implementation(project(':testme-intellij-groovy')))
pluginModule(implementation(project(':testme-intellij-scala')))
}
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation 'org.mockito:mockito-core:5.13.0'
testImplementation("org.spockframework:spock-core:2.3-groovy-3.0")
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}
def shouldInstrumentCode = !Boolean.valueOf(System.getProperty('skipCodeInstrumentation', 'false'))
intellijPlatform {
projectName = 'TestMe'
instrumentCode = shouldInstrumentCode
pluginConfiguration {
id = group
name = 'TestMe'
version = testMeVersion
ideaVersion {
sinceBuild = '232'
untilBuild = providers.provider { null }
}
}
publishing {
token = System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken")
channels = [ideaPublishChannel]
}
pluginVerification {
ides {
recommended()
// ide IntelliJPlatformType.IntellijIdeaUltimate, "2023.3"
// ide IntelliJPlatformType.IntellijIdeaCommunity, "2024.2"
}
// freeArgs = listOf(
// "-mute",
// "TemplateWordInPluginId,ForbiddenPluginIdPrefix"
// )
}
}
allprojects {
sourceCompatibility = jvmTargetVersion
targetCompatibility = jvmTargetVersion
jacoco {
toolVersion = "0.8.11"
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
if (!javaHome) {
println "javaHome var not set. setting java home from JAVA_HOME env var"
javaHome = System.getenv().JAVA_HOME // javaHome = 'C:\\Program Files\\AdoptOpenJDK\\jdk-13.0.2.8-hotspot'
}
println "JAVA_HOME=$javaHome"
}
testSets {
integrationTest
}
integrationTest {
afterTest { desc, result ->
println "Executing test [${desc.className}].${desc.name} with result: ${result.resultType}"
}
reports.html.required = !isRunInCI
// exclude '**/TestMeGenerator*' //temp exclude. for shortening build time when testing build changes
// include '**/utils/TestSubjectResolverUtilsTest.class' //temp exclude
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}
tasks.withType(Test) {
systemProperty 'java.awt.headless', 'true'
systemProperty 'enableIdeaGroovyPlugin', enableIdeaGroovyPlugin
systemProperty 'enableIdeaScalaPlugin', enableIdeaScalaPlugin
reports.html.destination = file("${reporting.baseDir}/${name}")
testLogging {
exceptionFormat = TestExceptionFormat.FULL
// events TestLogEvent.FAILED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR
events TestLogEvent.values()
showStandardStreams = true
}
}
}
test {
afterTest { desc, result ->
println "Executing test [${desc.className}].${desc.name} with result: ${result.resultType}"
}
reports.html.required = !isRunInCI
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
useJUnitPlatform()
}
jacocoTestReport {
dependsOn test
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
html.required = !isRunInCI
}
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: 'com/weirddev/testme/intellij/ui/**')
})
outputs.upToDateWhen { false } // Always generate report
}
//tasks.register('jacocoRootReport', JacocoReport) {
// description = 'Generates an aggregate report from all subprojects'
// dependsOn check, jacocoMerge
// additionalSourceDirs.from = files(testedProjects.sourceSets.main.allSource.srcDirs)
// sourceDirectories.from = files(testedProjects.sourceSets.main.allSource.srcDirs)
//// classDirectories.from = files(testedProjects.sourceSets.main.output)
//// classDirectories.setFrom(instrumentCode)
// classDirectories.setFrom(testedProjects.collect { it.instrumentCode })
// //https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin-faq.html#jacoco-reports-0-coverage
//// executionData files(testedProjects*.tasks.withType(Test).executionData)
// executionData jacocoMerge.destinationFile
// reports {
// xml.enabled true //isRunInCI
// html.enabled !isRunInCI
// html.destination file("${buildDir}/jacocoHtml")
// }
//}
def javadocHeader = ""
task templateContextJavadocs(type: Javadoc, description: 'Generate javadocs for template context', group: 'Documentation') {
dependsOn delombok
// failOnError = false
destinationDir = file("$buildDir/docs/templateContextJavadoc")
title = "$project.name $version API"
options.author true
options.version true
options.memberLevel = JavadocMemberLevel.PUBLIC
options.links 'http://docs.oracle.com/javase/17/docs/api/'
options.addStringOption 'Xdoclint:none', '-quiet'
options.addBooleanOption "-allow-script-in-comments", true
options.header = javadocHeader
// source = sourceSets.main.allJava
source += delombok
// classpath = configurations.compile //should default to project.sourceSets.main.compileClasspath
// classpath += configurations.runtimeClasspath
include 'com/weirddev/testme/intellij/template/context/*'
exclude 'com/weirddev/testme/intellij/template/context/impl*'
}
task allJavadocs(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') {
dependsOn delombok
// failOnError = false
destinationDir = file("$buildDir/docs/allJavadoc")
title = "$project.name $version API"
options.author true
options.version true
options.links 'http://docs.oracle.com/javase/17/docs/api/'
options.memberLevel = JavadocMemberLevel.PUBLIC
options.addBooleanOption "-allow-script-in-comments", true
options.header = javadocHeader
options.addStringOption 'Xdoclint:none', '-quiet'
(subprojects+project).each { proj ->
proj.tasks.withType(Javadoc).each { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += "**/*.form"
excludes += "**/*.flex"
}
}
}