-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
157 lines (133 loc) · 4.23 KB
/
build.gradle.kts
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
import java.util.*
plugins {
idea
java
antlr
jacoco
maven
`maven-publish`
id("com.github.gradle-git-version-calculator") version "1.1.0"
id("com.github.hierynomus.license") version "0.15.0"
}
group = "com.github.1c-syntax"
version = gitVersionCalculator.calculateVersion("v")
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://jitpack.io")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
val junitVersion = "5.7.0"
val antlrVersion = "4.7.4"
val antlrGroupId = "com.tunnelvisionlabs"
val antlrArtifactId = "antlr4"
dependencies {
// runtime
compileOnly(antlrGroupId, antlrArtifactId, antlrVersion)
antlr(antlrGroupId, antlrArtifactId, antlrVersion)
implementation("com.github.1c-syntax", "bsl-parser", "8e29bfd87c2a573cba03629f90592e69bab03596") {
exclude("com.tunnelvisionlabs", "antlr4-annotations")
exclude("com.ibm.icu", "*")
exclude("org.antlr", "ST4")
exclude("org.abego.treelayout", "org.abego.treelayout.core")
exclude("org.antlr", "antlr-runtime")
exclude("org.glassfish", "javax.json")
}
// common
compileOnly("commons-io", "commons-io", "2.6")
// tests
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
testImplementation("org.assertj", "assertj-core", "3.17.2")
}
sourceSets {
main {
java.srcDirs("src/main/java", "src/main/gen")
resources.srcDirs("src/main/resources")
}
test {
java.srcDirs("src/test/java")
resources.srcDirs("src/test/resources")
}
}
idea {
module {
// Marks the already(!) added srcDir as "generated"
generatedSourceDirs = generatedSourceDirs + file("src/main/gen")
}
}
tasks.generateGrammarSource {
arguments = listOf(
"-visitor",
"-package",
"com.github._1c_syntax.turbo.gherkin.parser",
"-encoding",
"utf8"
)
outputDirectory = file("src/main/gen/com/github/_1c_syntax/turbo/gherkin/parser")
}
tasks.generateGrammarSource {
doLast {
tasks.licenseFormatMain.get().actions[0].execute(tasks.licenseFormatMain.get())
}
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
reports {
html.isEnabled = true
}
}
tasks.check {
dependsOn(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
reports {
xml.isEnabled = true
xml.destination = File("$buildDir/reports/jacoco/test/jacoco.xml")
}
}
tasks.clean {
doFirst {
delete("src/main/gen", "out")
}
}
license {
header = rootProject.file("license/HEADER.txt")
ext["year"] = "2020-" + Calendar.getInstance().get(Calendar.YEAR)
ext["name"] = "Valery Maximov <maximovvalery@gmail.com>, 1c-syntax team <www.github.com/1c-syntax>, BIA Technologies team <www.bia-tech.ru>"
ext["project"] = "Turbo Gherkin Parser"
exclude("**/*.tokens")
exclude("**/*.interp")
exclude("**/*.g4")
exclude("**/*.feature")
strictCheck = true
mapping("java", "SLASHSTAR_STYLE")
}
publishing {
publications {
create<MavenPublication>("maven") {
artifact(tasks["jar"])
pom.withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations.implementation.get().dependencies.forEach { dependency ->
if (dependency !is SelfResolvingDependency) {
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", dependency.group)
dependencyNode.appendNode("artifactId", dependency.name)
dependencyNode.appendNode("version", dependency.version)
dependencyNode.appendNode("scope", "runtime")
}
}
}
}
}
}