This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 635
/
build.gradle
170 lines (140 loc) · 4.43 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
plugins {
id 'java'
id 'jacoco'
id("org.jetbrains.intellij") version "1.16.1"
id("org.jetbrains.grammarkit") version "2022.3.2"
id("dev.bmac.intellij.plugin-uploader") version "1.3.2"
}
repositories {
mavenCentral()
}
def isCI = System.getenv("CI")
def platformVersionExternDefinition = System.getenv("IDEA_VERSION")
platformVersion = platformVersionExternDefinition ? platformVersionExternDefinition : platformVersion
def isEAP = platformVersion.contains("LATEST-EAP-SNAPSHOT") || platformVersion.take(4).contains(".")
def artifactVersion = pluginVersion + "-" + (isEAP ? "EAP" : platformVersion)
println "PlatformVersion is : ${platformVersion}"
println "ArtifactVersion is : ${artifactVersion}"
group = pluginGroup
version = artifactVersion
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
configurations {
lombok
}
dependencies {
lombok group: 'org.projectlombok', name: 'lombok', version: '1.18.30', classifier: 'sources', ext: 'jar'
testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-core:5.8.0")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.1")
}
task generateLombok {
doLast {
copy {
includeEmptyDirs = false
from({ zipTree(configurations.lombok.singleFile) }) {
include 'lombok/core/handlers/Singulars.java'
}
into("generated/src")
}
copy {
includeEmptyDirs = false
from({ zipTree(configurations.lombok.singleFile) }) {
include '**/*.txt'
}
into("generated/resources")
}
}
}
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)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
dependsOn("generateLexer", /*"generateParser",*/ "generateLombok")
}
tasks {
sourceSets {
main {
java.srcDirs 'src/main/java', 'generated/src', 'lang/src'
resources.srcDirs 'src/main/resources', 'generated/resources'
}
test {
java.srcDir 'test/java'
resources.srcDirs 'test/resources', 'testData'
}
}
processResources {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
clean {
delete("generated")
delete("out")
}
generateLexer {
println "Generating Lexer for JFlexRelease: ${grammarKit.jflexRelease}"
sourceFile = file("src/main/resources/de/plushnikov/intellij/plugin/language/lombokConfig.flex")
targetDir = "lang/src/de/plushnikov/intellij/plugin/language"
targetClass = "LombokConfigLexer"
purgeOldFiles = true
}
generateParser {
println "Generating Parser for GrammerKit: ${grammarKit.grammarKitRelease}"
sourceFile = file("src/main/resources/de/plushnikov/intellij/plugin/language/lombokConfig.bnf")
targetRoot = "lang/src"
pathToParser = "/de/plushnikov/intellij/plugin/language/parser/LombokConfigParser.java"
pathToPsiRoot = "/de/plushnikov/intellij/plugin/language/psi"
purgeOldFiles = true
}
intellij {
version = platformVersion
println "Building for IntelliJ version: ${platformVersion}"
pluginName = intellijPluginName
sandboxDir = "${rootProject.projectDir}/idea-sandbox/idea-${platformVersion}"
plugins = ['com.intellij.java']
}
patchPluginXml {
version = artifactVersion
pluginDescription = file(descriptionFile).text
changeNotes = file(changesFile).text
}
buildPlugin {
archiveBaseName = intellijPluginName
}
publishPlugin {
token = System.getenv('IJ_PLUGIN_TOKEN')
}
// signPlugin {
// certificateChain = environment("CERTIFICATE_CHAIN")
// privateKey = environment("PRIVATE_KEY")
// password = environment("PRIVATE_KEY_PASSWORD")
// }
// runIde {
// jvmArgs = listOf("-Xmx1024m", "-XX:+UnlockDiagnosticVMOptions")
// // systemProperty("ide.plugins.snapshot.on.unload.fail", "true")
// // jvmArgs '-agentpath:"D:\\yjpagent.dll"'
// // jvmArgs '-Didea.ProcessCanceledException=disabled'
// }
}