forked from mplushnikov/lombok-intellij-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
167 lines (139 loc) · 4.51 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
plugins {
id "org.jetbrains.intellij" version "0.4.3"
id "org.jetbrains.grammarkit" version "2018.3"
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}
repositories {
mavenCentral()
mavenLocal()
}
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 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
updateSinceUntilBuild true
sameSinceUntilBuild false
sandboxDirectory = "${rootProject.projectDir}/idea-sandbox/idea-${ideaVersion}"
plugins 'coverage'
}
patchPluginXml {
version artifactVersion
// use open until build for last release and EAP-Build
if (isEAP || (ideaVersion == lastReleaseVersion)) {
untilBuild ""
}
pluginDescription(file(descriptionFile).text)
changeNotes(file(changesFile).text)
}
publishPlugin {
username System.getenv('IJ_REPO_USERNAME')
password System.getenv('IJ_REPO_PASSWORD')
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
configurations {
lombok
}
dependencies {
lombok group: 'org.projectlombok', name: 'lombok', version: '1.18.6', classifier: 'sources', ext: 'jar'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.25.1'
}
// 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/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/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")
}
//grammarKit {
// //tag or short commit hash of IntelliJ patched JFlex
// jflexRelease = '1.7.0-1'
// //tag or short commit hash of Grammar-Kit to use
// grammarKitRelease = '34fd65b92a'
//}
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
//plugins.withType(JavaPlugin) {
// test {
// systemProperty "NO_FS_ROOTS_ACCESS_CHECK", "true"
// }
//}