-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
256 lines (224 loc) · 8.46 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/*
* Copyright (c) 2016-2019, Leftshift One
* __________________
* [2019] Leftshift One
* All Rights Reserved.
* NOTICE: All information contained herein is, and remains
* the property of Leftshift One and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Leftshift One
* and its suppliers and may be covered by Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Leftshift One.
*/
buildscript {
ext {
kotlinVersion = "1.4.32"
mockkVersion = "1.9.3"
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "one.leftshift.asteria:asteria-code-analytics:latest.release"
classpath "one.leftshift.asteria:asteria-dependency:latest.release"
classpath "one.leftshift.asteria:asteria-email:latest.release"
classpath "one.leftshift.asteria:asteria-publish:latest.release"
classpath "one.leftshift.asteria:asteria-report:latest.release"
classpath "one.leftshift.asteria:asteria-version:latest.release"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
}
}
apply plugin: "antlr"
apply plugin: "kotlin"
apply plugin: "org.jetbrains.dokka"
apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: "io.codearte.nexus-staging"
apply plugin: "one.leftshift.asteria-email"
apply plugin: "one.leftshift.asteria-report"
apply plugin: "one.leftshift.asteria-code-analytics"
apply plugin: "one.leftshift.asteria-dependency"
apply plugin: "one.leftshift.asteria-publish"
apply plugin: "one.leftshift.asteria-version"
nexusStaging {
packageGroup = "one.leftshift"
serverUrl = "https://s01.oss.sonatype.org/service/local/"
stagingProfileId = System.getenv("OSSRH_STAGING_PROFILE_ID")
username = System.getenv("OSSRH_LOGIN_NAME")
password = System.getenv("OSSRH_LOGIN_PASSWORD")
}
asteriaEmail {
smtpHost = System.getenv("ASTERIA_EMAIL_SMTP_HOST")
if (System.getenv("ASTERIA_EMAIL_SMTP_PORT")) {
smtpPort = System.getenv("ASTERIA_EMAIL_SMTP_PORT").toInteger()
}
smptUser = System.getenv("ASTERIA_EMAIL_SMTP_USER")
smptPassword = System.getenv("ASTERIA_EMAIL_SMTP_PASSWORD")
sender = System.getenv("ASTERIA_EMAIL_SENDER")
}
asteriaReport {
reportingUrl = System.getenv("ASTERIA_REPORT_URL")
depsJsonResult = file("${rootProject.buildDir}/dependencyUpdates/report.json")
junitXmlResults = fileTree(rootProject.projectDir) {
include("**/test-results/*/TEST-*.xml")
}
junitBinaryResults = files(["test"].collect {
"${project.buildDir}/test-results/${it}/binary"
})
}
asteriaDependency {
dependencyManagementEnabled = false
enableBranchSnapshotRepositories = true
}
asteriaCodeAnalytics {
sonarUrl = System.getenv("SONAR_HOST_URL")
sonarLoginToken = System.getenv("SONAR_LOGIN")
sonarProperties = ["sonar.test.inclusions": "**/*Test*/**"]
xmlCoverageReportEnabled = true
coverageExcludes = ["**/canon/api/**"]
}
repositories {
jcenter()
mavenCentral()
}
afterEvaluate { project.tasks.sendReleaseEmail.mustRunAfter project.tasks.postRelease }
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict", "-Xjvm-default=compatibility"]
jvmTarget = JavaVersion.VERSION_1_8
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict", "-Xjvm-default=compatibility"]
jvmTarget = JavaVersion.VERSION_1_8
}
}
dependencies {
antlr "org.antlr:antlr4:4.7.2"
compile "org.antlr:antlr4-runtime:4.7.2"
compile "com.fasterxml.jackson.core:jackson-databind:2.13.3"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
compile "org.apache.commons:commons-lang3:3.0"
compile "commons-codec:commons-codec:1.5"
compile "org.slf4j:slf4j-api:1.7.30"
testCompile "org.junit.jupiter:junit-jupiter-engine:5.5.1"
testCompile "org.assertj:assertj-core:3.11.1"
testCompile "io.mockk:mockk:$mockkVersion"
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile 'ch.qos.logback:logback-classic:1.2.10'
testCompile group: 'org.apache.velocity', name: 'velocity', version: '1.7'
//see: XSLTUpgradeHandlerTest
testRuntimeOnly('xalan:xalan:2.7.2')
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "org.jetbrains.kotlin") {
details.useVersion kotlinVersion
}
}
}
test {
useJUnitPlatform()
}
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = "javadoc"
outputDirectory = "${buildDir}/dokkaJavadoc"
}
task javadocJar(type: Jar) {
from dokkaJavadoc
classifier "javadoc"
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier "sources"
}
artifacts {
archives javadocJar, sourcesJar
}
tasks.withType(Test) { testTask ->
minHeapSize = "1G"
maxHeapSize = "2G"
testTask.beforeTest { descriptor ->
logger.lifecycle(descriptor.toString())
}
}
task createProperties(dependsOn: processResources) {
doLast {
new File("$buildDir/resources/main/config.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p.store w, null
}
}
}
classes {
dependsOn createProperties
}
asteriaPublish {
enableBranchSnapshotRepositories = true
}
publishing {
publications {
release(MavenPublication) {
artifactId = project.name
from components.java
artifact sourceJar
artifact javadocJar
pom.withXml {
Node root = asNode()
root.appendNode("name", "Canon")
root.appendNode("description", "Canon.")
root.appendNode("url", "https://github.com/leftshiftone/Canon")
Node licenses = root.appendNode("licenses")
Node license = licenses.appendNode("license")
license.appendNode("name", "The Apache License, Version 2.0")
license.appendNode("url", "http://www.apache.org/licenses/LICENSE-2.0.txt")
Node developers = root.appendNode("developers")
Node developer = developers.appendNode("developer")
developer.appendNode("id", "leftshiftone")
developer.appendNode("name", "Leftshift One")
developer.appendNode("email", "[email protected]")
developer.appendNode("organization", "Leftshift One Software GmbH")
developer.appendNode("organizationUrl", "https://www.leftshift.one")
Node scm = root.appendNode("scm")
scm.appendNode("connection", "scm:git:git://github.com/leftshiftone/canon.git")
scm.appendNode("developerConnection", "scm:git:ssh://github.com:leftshiftone/canon.git")
scm.appendNode("url", "https://github.com/leftshiftone/canon")
}
}
}
repositories {
maven {
name = "sonatype"
url = version.toString().endsWith("SNAPSHOT") ? "https://s01.oss.sonatype.org/content/repositories/snapshots" : "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username System.getenv("OSSRH_LOGIN_NAME")
password System.getenv("OSSRH_LOGIN_PASSWORD")
}
}
}
}
ext."signing.keyId" = System.getenv("OSSRH_SIGN_KEY_ID")
ext."signing.password" = System.getenv("OSSRH_SIGN_KEY_PASSWORD")
ext."signing.secretKeyRingFile" = System.getenv("OSSRH_SIGN_KEY_PATH")
signing {
sign publishing.publications
}
generateGrammarSource {
outputDirectory = new File(project.buildDir, "generated-src/antlr/canon/antlr")
arguments += ["-visitor", "-package", "canon.antlr"]
}
compileKotlin.dependsOn generateGrammarSource
build.dependsOn generateGrammarSource
compileTestKotlin.dependsOn generateTestGrammarSource
sourceSets.main.java.srcDirs += new File(buildDir, "generated-src/antlr")