forked from mplushnikov/lombok-intellij-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
176 lines (148 loc) · 4.69 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
plugins {
id "org.jetbrains.intellij" version "0.4.26"
id "org.jetbrains.grammarkit" version "2020.2.1"
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}
allprojects {
repositories {
jcenter()
maven { url "https://www.jitpack.io" }
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'org.jetbrains.grammarkit'
apply plugin: 'jacoco'
apply plugin: "com.github.ManifestClasspath"
def isCI = System.getenv("CI")
def ideaVersionExternDefinition = System.getenv("IDEA_VERSION")
ideaVersion = ideaVersionExternDefinition ? ideaVersionExternDefinition : ideaVersion
def isEAP = ideaVersion.contains("LATEST-EAP-SNAPSHOT") || ideaVersion.take(4).contains(".")
def artifactVersion = pluginVersion + "-" + (isEAP ? "EAP" : ideaVersion)
println "IdeaVersion is : ${ideaVersion}"
println "ArtifactVersion is : ${artifactVersion}"
group = pluginGroup
version = artifactVersion
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
sourceSets {
main {
java.srcDirs 'src/main/java', 'generated/src'
resources.srcDirs 'src/main/resources', 'generated/resources'
}
test {
java.srcDir 'test/java'
resources.srcDirs 'test/resources', 'testData'
}
}
intellij {
version ideaVersion
println "Building for IntelliJ version: ${version}"
pluginName pluginName
sandboxDirectory = "${rootProject.projectDir}/idea-sandbox/idea-${ideaVersion}"
plugins 'java'
}
patchPluginXml {
version artifactVersion
pluginDescription(file(descriptionFile).text)
changeNotes(file(changesFile).text)
}
publishPlugin {
token System.getenv('IJ_PLUGIN_TOKEN')
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
configurations {
lombok
}
dependencies {
lombok group: 'org.projectlombok', name: 'lombok', version: '1.18.12', classifier: 'sources', ext: 'jar'
testImplementation("junit:junit:4.13")
testImplementation("org.mockito:mockito-core:3.5.11")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.7.0")
}
// Tasks
copy {
includeEmptyDirs = false
from({ zipTree(configurations.lombok.singleFile) }) {
include 'lombok/extern/**'
include 'lombok/experimental/**'
include 'lombok/Builder.java'
include 'lombok/AccessLevel.java'
include 'lombok/*ArgsConstructor.java'
include 'lombok/Cleanup.java'
include 'lombok/CustomLog.java'
include 'lombok/Data.java'
include 'lombok/Delegate.java'
include 'lombok/Getter.java'
include 'lombok/Setter.java'
include 'lombok/EqualsAndHashCode.java'
include 'lombok/NonNull.java'
include 'lombok/Synchronized.java'
include 'lombok/ToString.java'
include 'lombok/SneakyThrows.java'
include 'lombok/Value.java'
include 'lombok/With.java'
include 'lombok/val.java'
include 'lombok/var.java'
include 'lombok/Singular.java'
include 'lombok/core/handlers/Singulars.java'
}
into("generated/src")
}
copy {
includeEmptyDirs = false
from({ zipTree(configurations.lombok.singleFile) }) {
include '**/*.txt'
}
into("generated/resources")
}
task generateLombokConfigParser(type: org.jetbrains.grammarkit.tasks.GenerateParser) {
println "Generating Parser for GrammerKit: ${grammarKit.grammarKitRelease}"
source "src/main/resources/de/plushnikov/intellij/plugin/language/lombokConfig.bnf"
targetRoot = "generated/src"
pathToParser "/de/plushnikov/intellij/plugin/language/parser/LombokConfigParser.java"
pathToPsiRoot "/de/plushnikov/intellij/plugin/language/psi"
}
task generateLombokConfigLexer(type: org.jetbrains.grammarkit.tasks.GenerateLexer) {
dependsOn generateLombokConfigParser
println "Generating Lexer for JFlexRelease: ${grammarKit.jflexRelease}"
source = "src/main/resources/de/plushnikov/intellij/plugin/language/lombokConfig.flex"
targetDir = "generated/src/de/plushnikov/intellij/plugin/language"
targetClass = "LombokConfigLexer"
}
clean.doFirst {
delete 'generated', 'out'
}
compileJava.dependsOn generateLombokConfigLexer
check.dependsOn jacocoTestReport
test {
// show standard out and standard error of the test JVM(s) on the console
testLogging {
exceptionFormat = 'full'
showStandardStreams = true
}
if (isCI) {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
exceptionFormat "full"
}
}
// listen to events in the test execution lifecycle
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
runIde {
// jvmArgs '-agentpath:"D:\\yjpagent.dll"'
// jvmArgs '-Didea.ProcessCanceledException=disabled'
}