-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.gradle
143 lines (121 loc) · 4.33 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
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.0.1"
id "com.github.hierynomus.license" version "0.16.1"
id "de.undercouch.download" version "5.6.0"
}
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 = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenLocal()
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
intellijPlatform {
instrumentCode = false
projectName = 'MapStruct-Intellij-Plugin'
pluginConfiguration {
ideaVersion {
sinceBuild = "233"
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')
}
task licenseTestData(type: LicenseCheck) {
source = fileTree(dir: "testData").include("**/*")
}
task licenseFormatForKotlin(type: LicenseFormat) {
source = fileTree(dir: "src/main").include("**/*.kt").include("**/*.xml")
}
license {
header rootProject.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': rootProject.layout.buildDirectory.get().asFile.toPath( ).resolve( 'checkstyle-cachefile').toString(),
'basedir': 'https://raw.githubusercontent.com/mapstruct/mapstruct/master/build-config',
]
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
def versionToUse = System.getenv().getOrDefault( 'IDEA_VERSION', ideaVersion )
def useInstaller = !versionToUse.containsIgnoreCase( "EAP" )
dependencies {
intellijPlatform {
ideaType == 'IC' ? intellijIdeaCommunity(versionToUse, useInstaller) : intellijIdeaUltimate(versionToUse, useInstaller)
jetbrainsRuntime()
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.12.0')
testImplementation( 'junit:junit:4.13.2' )
}
task libs(type: 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'
}
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'
}
}