forked from mapstruct/mapstruct-idea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
165 lines (140 loc) · 4.24 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
import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat
plugins {
id "org.jetbrains.intellij" version "0.4.21"
id "com.github.hierynomus.license" version "0.14.0"
id "de.undercouch.download" version "4.0.4"
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
}
group pluginGroup
version pluginVersion
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'license'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'kotlin'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://dl.bintray.com/jetbrains/intellij-plugin-service'
}
}
intellij {
version System.getenv().getOrDefault('IDEA_VERSION', '2020.1.4')
type ideaType
downloadSources Boolean.valueOf(sources)
sameSinceUntilBuild Boolean.valueOf(isEAP)
alternativeIdePath idePath
updateSinceUntilBuild false
pluginName 'MapStruct-Intellij-Plugin'
if ( !(version.startsWith('2018') || version.startsWith('2019.1'))) {
plugins = ['java', 'Kotlin', 'properties']
} else {
plugins = ['Kotlin', 'properties']
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
// 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 {
// configFile file( new File(new URL("https://raw.githubusercontent.com/mapstruct/mapstruct/master/build-config/src/main/resources/build-config/checkstyle.xml").toURI( ) ) )
}
jacoco {
toolVersion "0.8.2"
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
compile group: 'org.mapstruct', name: 'mapstruct', version: '1.4.0.Beta1'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.11.1'
}
task libs(type: Sync) {
from configurations.compile
into "$buildDir/libs"
preserve {
include 'mapstruct-intellij-*.jar'
}
rename 'mapstruct-1.4.0.Beta1.jar', 'mapstruct.jar'
}
def mockJdkLocation = "https://github.com/JetBrains/intellij-community/raw/master/java/mock"
def mockJdkDest = "$buildDir/mock"
def downloadMockJdk(mockJdkLocation, mockJdkDest, mockJdkVersion) {
def location = mockJdkLocation + mockJdkVersion
def destination = mockJdkDest + mockJdkVersion
download {
src([
"$location/jre/lib/annotations.jar",
"$location/jre/lib/rt.jar"
])
dest "$destination/jre/lib/"
overwrite false
quiet false
}
}
task downloadMockJdk7() {
def jdkVersion = "JDK-1.7"
def mockJdk7Location = mockJdkLocation + jdkVersion
def mockJdk7Dest = mockJdkDest + jdkVersion
downloadMockJdk(mockJdkLocation, mockJdkDest, jdkVersion)
download {
src([
"$mockJdk7Location/src.zip"
])
dest "$mockJdk7Dest"
overwrite false
quiet false
}
}
task downloadMockJdk8() {
downloadMockJdk(mockJdkLocation, mockJdkDest, "JDK-1.8")
}
test.dependsOn( libs, downloadMockJdk7, downloadMockJdk8 )
test {
testLogging {
exceptionFormat = 'full'
}
}