-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathbuild.gradle
More file actions
157 lines (135 loc) · 4.98 KB
/
build.gradle
File metadata and controls
157 lines (135 loc) · 4.98 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
153
154
155
156
157
import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
plugins {
id("org.jetbrains.intellij.platform") version "2.10.5"
id("com.github.hierynomus.license") version "0.16.1"
}
group = pluginGroup
version = pluginVersion
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'org.jetbrains.intellij.platform'
apply plugin: 'license'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
java {
sourceCompatibility = JavaLanguageVersion.of(21)
targetCompatibility = JavaLanguageVersion.of(21)
}
repositories {
mavenLocal()
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
intellijPlatform {
instrumentCode = false
projectName = 'MapStruct-Intellij-Plugin'
pluginConfiguration {
ideaVersion {
sinceBuild = "242"
untilBuild = provider { null } as Provider<? extends String>
}
}
}
// Simple function to load change-notes.html and description.html into valid text for plugin.xml
def htmlFixer = {f -> file(f).text.replace('<html>', '').replace('</html>', '')}
patchPluginXml {
changeNotes = htmlFixer('change-notes.html')
pluginDescription = htmlFixer('description.html')
}
tasks.register('licenseTestData', LicenseCheck) {
source = fileTree(dir: "testData").include("**/*")
}
tasks.register('licenseFormatForKotlin', LicenseFormat) {
source = fileTree(dir: "src/main").include("**/*.kt").include("**/*.xml")
}
license {
header = file('etc/license.txt')
strictCheck = true
mapping {
java = 'SLASHSTAR_STYLE' // IntelliJ reports the JAVADOC_STYLE as a dangling comment
}
excludes([
'**/META-INF/plugin.xml', // For some reason the plugin thinks that the license is not valid
'**/*.properties',
'**/inspectionDescriptions/*.html'
])
}
licenseFormat.dependsOn licenseFormatForKotlin
licenseTest.dependsOn licenseTestData
checkstyle {
toolVersion = '8.36.1'
config = resources.text.fromUri("https://raw.githubusercontent.com/mapstruct/mapstruct/master/build-config/src/main/resources/build-config/checkstyle.xml")
configProperties = [
'checkstyle.cache.file': layout.buildDirectory.get().asFile.toPath( ).resolve( 'checkstyle-cachefile').toString(),
'basedir': 'https://raw.githubusercontent.com/mapstruct/mapstruct/master/build-config',
]
}
jacocoTestReport {
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
html.required = true
}
}
def versionToUse = System.getenv().getOrDefault( 'IDEA_VERSION', ideaVersion )
def useIdeaInstaller = !versionToUse.containsIgnoreCase( "EAP" )
dependencies {
intellijPlatform {
// When versionToUse is 2025.3 or later then there is only a single distribution of IntelliJ
// This comparison can be removed if the oldest supported version of idea is 2025.3 (253) or later
if (('2025.3' <=> versionToUse) <= 0 ){
intellijIdea(versionToUse) {
useInstaller = useIdeaInstaller
}
} else {
ideaType == 'IC' ? intellijIdeaCommunity(versionToUse, useIdeaInstaller) : intellijIdeaUltimate(versionToUse, useIdeaInstaller)
}
bundledPlugin( 'com.intellij.java' )
bundledPlugin( 'org.jetbrains.kotlin' )
testFramework( TestFrameworkType.Platform.INSTANCE )
testFramework( TestFrameworkType.Bundled.INSTANCE )
}
implementation('org.mapstruct:mapstruct:1.5.3.Final')
testImplementation(platform('org.junit:junit-bom:5.11.0'))
testImplementation('org.junit.platform:junit-platform-launcher')
testImplementation('org.junit.jupiter:junit-jupiter-api')
testImplementation('org.junit.jupiter:junit-jupiter-engine')
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')
testImplementation('org.assertj:assertj-core:3.26.3')
testImplementation('org.apache.commons:commons-text:1.15.0')
testImplementation( 'junit:junit:4.13.2' )
testRuntimeOnly('org.immutables:value:2.10.1')
}
tasks.register('libs', Sync) {
from(configurations.runtimeClasspath)
into(layout.buildDirectory.dir("libs"))
preserve {
include('mapstruct-intellij-*.jar')
include('MapStruct-Intellij-*.jar')
}
rename('mapstruct-1.5.3.Final.jar', 'mapstruct.jar')
}
tasks.register('testLibs', Sync) {
from(configurations.testRuntimeClasspath)
into(layout.buildDirectory.dir("test-libs"))
rename('value-2.10.1.jar', 'immutables.jar')
}
test.dependsOn( libs, testLibs )
prepareSandbox.dependsOn( libs )
composedJar.dependsOn( libs )
test {
// Idea SDK needs special configuration
// see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#jacoco-reports-0-coverage
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}