forked from intellij-dlanguage/intellij-dlanguage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
204 lines (168 loc) · 6.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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.grammarkit.tasks.*
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'org.jetbrains.intellij' version '0.4.26'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'net.saliman.cobertura' version '3.0.0'
id 'com.github.kt3k.coveralls' version '2.9.0'
id 'org.jetbrains.grammarkit' version '2020.2'
}
sourceSets {
main {
java.srcDirs 'src/main/java', 'src/main/kotlin', 'gen' , 'src/main/jflex'
resources.srcDirs 'src/main/resources'
}
test {
java.srcDirs 'src/test/java', 'src/test/kotlin'
}
}
version = "${version}"
apply plugin: 'kotlin'
apply plugin: 'cobertura'
apply plugin: 'org.jetbrains.grammarkit'
cobertura.coverageFormats = ['html', 'xml'] // coveralls plugin depends on xml format report
cobertura.coverageSourceDirs = [sourceSets.main.java.srcDirs, sourceSets.main.kotlin.srcDirs, 'gen']
cobertura.coverageEncoding = 'UTF-8'
cobertura.coverageExcludes = [ '.*de.halirutan.mathematica.*', '.*uk.co.cwspencer.*' ]
allprojects {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:deprecation"
}
tasks.withType(Test) {
useJUnit {
include '**/**/*Test.*' // any Java or Kotlin class that ends with 'Test'
}
testLogging {
beforeSuite { suite ->
if (!suite.parent) { // will match the outermost suite
logger.lifecycle ' ----------- Building Tests -----------'
} else if (suite.className != null) {
logger.lifecycle "${suite.className}:"
}
}
afterTest { descriptor, result ->
switch (result.resultType) {
case 'SUCCESS':
case 'PASSED':
logger.info(" {} {}", Os.isFamily(Os.FAMILY_WINDOWS)? "√":"✔", descriptor.name)
break
case TestResult.ResultType.SKIPPED.name():
logger.warn(" {} {}", Os.isFamily(Os.FAMILY_WINDOWS)? "!":"⛔", descriptor.name)
break
case TestResult.ResultType.FAILURE.name():
logger.error(" {} {}", Os.isFamily(Os.FAMILY_WINDOWS)? "×":"✘", descriptor.name)
break
default:
logger.lifecycle(" ? {} {}", descriptor.name, result.resultType)
}
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength) + '\n')
}
}
}
}
// take the version number defined in gradle build and use that in plugin.xml
task initConfig(type: Copy) {
from('src/main/resources') {
include '**/plugin.xml'
filter(ReplaceTokens, tokens: [version: version])
}
}
task testCompilation(type: Test, group: 'Verification', dependsOn: [classes, testClasses]) {
useJUnit {
include 'io/github/intellij/dlanguage/build/**'
}
testLogging {
exceptionFormat = 'full'
}
}
}
apply plugin: 'org.jetbrains.intellij'
intellij {
pluginName 'intellij-dlanguage'
version ideaVersion
//type 'CL' // maybe helpful to change this when trying other IDE. can be 'IC', 'IU', 'JPS', or 'CL'
updateSinceUntilBuild false
// uncomment to test/run/debug the plugin with another IDE such as CLion or AppCode
//alternativeIdePath '<path to>/CLion.app'
//alternativeIdePath 'C:\\Users\\USERNAME\\AppData\\Local\\JetBrains\\Toolbox\\apps\\CLion\\ch-0\\202.7660.37'
//alternativeIdePath "$System.env.HOME/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/202.7660.37"
//alternativeIdePath "$System.env.HOME/.local/share/JetBrains/Toolbox/apps/Rider/ch-0/202.7660.16"
//runIde {
//jbrVersion null
//jbrVersion '11_0_4b304.69'
//}
publishPlugin {
token System.getenv('JETBRAINS_TOKEN')
channels publishChannels
}
}
task generateSyntaxLexer(type : GenerateLexer) {
// source flex file
source 'src/main/jflex/io/github/intellij/dlanguage/lexer/DLanguageLexer.flex'
// target directory for lexer
targetDir 'gen/io/github/intellij/dlanguage/'
// target classname, target file will be targetDir/targetClass.java
targetClass 'DlangLexer'
}
compileJava{
dependsOn generateSyntaxLexer
}
compileKotlin{
dependsOn generateSyntaxLexer
}
repositories {
mavenCentral()
}
dependencies {
// According to https://www.jetbrains.org/intellij/sdk/docs/tutorials/kotlin.html
// we should not include kotlin-runtime and kotlin-stdlib jars with your plugin
//compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
//compileOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile project(':utils')
compile project(':errorreporting')
compile project(':debugger')
testCompile 'io.kotlintest:kotlintest:2+'
}
apply plugin: 'idea'
intellij {
plugins = ['java']
}
idea {
project {
jdkName = javaVersion
languageLevel = javaVersion
}
module {
generatedSourceDirs += file('gen')
}
}
compileKotlin {
kotlinOptions {
suppressWarnings = true
apiVersion = "1.3"
languageVersion = "1.3"
jvmTarget = javaVersion
freeCompilerArgs = [ '-Xjvm-default=enable' ]
}
}